diff options
Diffstat (limited to 'lumina-desktop/panel-plugins/userbutton/UserItemWidget.h')
-rw-r--r-- | lumina-desktop/panel-plugins/userbutton/UserItemWidget.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/lumina-desktop/panel-plugins/userbutton/UserItemWidget.h b/lumina-desktop/panel-plugins/userbutton/UserItemWidget.h index b3c5aea7..6d73401d 100644 --- a/lumina-desktop/panel-plugins/userbutton/UserItemWidget.h +++ b/lumina-desktop/panel-plugins/userbutton/UserItemWidget.h @@ -19,7 +19,8 @@ #include <QFile> #include <QMouseEvent> #include <QAction> - +#include <QMenu> +#include <QTimer> #include <LuminaXDG.h> @@ -33,8 +34,9 @@ public: private: QToolButton *button, *actButton; QLabel *icon, *name; - bool isDirectory, isShortcut; + bool isDirectory, isShortcut, menuopen; QString linkPath; + QTimer *menureset; void createWidget(); void setupButton(bool disable = false); @@ -44,10 +46,19 @@ private slots: void buttonClicked(); void ItemClicked(); void actionClicked(QAction*); + //Functions to fix the submenu open/close issues + void actionMenuOpen(){ + menuopen = true; + if(menureset->isActive()){ menureset->stop(); } + } + void resetmenuflag(){ menuopen = false; } //tied to the "menureset" timer + void actionMenuClosed(){ menureset->start(); } + protected: void mouseReleaseEvent(QMouseEvent *event){ - if(event->button() != Qt::NoButton){ ItemClicked(); } + if(menuopen){ resetmenuflag(); } //skip this event if a submenu was open + else if(event->button() != Qt::NoButton){ ItemClicked(); } } signals: |