Hi i added context menu to a table widget...
But it is not displaying for table header...what changes i need to do?
my context menu function is:
void MainWindow
::ProvideContextMenu(const QPoint &point
) {
QPoint globalpos
=filesTable
->mapToGlobal
(point
);
cout<<"EVENT GENERATED..."<<cell.toStdString()<<endl;
pContextMenu->addAction(pAddAction);
pContextMenu->addAction(pSplitAction);
pContextMenu->exec(globalpos);
}
void MainWindow::ProvideContextMenu(const QPoint &point)
{
QTableWidgetItem *item=filesTable->itemAt(point);
QPoint globalpos=filesTable->mapToGlobal(point);
QString cell=item->text();
cout<<"EVENT GENERATED..."<<cell.toStdString()<<endl;
QAction *pAddAction= new QAction("add",filesTable);
QAction *pSplitAction= new QAction("SPLIT",filesTable);
QMenu *pContextMenu = new QMenu( this);
pContextMenu->addAction(pAddAction);
pContextMenu->addAction(pSplitAction);
pContextMenu->exec(globalpos);
}
To copy to clipboard, switch view to plain text mode
Bookmarks