[Qt] Add MainWindow class

This commit is contained in:
wheremyfoodat 2023-09-30 17:07:54 +03:00
parent 55bb0d7170
commit 155d2b8f24
5 changed files with 32 additions and 10 deletions

View file

@ -1,18 +1,12 @@
#include <QApplication>
#include <QtWidgets>
#include "panda_qt/main_window.hpp"
#include "panda_qt/screen.hpp"
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
QWidget window;
MainWindow window(&app);
window.resize(320, 240);
window.show();
window.setWindowTitle("Alber");
ScreenWidget screen(&window);
screen.show();
screen.resize(320, 240);
return app.exec();
}

View file

@ -0,0 +1,10 @@
#include "panda_qt/main_window.hpp"
MainWindow::MainWindow(QApplication* app, QWidget* parent) : QMainWindow(parent), screen(this) {
setWindowTitle("Alber");
// Enable drop events for loading ROMs
setAcceptDrops(true);
resize(320, 240);
screen.show();
}

View file

@ -20,6 +20,8 @@
#ifdef PANDA3DS_ENABLE_OPENGL
ScreenWidget::ScreenWidget(QWidget* parent) : QWidget(parent) {
// Create a native window for use with our graphics API of choice
resize(320, 240);
setAutoFillBackground(false);
setAttribute(Qt::WA_NativeWindow, true);
setAttribute(Qt::WA_NoSystemBackground, true);