Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-120281

the title menu not showing in table view

    XMLWordPrintable

Details

    • User Story
    • Resolution: Out of scope
    • P3: Somewhat important
    • None
    • 6.6.0
    • Widgets: Itemviews
    • None
    • Windows

    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?

      Attachments

        1. window-test.7z
          4 kB
        2. window-test-2.7z
          291 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            zbigniewk Zbigniew Kubiński
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes