aurora
21st February 2012, 06:31
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)
{
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);
}
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)
{
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);
}