diff options
author | Arno <am@disconnect.de> | 2013-06-02 11:24:06 +0200 |
---|---|---|
committer | Arno <am@disconnect.de> | 2013-06-02 11:24:06 +0200 |
commit | 721fd40222440c6e8a81f4379f894d8908772a8a (patch) | |
tree | a7b54efd2ec9168efb4c7ae8e49851430b84a1b6 /smtreeview.cpp | |
parent | 459f58c57bfa1021783134b11853e8e4140055f3 (diff) | |
download | SheMov-721fd40222440c6e8a81f4379f894d8908772a8a.tar.gz SheMov-721fd40222440c6e8a81f4379f894d8908772a8a.tar.bz2 SheMov-721fd40222440c6e8a81f4379f894d8908772a8a.zip |
Implement Rename
Rename items: spits out an error message if the new item already exists.
Diffstat (limited to 'smtreeview.cpp')
-rw-r--r-- | smtreeview.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/smtreeview.cpp b/smtreeview.cpp index 405f6a0..d4faab8 100644 --- a/smtreeview.cpp +++ b/smtreeview.cpp @@ -5,10 +5,12 @@ 2 of the License, or (at your option) any later version. */ -#include <QSettings> -#include <QHeaderView> #include <QAction> #include <QActionGroup> +#include <QHeaderView> +#include <QMenu> +#include <QContextMenuEvent> +#include <QSettings> #include "smtreeview.h" #include "smglobals.h" @@ -58,3 +60,14 @@ void SmTreeView::toggleHeader(QObject *action){ QHeaderView *hv = header(); hv->setSectionHidden(logicalIndex, !a->isChecked()); } + +void SmTreeView::contextMenuEvent(QContextMenuEvent *e){ + if(actions().isEmpty()){ + return; + } + QMenu contextMenu(this); + foreach(QAction *a, actions()){ + contextMenu.addAction(a); + } + contextMenu.exec(e->globalPos()); +} |