diff options
author | Fabian Bumberger <fbumberger@rim.com> | 2014-04-10 15:09:42 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-04-14 16:47:51 +0200 |
commit | bfb25c03523757d66974189e54dda97962206ef9 (patch) | |
tree | dfab8cbdef59429f2c8b7b531dc3ff97fd7ec581 /src/widgets/widgets/qfontcombobox.cpp | |
parent | ff34070709dd16a66d3b3e9b1f919e77d33698e5 (diff) |
Restrict QFontComboBox's popup width to screen width
Change-Id: I5a92308beb2f245d9f031918bb8154757316ef56
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/widgets/widgets/qfontcombobox.cpp')
-rw-r--r-- | src/widgets/widgets/qfontcombobox.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/widgets/widgets/qfontcombobox.cpp b/src/widgets/widgets/qfontcombobox.cpp index 2bbf3730db..40ca73904c 100644 --- a/src/widgets/widgets/qfontcombobox.cpp +++ b/src/widgets/widgets/qfontcombobox.cpp @@ -50,6 +50,7 @@ #include <qevent.h> #include <qapplication.h> #include <private/qcombobox_p.h> +#include <QDesktopWidget> #include <qdebug.h> QT_BEGIN_NAMESPACE @@ -546,8 +547,10 @@ bool QFontComboBox::event(QEvent *e) { if (e->type() == QEvent::Resize) { QListView *lview = qobject_cast<QListView*>(view()); - if (lview) - lview->window()->setFixedWidth(width() * 5 / 3); + if (lview) { + setFixedWidth(qMin(width() * 5 / 3, + QApplication::desktop()->availableGeometry(lview).width())); + } } return QComboBox::event(e); } |