From bfb25c03523757d66974189e54dda97962206ef9 Mon Sep 17 00:00:00 2001 From: Fabian Bumberger Date: Thu, 10 Apr 2014 15:09:42 +0200 Subject: [PATCH] Restrict QFontComboBox's popup width to screen width Change-Id: I5a92308beb2f245d9f031918bb8154757316ef56 Reviewed-by: Marc Mutz --- src/widgets/widgets/qfontcombobox.cpp | 7 +++++-- 1 file 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 #include #include +#include #include QT_BEGIN_NAMESPACE @@ -546,8 +547,10 @@ bool QFontComboBox::event(QEvent *e) { if (e->type() == QEvent::Resize) { QListView *lview = qobject_cast(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); }