Details
-
User Story
-
Resolution: Out of scope
-
P3: Somewhat important
-
None
-
6.6.0
-
None
Description
I created a subclass inheriting from the QTableView class because I want to have a context menu in the table view that appears after right-clicking.
The problem is that how I create the menu and submenu using the code below
void MyTableView::showContextMenu(const QPoint &pos) { QMenu menu; menu.setTitle(QString("Insert..."));//the title menu not showing in table view QMenu subMenu; subMenu.addAction(QString("row")); menu.addMenu(&subMenu); menu.exec(mapToGlobal(pos)); }
unfortunately, the title "QMenu menu" is not displayed, I want to achieve an effect in the style of the outgoing menu, e.g
Insert... -> | row |
column | |
Remove...-> | row |
column |
I am including the code in the attachment.
the problem is in a file called "mytableview.cpp"
Is this a bug in the Qt library? Have I done something wrong?