From 62a6b408a26534426964445b737148bd14e1c1d1 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Sat, 19 Jul 2014 17:23:53 +0200 Subject: [PATCH] Show insert / delete row in context menu. --HG-- branch : gsoc2014-dfighter --- .../plugins/translation_manager/uxt_editor.cpp | 16 ++++++++++++++++ .../src/plugins/translation_manager/uxt_editor.h | 1 + 2 files changed, 17 insertions(+) diff --git a/code/studio/src/plugins/translation_manager/uxt_editor.cpp b/code/studio/src/plugins/translation_manager/uxt_editor.cpp index cb4a0a0f3..88d866fe2 100644 --- a/code/studio/src/plugins/translation_manager/uxt_editor.cpp +++ b/code/studio/src/plugins/translation_manager/uxt_editor.cpp @@ -21,7 +21,9 @@ #include #include #include +#include #include +#include #include #include @@ -192,6 +194,20 @@ void UXTEditor::closeEvent( QCloseEvent *e ) close(); } +void UXTEditor::contextMenuEvent( QContextMenuEvent *e ) +{ + QMenu *menu = new QMenu( this ); + QAction *insertAction = new QAction( "Insert row", menu ); + QAction *deleteAction = new QAction( "Delete row", menu ); + + connect( insertAction, SIGNAL( triggered( bool ) ), this, SLOT( insertRow() ) ); + connect( deleteAction, SIGNAL( triggered( bool ) ), this, SLOT( deleteRow() ) ); + + menu->addAction( insertAction ); + menu->addAction( deleteAction ); + menu->exec( e->globalPos() ); +} + void UXTEditor::onCellChanged( int row, int column ) { QTableWidgetItem *item = d_ptr->t->item( row, column ); diff --git a/code/studio/src/plugins/translation_manager/uxt_editor.h b/code/studio/src/plugins/translation_manager/uxt_editor.h index d37be8c72..7499df44c 100644 --- a/code/studio/src/plugins/translation_manager/uxt_editor.h +++ b/code/studio/src/plugins/translation_manager/uxt_editor.h @@ -43,6 +43,7 @@ public Q_SLOTS: protected: void closeEvent( QCloseEvent *e ); + void contextMenuEvent( QContextMenuEvent *e ); private Q_SLOTS: void onCellChanged( int row, int column );