Qmenu Stable close on QTableWidget
I have on mainwindow a QWorkspace 2 QDockWidget and at on QDockWidget i build a QTableWidget + Qt::CustomContextMenu if the action have only one emit to mainwindow this qmenu stay open 2 or moore left click .... on same table row...
How i can close this qmenu just to beginn by next right click?
Code:
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);
}
}
Re: Qmenu Stable close on QTableWidget
Please provide a minimal compilable example which reproduces the problem.