added custom info window,

set min size to mainwindow
This commit is contained in:
Anakin
2017-01-16 15:41:37 +01:00
parent 86dfe32145
commit 47c73ed881
6 changed files with 196 additions and 4 deletions

View File

@@ -0,0 +1,27 @@
#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);
}

View File

@@ -19,6 +19,7 @@ MainWindow::MainWindow(QWidget *parent)
, ui(new Ui::MainWindowClass)
, m_curSeverity(0)
, m_output(new QLabel(this))
, m_infoWindow(new FileInfoWindow())
{
ui->setupUi(this);
@@ -33,13 +34,14 @@ MainWindow::MainWindow(QWidget *parent)
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()
{
delete ui;
delete m_output;
delete m_infoWindow;
}
void MainWindow::openFile()
@@ -114,12 +116,12 @@ void MainWindow::setupWidgets()
m_output->setAlignment(Qt::AlignTop);
m_output->setText("Name: -\nMaterials: -\nVertice: -\nTriangle: -");
m_output->raise();
}
void MainWindow::aboutFile()
{
QMessageBox* dialog = new QMessageBox(QMessageBox::NoIcon,
/*QMessageBox* dialog = new QMessageBox(QMessageBox::NoIcon,
WINDOW_NAME,
QString(m_fileInfo.left(m_fileInfo.indexOf("<detail>"))),
QMessageBox::StandardButton::Close,
@@ -129,7 +131,8 @@ void MainWindow::aboutFile()
dialog->setStyleSheet("QLabel{min-width: 200px;}");
dialog->setDetailedText(QString(m_fileInfo.right(m_fileInfo.size() - m_fileInfo.indexOf("<detail>") - 8)));
dialog->exec();
delete dialog;
delete dialog;*/
m_infoWindow->show();
}
void MainWindow::aboutTool()
@@ -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_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)