Fix for Issue #449 Qt errors on startup.

windowHandle() is not initialized until the Window is shown. Moved the slot connect to main.cpp file after show(). Had to change the OnFramebufferSizeChanged(); to a slot.
This commit is contained in:
Ramuh 2015-03-22 01:37:08 +01:00
parent 1981aa3d7e
commit 315b8b5b8f
3 changed files with 7 additions and 7 deletions

View File

@ -168,10 +168,6 @@ GRenderWindow::GRenderWindow(QWidget* parent) : QWidget(parent), emu_thread(this
NotifyClientAreaSizeChanged(std::pair<unsigned,unsigned>(child->width(), child->height())); NotifyClientAreaSizeChanged(std::pair<unsigned,unsigned>(child->width(), child->height()));
BackupGeometry(); BackupGeometry();
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
connect(this->windowHandle(), SIGNAL(screenChanged(QScreen*)), this, SLOT(OnFramebufferSizeChanged()));
#endif
} }
void GRenderWindow::moveContext() void GRenderWindow::moveContext()

View File

@ -128,12 +128,12 @@ public:
void ReloadSetKeymaps() override; void ReloadSetKeymaps() override;
void OnClientAreaResized(unsigned width, unsigned height); void OnClientAreaResized(unsigned width, unsigned height);
void OnFramebufferSizeChanged();
public slots: public slots:
void moveContext(); // overridden void moveContext(); // overridden
void OnFramebufferSizeChanged();
private: private:
void OnMinimalClientAreaChangeRequest(const std::pair<unsigned,unsigned>& minimal_size) override; void OnMinimalClientAreaChangeRequest(const std::pair<unsigned,unsigned>& minimal_size) override;

View File

@ -160,6 +160,10 @@ GMainWindow::GMainWindow()
show(); show();
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
connect(render_window->windowHandle(), SIGNAL(screenChanged(QScreen*)), render_window, SLOT(OnFramebufferSizeChanged()));
#endif
QStringList args = QApplication::arguments(); QStringList args = QApplication::arguments();
if (args.length() >= 2) { if (args.length() >= 2) {
BootGame(args[1].toStdString()); BootGame(args[1].toStdString());