Dear,
I have a qtablewidget. I want to add popupmenu when user right mouse click in item on qtablewidget.
this is my script :
void QTTapeUtil
::on_tblWidgetInput_mousePressEvent( QMouseEvent * event
) {
int brs1 = tblWidgetInput->currentRow();
if (texktnya)
{
if ( event->button() == Qt::RightButton )
{
menu.addAction(coba1);
menu.addAction(coba2);
menu.exec();
}
}
}
void QTTapeUtil::on_tblWidgetInput_mousePressEvent( QMouseEvent * event )
{
int brs1 = tblWidgetInput->currentRow();
QTableWidgetItem *texktnya = tblWidgetInput->item(brs1,0);
if (texktnya)
{
if ( event->button() == Qt::RightButton )
{
QMenu menu(this);
menu.addAction(coba1);
menu.addAction(coba2);
menu.exec();
}
}
}
To copy to clipboard, switch view to plain text mode
popupmenu show if item in tablewidget not empty. I try to use this script but I can not see popupmenu in my tablewidget. what wrong in my code? can you give me and example about popupmenu with tabelwidget (maybe copy paste operation)
thank for your attention
regardly
toto
Bookmarks