aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2017-03-10 14:07:35 -0500
committerKen Moore <ken@ixsystems.com>2017-03-10 14:07:35 -0500
commit2462587f45be033249cf8e036fd6a4dff91c744f (patch)
tree5a97657fa19f61af179f170660664eac625d5fca /src-qt5/core/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp
parentadd alarm panel-plugin (diff)
downloadlumina-2462587f45be033249cf8e036fd6a4dff91c744f.tar.gz
lumina-2462587f45be033249cf8e036fd6a4dff91c744f.tar.bz2
lumina-2462587f45be033249cf8e036fd6a4dff91c744f.zip
Fix up the context menu policies for the notepad desktop plugin.
Diffstat (limited to 'src-qt5/core/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp')
-rw-r--r--src-qt5/core/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src-qt5/core/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp b/src-qt5/core/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp
index 6d321305..479cc23e 100644
--- a/src-qt5/core/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp
+++ b/src-qt5/core/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp
@@ -60,7 +60,9 @@ NotePadPlugin::NotePadPlugin(QWidget* parent, QString ID) : LDPlugin(parent, ID)
edit->setReadOnly(false);
edit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
vlay->addWidget(edit);
- edit->setContextMenuPolicy(Qt::NoContextMenu);
+ edit->setContextMenuPolicy(Qt::CustomContextMenu); //Need to forward the context menu request to the plugin itself
+ connect(edit, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT( showContextMenuForEdit(const QPoint&)) );
+
//Now load the new file-based system for saving notes
//qDebug() << "Saving a new setting";
@@ -328,3 +330,15 @@ void NotePadPlugin::loadIcons(){
rem->setIcon( LXDG::findIcon("document-close","") );*/
config->setIcon( LXDG::findIcon("configure","") );
}
+
+void NotePadPlugin::showContextMenuForEdit(const QPoint &pos){
+ this->setContextMenu( edit->createStandardContextMenu(pos) );
+ connect(this->contextMenu(), SIGNAL(aboutToHide()), this, SLOT(resetContextMenu()) );
+ this->showPluginMenu();
+}
+
+void NotePadPlugin::resetContextMenu(){
+ QMenu *menu = this->contextMenu();
+ this->setContextMenu(0);
+ menu->deleteLater();
+}
bgstack15