diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2017-11-21 18:13:06 +0300 |
---|---|---|
committer | Markus Goetz <markus@woboq.com> | 2017-11-29 10:03:06 +0300 |
commit | 30e3932af8dbaed74b327221a94a79c14170678b (patch) | |
tree | 0b204efd7e9b1c688bff800d55aef5b818dd4dd4 /src/gui/folderwizard.cpp | |
parent | e86937e2e2bedb41c6ac9163ae1f068000c7b5e6 (diff) |
FolderWizard: Fix minimum size
There are several bugs in QWizard that needs to be worked around for the minimum
size of the widget to take effect.
Issue #4280
Diffstat (limited to 'src/gui/folderwizard.cpp')
-rw-r--r-- | src/gui/folderwizard.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/gui/folderwizard.cpp b/src/gui/folderwizard.cpp index 441ece4e0..8e460653b 100644 --- a/src/gui/folderwizard.cpp +++ b/src/gui/folderwizard.cpp @@ -35,6 +35,7 @@ #include <QWizardPage> #include <QTreeWidget> #include <QVBoxLayout> +#include <QEvent> #include <stdlib.h> @@ -536,9 +537,11 @@ FolderWizard::FolderWizard(AccountPtr account, QWidget *parent) { setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setPage(Page_Source, _folderWizardSourcePage); + _folderWizardSourcePage->installEventFilter(this); if (!Theme::instance()->singleSyncFolder()) { _folderWizardTargetPage = new FolderWizardRemotePath(account); setPage(Page_Target, _folderWizardTargetPage); + _folderWizardTargetPage->installEventFilter(this); } setPage(Page_SelectiveSync, _folderWizardSelectiveSyncPage); @@ -551,5 +554,25 @@ FolderWizard::~FolderWizard() { } +bool FolderWizard::eventFilter(QObject *watched, QEvent *event) +{ + if (event->type() == QEvent::LayoutRequest) { + // Workaround QTBUG-3396: forces QWizardPrivate::updateLayout() + QTimer::singleShot(0, this, [this] { setTitleFormat(titleFormat()); }); + } + return QWizard::eventFilter(watched, event); +} + +void FolderWizard::resizeEvent(QResizeEvent *event) +{ + QWizard::resizeEvent(event); + + // workaround for QTBUG-22819: when the error label word wrap, the minimum height is not adjusted + int hfw = currentPage()->heightForWidth(currentPage()->width()); + if (currentPage()->height() < hfw) { + currentPage()->setMinimumSize(currentPage()->minimumSizeHint().width(), hfw); + setTitleFormat(titleFormat()); // And another workaround for QTBUG-3396 + } +} } // end namespace |