QToolButton: Fix popup menu geometry in case of QGraphicsProxyWidget.

QDesktopWidget::availableGeometry(const QWidget *) returns the scene
geometry when the widget is embedded into a QGraphicsProxyWidget.
Work around by using the overload taking a point.

Task-number: QTBUG-38559
Change-Id: Ie630bda57e14648255015587a04e29b0de96bab7
Reviewed-by: Arnaud Bienner <arnaud.bienner@gmail.com>
Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
This commit is contained in:
Friedemann Kleint 2015-03-24 09:31:28 +01:00
parent d984b07221
commit 56d091a4ea

View File

@ -733,9 +733,9 @@ void QToolButtonPrivate::popupTimerDone()
horizontal = false;
#endif
QPoint p;
QRect screen = QApplication::desktop()->availableGeometry(q);
const QRect rect = q->rect(); // Find screen via point in case of QGraphicsProxyWidget.
QRect screen = QApplication::desktop()->availableGeometry(q->mapToGlobal(rect.center()));
QSize sh = ((QToolButton*)(QMenu*)actualMenu)->receivers(SIGNAL(aboutToShow()))? QSize() : actualMenu->sizeHint();
QRect rect = q->rect();
if (horizontal) {
if (q->isRightToLeft()) {
if (q->mapToGlobal(QPoint(0, rect.bottom())).y() + sh.height() <= screen.height()) {