diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2017-09-22 14:17:14 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2017-09-22 14:25:26 +0200 |
commit | 125c1673c267fdff97332adc82436c66342a9bf9 (patch) | |
tree | 88b62e094e08d472b0cb3588d4619974ef65c07e | |
parent | 55fe003f5ca47def59057df9d51661a483eec894 (diff) |
gui: call adjust-size() after show()
-rw-r--r-- | gui/main-window.cpp | 24 | ||||
-rw-r--r-- | gui/main.cpp | 2 |
2 files changed, 10 insertions, 16 deletions
diff --git a/gui/main-window.cpp b/gui/main-window.cpp index 17702789..e12b85a7 100644 --- a/gui/main-window.cpp +++ b/gui/main-window.cpp @@ -46,9 +46,7 @@ MainWindow::MainWindow() : ui.setupUi(this); { - setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - adjustSize(); - setFixedSize(size()); + setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | windowFlags()); } @@ -587,13 +585,15 @@ bool MainWindow::mk_window_common(ptr<t>& d, F&& ctor) } else if ((d = ptr<t>(ctor()))) { - QEventLoop e(d.get()); + QWidget& w = *d; - e.processEvents(); d->adjustSize(); e.processEvents(); + w.setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | w.windowFlags()); - // drain the event loop to reflow properly - d->setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | d->windowFlags()); e.processEvents(); - d->show(); + w.setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + + w.show(); + w.adjustSize(); + w.setFixedSize(w.size()); return true; } @@ -616,14 +616,6 @@ bool MainWindow::mk_dialog(std::shared_ptr<dylib> lib, ptr<t>& d) return nullptr; }); - if (just_created) - { - using plugin_api::detail::BaseDialog; - QObject::connect(static_cast<BaseDialog*>(d.get()), &BaseDialog::closing, - this, [&d]() { d = nullptr; }, - Qt::QueuedConnection); - } - return just_created; } diff --git a/gui/main.cpp b/gui/main.cpp index 99f63267..3481c534 100644 --- a/gui/main.cpp +++ b/gui/main.cpp @@ -178,6 +178,8 @@ main(int argc, char** argv) { w->setVisible(true); w->show(); + w->adjustSize(); + w->setFixedSize(w->size()); } else w->setVisible(false); |