From 87b7f90ae11dd02548299cfeadb50e92da47651d Mon Sep 17 00:00:00 2001 From: Teo Mrnjavac <teo@kde.org> Date: Wed, 15 Aug 2012 18:45:28 +0200 Subject: [PATCH] Move menu with the toolbutton if the button's position changes. --- src/widgets/AccountsToolButton.cpp | 13 +++++++++++++ src/widgets/AccountsToolButton.h | 1 + 2 files changed, 14 insertions(+) diff --git a/src/widgets/AccountsToolButton.cpp b/src/widgets/AccountsToolButton.cpp index 326276184..b042f39c4 100644 --- a/src/widgets/AccountsToolButton.cpp +++ b/src/widgets/AccountsToolButton.cpp @@ -149,6 +149,19 @@ AccountsToolButton::paintEvent( QPaintEvent* event ) painter.end(); } +void +AccountsToolButton::moveEvent( QMoveEvent* event ) +{ + if ( m_popup ) + { + if ( isDown() ) + { + QPoint myPos = mapToGlobal( rect().bottomRight() ); + m_popup->anchorAt( myPos ); + } + } +} + void AccountsToolButton::popupHidden() //SLOT { diff --git a/src/widgets/AccountsToolButton.h b/src/widgets/AccountsToolButton.h index eb245946c..317502e8e 100644 --- a/src/widgets/AccountsToolButton.h +++ b/src/widgets/AccountsToolButton.h @@ -42,6 +42,7 @@ signals: protected: void mousePressEvent( QMouseEvent* event ); void paintEvent( QPaintEvent* event ); + void moveEvent( QMoveEvent* event ); private slots: void popupHidden();