Commit 47c73ed8 authored by Anakin's avatar Anakin

added custom info window,

set min size to mainwindow
parent 86dfe321
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>FileInfoWindow</class>
<widget class="QWidget" name="FileInfoWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>200</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>File information</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="basic">
<property name="text">
<string>Name: -
Materials: -
Vertices: -
Triangles: -</string>
</property>
</widget>
</item>
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="palette">
<palette>
<active>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>180</width>
<height>222</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="detail">
<property name="text">
<string>No file is open</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
...@@ -10,11 +10,20 @@ ...@@ -10,11 +10,20 @@
<height>400</height> <height>400</height>
</rect> </rect>
</property> </property>
<property name="minimumSize">
<size>
<width>600</width>
<height>400</height>
</size>
</property>
<property name="windowTitle"> <property name="windowTitle">
<string>MainWindow</string> <string>MainWindow</string>
</property> </property>
<widget class="QWidget" name="centralWidget"/> <widget class="QWidget" name="centralWidget"/>
<widget class="QToolBar" name="mainToolBar"> <widget class="QToolBar" name="mainToolBar">
<property name="allowedAreas">
<set>Qt::LeftToolBarArea|Qt::RightToolBarArea|Qt::TopToolBarArea</set>
</property>
<attribute name="toolBarArea"> <attribute name="toolBarArea">
<enum>LeftToolBarArea</enum> <enum>LeftToolBarArea</enum>
</attribute> </attribute>
......
#pragma once
#include <QWidget>
#include <QString>
#include "ui_FileInfoWindow.h"
class FileInfoWindow : public QWidget
{
Q_OBJECT
public:
FileInfoWindow(QWidget *parent = Q_NULLPTR);
~FileInfoWindow();
private:
Ui::FileInfoWindow* ui;
public:
void setBasicText(QString text);
void setDetailText(QString text);
};
\ No newline at end of file
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <QStringList> #include <QStringList>
#include <QLabel> #include <QLabel>
#include "ui_MainWindow.h" #include "ui_MainWindow.h"
#include "..\Header\FileInfoWindow.h"
struct Material; struct Material;
...@@ -23,6 +24,7 @@ private: ...@@ -23,6 +24,7 @@ private:
void setupWidgets(); void setupWidgets();
QByteArray m_fileInfo; QByteArray m_fileInfo;
QLabel* m_output; QLabel* m_output;
FileInfoWindow* m_infoWindow;
private: private:
void openFile(); void openFile();
......
#include "..\Header\FileInfoWindow.h"
#include <QIcon>
FileInfoWindow::FileInfoWindow(QWidget *parent)
: QWidget(parent)
, ui(new Ui::FileInfoWindow)
{
ui->setupUi(this);
setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint | Qt::NoDropShadowWindowHint);
}
FileInfoWindow::~FileInfoWindow()
{
delete ui;
}
void FileInfoWindow::setBasicText(QString text)
{
ui->basic->setText(text);
}
void FileInfoWindow::setDetailText(QString text)
{
ui->detail->setText(text);
}
...@@ -19,6 +19,7 @@ MainWindow::MainWindow(QWidget *parent) ...@@ -19,6 +19,7 @@ MainWindow::MainWindow(QWidget *parent)
, ui(new Ui::MainWindowClass) , ui(new Ui::MainWindowClass)
, m_curSeverity(0) , m_curSeverity(0)
, m_output(new QLabel(this)) , m_output(new QLabel(this))
, m_infoWindow(new FileInfoWindow())
{ {
ui->setupUi(this); ui->setupUi(this);
...@@ -33,13 +34,14 @@ MainWindow::MainWindow(QWidget *parent) ...@@ -33,13 +34,14 @@ MainWindow::MainWindow(QWidget *parent)
ui->statusBar->showMessage("MeshViewer by Anakin", 0); ui->statusBar->showMessage("MeshViewer by Anakin", 0);
m_fileInfo += "Filename: -\nMaterials: -\nVertices: -\nTriangle: -\n<detail>No file is open"; m_fileInfo += "Filename: -\nMaterials: -\nVertices: -\nTriangle: -<detail>No file is open";
} }
MainWindow::~MainWindow() MainWindow::~MainWindow()
{ {
delete ui; delete ui;
delete m_output; delete m_output;
delete m_infoWindow;
} }
void MainWindow::openFile() void MainWindow::openFile()
...@@ -114,12 +116,12 @@ void MainWindow::setupWidgets() ...@@ -114,12 +116,12 @@ void MainWindow::setupWidgets()
m_output->setAlignment(Qt::AlignTop); m_output->setAlignment(Qt::AlignTop);
m_output->setText("Name: -\nMaterials: -\nVertice: -\nTriangle: -"); m_output->setText("Name: -\nMaterials: -\nVertice: -\nTriangle: -");
m_output->raise(); m_output->raise();
} }
void MainWindow::aboutFile() void MainWindow::aboutFile()
{ {
QMessageBox* dialog = new QMessageBox(QMessageBox::NoIcon, /*QMessageBox* dialog = new QMessageBox(QMessageBox::NoIcon,
WINDOW_NAME, WINDOW_NAME,
QString(m_fileInfo.left(m_fileInfo.indexOf("<detail>"))), QString(m_fileInfo.left(m_fileInfo.indexOf("<detail>"))),
QMessageBox::StandardButton::Close, QMessageBox::StandardButton::Close,
...@@ -129,7 +131,8 @@ void MainWindow::aboutFile() ...@@ -129,7 +131,8 @@ void MainWindow::aboutFile()
dialog->setStyleSheet("QLabel{min-width: 200px;}"); dialog->setStyleSheet("QLabel{min-width: 200px;}");
dialog->setDetailedText(QString(m_fileInfo.right(m_fileInfo.size() - m_fileInfo.indexOf("<detail>") - 8))); dialog->setDetailedText(QString(m_fileInfo.right(m_fileInfo.size() - m_fileInfo.indexOf("<detail>") - 8)));
dialog->exec(); dialog->exec();
delete dialog; delete dialog;*/
m_infoWindow->show();
} }
void MainWindow::aboutTool() void MainWindow::aboutTool()
...@@ -189,6 +192,10 @@ void MainWindow::setFileInfo(QString name, QVector<Material>* materials, int ver ...@@ -189,6 +192,10 @@ void MainWindow::setFileInfo(QString name, QVector<Material>* materials, int ver
} }
m_output->setText(m_fileInfo.left(m_fileInfo.indexOf("<detail>"))); m_output->setText(m_fileInfo.left(m_fileInfo.indexOf("<detail>")));
m_infoWindow->setBasicText(QString(m_fileInfo.left(m_fileInfo.indexOf("<detail>"))));
m_infoWindow->setDetailText(QString(m_fileInfo.right(m_fileInfo.size() - m_fileInfo.indexOf("<detail>") - 8)));
} }
void MainWindow::printMessage(QString message, int severity) void MainWindow::printMessage(QString message, int severity)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment