How to add context menu to the table widget header?

  • 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);

  • The headers are a separate widgets. See [[doc:QHeaderView]].

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.