Added new Project using Qt,
There is garbage left from Qt??
This commit is contained in:
44
MeshViewerQt/Source/MainWindow.cpp
Normal file
44
MeshViewerQt/Source/MainWindow.cpp
Normal file
@@ -0,0 +1,44 @@
|
||||
#include "MainWindow.h"
|
||||
#include "OpenGlViewer.h"
|
||||
#include "defines.h"
|
||||
#include <QKeyEvent>
|
||||
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
, ui (new Ui::MainWindowClass)
|
||||
{
|
||||
setupWindow();
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void MainWindow::setupWindow()
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
this->setWindowTitle(WINDOW_NAME);
|
||||
this->setWindowIcon(QIcon(":/MainWindow/icon.ico"));
|
||||
this->resize(WINDOW_WIDTH, WINDOW_HEIGHT);
|
||||
|
||||
this->setCentralWidget(new OpenGlViewer(this));
|
||||
|
||||
ui->statusBar->showMessage(DEFAULT_STATUS_MESSAGE);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::keyPressEvent(QKeyEvent * keyEvent)
|
||||
{
|
||||
switch (keyEvent->key())
|
||||
{
|
||||
case Qt::Key::Key_Escape:
|
||||
close();
|
||||
break;
|
||||
}
|
||||
|
||||
QMainWindow::keyPressEvent(keyEvent);
|
||||
}
|
34
MeshViewerQt/Source/OpenGlViewer.cpp
Normal file
34
MeshViewerQt/Source/OpenGlViewer.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
#include "OpenGlViewer.h"
|
||||
#include "defines.h"
|
||||
|
||||
OpenGlViewer::OpenGlViewer(QWidget *parent)
|
||||
: QOpenGLWidget(parent)
|
||||
{
|
||||
QSurfaceFormat format;
|
||||
format.setVersion(DEFAULT_MAJOR_VERSION, DEFAULT_MINOR_VERSION);
|
||||
format.setProfile(QSurfaceFormat::CoreProfile);
|
||||
this->setFormat(format);
|
||||
|
||||
}
|
||||
|
||||
OpenGlViewer::~OpenGlViewer()
|
||||
{
|
||||
}
|
||||
|
||||
void OpenGlViewer::initializeGL()
|
||||
{
|
||||
initializeOpenGLFunctions();
|
||||
|
||||
glClearColor(DEAFAULT_BACKGROUND);
|
||||
}
|
||||
|
||||
void OpenGlViewer::resizeGL(int w, int h)
|
||||
{
|
||||
//TODO: change perspective
|
||||
}
|
||||
|
||||
void OpenGlViewer::paintGL()
|
||||
{
|
||||
//TODO: paint here
|
||||
}
|
||||
|
Reference in New Issue
Block a user