summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets/qpushbutton.cpp
diff options
context:
space:
mode:
authorAlexis Menard <alexis.menard@nokia.com>2009-10-20 08:39:56 (GMT)
committerAlexis Menard <alexis.menard@nokia.com>2009-10-20 08:45:47 (GMT)
commita210a1efb3a255235ab22e618c61d0aaccba3d9f (patch)
treec6842a515fd54ecdcd961a6c4d49180fd0966267 /src/gui/widgets/qpushbutton.cpp
parent93550050f4fe4f411bfbd80d7b30ff5bc8a20df7 (diff)
downloadQt-a210a1efb3a255235ab22e618c61d0aaccba3d9f.zip
Qt-a210a1efb3a255235ab22e618c61d0aaccba3d9f.tar.gz
Qt-a210a1efb3a255235ab22e618c61d0aaccba3d9f.tar.bz2
QToolButton popup menu is shown at wrong position when embedded in a
QGraphicsView. The main problem here is that QWidget assume that they are in the screen somewhere, which means inside the available geometry provided by QDesktopWidget. But in QGraphicsView the button can be in a position that is way bigger than the screen resolution. Lot of widgets make this assumption when positionning subpopups or submenus. Instead of applying the same code on tons of QWidgets, it's better to have an helper function in desktop widget which catch this case. It's not pretty (since it has nothing to do with QDesktopWidget) but we don't have better solution. Task-number:QTBUG-3822 Reviewed-by:brad
Diffstat (limited to 'src/gui/widgets/qpushbutton.cpp')
-rw-r--r--src/gui/widgets/qpushbutton.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/widgets/qpushbutton.cpp b/src/gui/widgets/qpushbutton.cpp
index 1352e1b..eb34336 100644
--- a/src/gui/widgets/qpushbutton.cpp
+++ b/src/gui/widgets/qpushbutton.cpp
@@ -590,7 +590,7 @@ void QPushButtonPrivate::_q_popupPressed()
int x = globalPos.x();
int y = globalPos.y();
if (horizontal) {
- if (globalPos.y() + rect.height() + menuSize.height() <= QApplication::desktop()->height()) {
+ if (globalPos.y() + rect.height() + menuSize.height() <= QApplication::desktop()->availableGeometry(q).height()) {
y += rect.height();
} else {
y -= menuSize.height();
@@ -598,7 +598,7 @@ void QPushButtonPrivate::_q_popupPressed()
if (q->layoutDirection() == Qt::RightToLeft)
x += rect.width() - menuSize.width();
} else {
- if (globalPos.x() + rect.width() + menu->sizeHint().width() <= QApplication::desktop()->width())
+ if (globalPos.x() + rect.width() + menu->sizeHint().width() <= QApplication::desktop()->availableGeometry(q).width())
x += rect.width();
else
x -= menuSize.width();