cosmetic to MainWindow,
drop does not work for widget, fixed offset problem, add esc key
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
#include "..\Header\MainWindow.h"
|
||||
#include "..\Header\OglViewerWidget.h"
|
||||
#include <QSurfaceFormat>
|
||||
#include <QMessageBox>
|
||||
#include <QFileDialog>
|
||||
|
||||
#define WINDOW_NAME "Mesh Viewer"
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
@@ -8,19 +12,54 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
setWindowTitle(WINDOW_NAME);
|
||||
setWindowIcon(QIcon(":/images/icon.ico"));
|
||||
|
||||
ui->statusBar->showMessage("pre-alpha");
|
||||
|
||||
ui->mainToolBar->addAction("Open File", this, &MainWindow::openFile);
|
||||
ui->mainToolBar->addAction("About File", this, &MainWindow::aboutFile);
|
||||
ui->mainToolBar->addAction("Help", this, &MainWindow::aboutTool);
|
||||
|
||||
QSurfaceFormat format;
|
||||
format.setDepthBufferSize(24);
|
||||
QSurfaceFormat::setDefaultFormat(format);
|
||||
|
||||
setCentralWidget(new OglViewerWidget(this));
|
||||
|
||||
setWindowIcon(QIcon(":/images/icon.ico"));
|
||||
setWindowTitle("Mesh Viewer");
|
||||
ui->statusBar->showMessage("pre-alpha");
|
||||
}
|
||||
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void MainWindow::openFile()
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(this, "Open File", "../Release/Msh", "Mesh (*.msh)");
|
||||
dynamic_cast<OglViewerWidget*>(centralWidget())->openFile(fileName.toStdString().c_str());
|
||||
}
|
||||
|
||||
void MainWindow::aboutFile()
|
||||
{
|
||||
QMessageBox* dialog = new QMessageBox(QMessageBox::Information,
|
||||
WINDOW_NAME,
|
||||
"When i find some time, i'll add some information about\nthe file in the detailed text",
|
||||
QMessageBox::StandardButton::Close,
|
||||
this,
|
||||
Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint);
|
||||
dialog->setDetailedText("This is the cool detailed text\n");
|
||||
dialog->exec();
|
||||
}
|
||||
|
||||
void MainWindow::aboutTool()
|
||||
{
|
||||
QMessageBox* dialog = new QMessageBox(QMessageBox::Question,
|
||||
WINDOW_NAME,
|
||||
"This is the Pre-Alpha version of my Mesh Viewer\nCheck the detailed information",
|
||||
QMessageBox::StandardButton::Close,
|
||||
this,
|
||||
Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint);
|
||||
dialog->setDetailedText("left mouse - rotate\nright mouse - move\nscroll - zoom\nspace - reset view\nesc - close");
|
||||
dialog->exec();
|
||||
}
|
||||
Reference in New Issue
Block a user