mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-19 05:36:13 +00:00
Show insert / delete row in context menu.
This commit is contained in:
parent
279db31a5b
commit
3d1752a569
2 changed files with 17 additions and 0 deletions
|
@ -21,7 +21,9 @@
|
||||||
#include <QTableWidget>
|
#include <QTableWidget>
|
||||||
#include <QFormLayout>
|
#include <QFormLayout>
|
||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
|
#include <QContextMenuEvent>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QMenu>
|
||||||
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
|
@ -192,6 +194,20 @@ void UXTEditor::closeEvent( QCloseEvent *e )
|
||||||
close();
|
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 )
|
void UXTEditor::onCellChanged( int row, int column )
|
||||||
{
|
{
|
||||||
QTableWidgetItem *item = d_ptr->t->item( row, column );
|
QTableWidgetItem *item = d_ptr->t->item( row, column );
|
||||||
|
|
|
@ -43,6 +43,7 @@ public Q_SLOTS:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void closeEvent( QCloseEvent *e );
|
void closeEvent( QCloseEvent *e );
|
||||||
|
void contextMenuEvent( QContextMenuEvent *e );
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void onCellChanged( int row, int column );
|
void onCellChanged( int row, int column );
|
||||||
|
|
Loading…
Reference in a new issue