diff options
author | Ken Moore <moorekou@gmail.com> | 2015-09-17 06:30:13 -0400 |
---|---|---|
committer | Ken Moore <moorekou@gmail.com> | 2015-09-17 06:30:13 -0400 |
commit | 8ef8b47c5f4573b32ce145b693aca4f1c45266a0 (patch) | |
tree | 3c125b0b137b135ead810d68ff9e918b264bfba9 | |
parent | Always run the "loadSnaps" signal on dir load - this should ensure that no sn... (diff) | |
download | lumina-8ef8b47c5f4573b32ce145b693aca4f1c45266a0.tar.gz lumina-8ef8b47c5f4573b32ce145b693aca4f1c45266a0.tar.bz2 lumina-8ef8b47c5f4573b32ce145b693aca4f1c45266a0.zip |
Ensure that the menu for the desktopswitcher panel plugin is refreshed before it appears. This will sync it up with the current system settings - in case the workspace was changed earlier by some other method.
-rw-r--r-- | lumina-desktop/panel-plugins/desktopswitcher/LDesktopSwitcher.cpp | 9 | ||||
-rw-r--r-- | lumina-desktop/panel-plugins/desktopswitcher/LDesktopSwitcher.h | 1 |
2 files changed, 9 insertions, 1 deletions
diff --git a/lumina-desktop/panel-plugins/desktopswitcher/LDesktopSwitcher.cpp b/lumina-desktop/panel-plugins/desktopswitcher/LDesktopSwitcher.cpp index 95c52d9a..433441dd 100644 --- a/lumina-desktop/panel-plugins/desktopswitcher/LDesktopSwitcher.cpp +++ b/lumina-desktop/panel-plugins/desktopswitcher/LDesktopSwitcher.cpp @@ -12,11 +12,12 @@ LDesktopSwitcher::LDesktopSwitcher(QWidget *parent, QString id, bool horizontal) this->setStyleSheet( "QToolButton::menu-indicator{ image: none; } QToolButton{padding: 0px;}"); //Setup the widget label = new QToolButton(this); - label->setPopupMode(QToolButton::InstantPopup); + label->setPopupMode(QToolButton::DelayedPopup); label->setAutoRaise(true); label->setToolButtonStyle(Qt::ToolButtonIconOnly); label->setIcon( LXDG::findIcon("preferences-desktop-display-color", "") ); label->setToolTip(QString("Workspace 1")); + connect(label, SIGNAL(clicked()), this, SLOT(openMenu())); menu = new QMenu(this); connect(menu, SIGNAL(triggered(QAction*)), this, SLOT(menuActionTriggered(QAction*))); connect(menu, SIGNAL(aboutToHide()), this, SIGNAL(MenuClosed())); @@ -109,6 +110,12 @@ int LDesktopSwitcher::getCurrentDesktop() { return number; } */ +void LDesktopSwitcher::openMenu(){ + //Make sure the menu is refreshed right before it opens + createMenu(); + label->showMenu(); +} + QAction* LDesktopSwitcher::newAction(int what, QString name) { QAction *act = new QAction(LXDG::findIcon("preferences-desktop-display-color", ":/images/preferences-desktop-display-color.png"), name, this); act->setWhatsThis(QString::number(what)); diff --git a/lumina-desktop/panel-plugins/desktopswitcher/LDesktopSwitcher.h b/lumina-desktop/panel-plugins/desktopswitcher/LDesktopSwitcher.h index 5dd5a785..851d9e35 100644 --- a/lumina-desktop/panel-plugins/desktopswitcher/LDesktopSwitcher.h +++ b/lumina-desktop/panel-plugins/desktopswitcher/LDesktopSwitcher.h @@ -46,6 +46,7 @@ private: QAction* newAction(int, QString); private slots: + void openMenu(); void createMenu(); void menuActionTriggered(QAction*); |