Hi.
Im starting to use Qt, and after installation/building/starting_project probelm i have a problem for which i can't find solution searching the forums..
I need to add a (right mouse button click) menu to QTableWidget, but i can't get it working.
frmSettings
::frmSettings(QWidget *parent
){
ui.setupUi(this);
context
= new QMenu(this);
context->addAction("Add");
context->addAction("Delete");
connect(ui.
tableOptimizationVariables,
SIGNAL(customContextMenuRequested
(QPoint* position
)),
SLOT(frmSettings
::ProvideContexMenu(position
)));
}
void frmSettings
::ProvideContexMenu(const QPoint* position
) {
context->exec(*position);
}
frmSettings::frmSettings(QWidget *parent)
: QDialog(parent)
{
ui.setupUi(this);
context= new QMenu(this);
context->addAction("Add");
context->addAction("Delete");
connect(ui.tableOptimizationVariables, SIGNAL(customContextMenuRequested(QPoint* position)), SLOT(frmSettings::ProvideContexMenu(position)));
}
void frmSettings::ProvideContexMenu(const QPoint* position)
{
context->exec(*position);
}
To copy to clipboard, switch view to plain text mode
tableOptimizationVariables is QTableWidget
Thanx
Bookmarks