[Pkg-owncloud-commits] [owncloud-client] 25/60: FolderWizard: Fix minimum size

Sandro Knauß hefee at debian.org
Sat Dec 16 10:38:12 UTC 2017


This is an automated email from the git hooks/post-receive script.

hefee pushed a commit to branch upstream
in repository owncloud-client.

commit 30e3932af8dbaed74b327221a94a79c14170678b
Author: Olivier Goffart <ogoffart at woboq.com>
Date:   Tue Nov 21 16:13:06 2017 +0100

    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
---
 src/gui/folderwizard.cpp | 23 +++++++++++++++++++++++
 src/gui/folderwizard.h   |  3 +++
 2 files changed, 26 insertions(+)

diff --git a/src/gui/folderwizard.cpp b/src/gui/folderwizard.cpp
index 441ece4..8e46065 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
diff --git a/src/gui/folderwizard.h b/src/gui/folderwizard.h
index e24cb5a..b6f056f 100644
--- a/src/gui/folderwizard.h
+++ b/src/gui/folderwizard.h
@@ -149,6 +149,9 @@ public:
     explicit FolderWizard(AccountPtr account, QWidget *parent = 0);
     ~FolderWizard();
 
+    bool eventFilter(QObject *watched, QEvent *event) override;
+    void resizeEvent(QResizeEvent *event) override;
+
 private:
     FolderWizardLocalPath *_folderWizardSourcePage;
     FolderWizardRemotePath *_folderWizardTargetPage;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list