editable = true;
TableMenu->setMouseTracking(false);
TableMenu->setContextMenuPolicy( Qt::CustomContextMenu );
connect(TableMenu,
SIGNAL( customContextMenuRequested
( const QPoint & ) ),
this,
SLOT( TableContexMenu
() ) );
connect(edit_modus_table, SIGNAL(toggled(bool)),this, SLOT(TableEditContex(bool)));
} /* end table */
void W_Menu::TableContexMenu()
{
mnuContext
= new QMenu();
...... other action .....
mnuContext->addAction
(QIcon( ":/i/img/user.png" ),tr
( "Edit Item " ),
this,
SLOT( EditPerson
() ) );
...............................
mnuContext->addAction(tr( "Close this" ), mnuContext, SLOT( close() ) );
mnuContext
->exec
( QCursor::pos() );
}
/* ############################################# MENU TABLE CONTEXT ################################### */
void W_Menu::EditPerson()
{
mnuContext->clear();
mnuContext->close();
int IdCell = GetItemId(TableMenu->currentColumn(),TableMenu->currentRow());
int personaedits = items[IdCell]->GetDBNummers();
if (personaedits > 0) {
emit OpenEditIdShow(personaedits);
}
}
build QTableWidget ......
editable = true;
TableMenu->setMouseTracking(false);
TableMenu->setContextMenuPolicy( Qt::CustomContextMenu );
connect(TableMenu, SIGNAL(itemChanged(QTableWidgetItem *)), this, SLOT(UpDateItem(QTableWidgetItem *)));
connect(TableMenu, SIGNAL( customContextMenuRequested( const QPoint & ) ), this, SLOT( TableContexMenu() ) );
connect(edit_modus_table, SIGNAL(toggled(bool)),this, SLOT(TableEditContex(bool)));
} /* end table */
void W_Menu::TableContexMenu()
{
mnuContext = new QMenu();
...... other action .....
mnuContext->addAction(QIcon( ":/i/img/user.png" ),tr( "Edit Item " ), this, SLOT( EditPerson() ) );
...............................
mnuContext->addAction(tr( "Close this" ), mnuContext, SLOT( close() ) );
mnuContext->exec( QCursor::pos() );
}
/* ############################################# MENU TABLE CONTEXT ################################### */
void W_Menu::EditPerson()
{
mnuContext->clear();
mnuContext->close();
int IdCell = GetItemId(TableMenu->currentColumn(),TableMenu->currentRow());
int personaedits = items[IdCell]->GetDBNummers();
if (personaedits > 0) {
emit OpenEditIdShow(personaedits);
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks