Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to use QWigdetAction
Qt 6.12 LTS is out! See what's new in the release blog

How to use QWigdetAction

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 743 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Depositc29
    wrote on last edited by
    #1

    I create a QWidgetAction and use addMenu to bind the submenu with it,but it can not show the submenu when I move my mouse on the QWidgetAction。I debug the source code found that it seems to fail to call the setCurrentAction function on the mouseMoveEvent,but if I use QAction, it work well。 So How should I solve this problem?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Which version of Qt ?
      On which OS ?
      If Linux, which desktop environment ?
      Please provide a minimal compilable example that shows the behaviour.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • D Offline
        D Offline
        Depositc29
        wrote on last edited by
        #3

        @SGaist
        the platform is win10. Here is simple code.

        QMenu*  topMenu = new QMenu;
        QWidgetAction* pAct = new QWidgetAct;
        QWidget* widget = new QWidget;
        pAct->setDefaultWidget(widget);
        QMenu* subMenu = new QMenu;
        pAct->setMenu(subMenu);
        topMenu->addMenu(subMenu);
        

        when I move my mouse on the pAct, it can not show the submenu.

        SGaistS 1 Reply Last reply
        0
        • D Depositc29

          @SGaist
          the platform is win10. Here is simple code.

          QMenu*  topMenu = new QMenu;
          QWidgetAction* pAct = new QWidgetAct;
          QWidget* widget = new QWidget;
          pAct->setDefaultWidget(widget);
          QMenu* subMenu = new QMenu;
          pAct->setMenu(subMenu);
          topMenu->addMenu(subMenu);
          

          when I move my mouse on the pAct, it can not show the submenu.

          SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Depositc29 please make it complete that way it ensures that we are all working with the same code.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt
          • Unsolved