From 8ef8b47c5f4573b32ce145b693aca4f1c45266a0 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 17 Sep 2015 06:30:13 -0400 Subject: 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. --- .../panel-plugins/desktopswitcher/LDesktopSwitcher.cpp | 9 ++++++++- lumina-desktop/panel-plugins/desktopswitcher/LDesktopSwitcher.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'lumina-desktop/panel-plugins') 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*); -- cgit