Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Designer and custom subclass of Qmenu
Forum Updated to NodeBB v4.3 + New Features

Designer and custom subclass of Qmenu

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 3.2k 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.
  • T Offline
    T Offline
    thiel
    wrote on last edited by
    #1

    Hi,

    How can we add a custom instance of QMenu (implemented in a Designer plugin) within the QMenuBar of a QMainWindow?

    Let me elaborate on this.

    I have implemented a custom widget as a subclass of QMenu. The behavior is the same as any QMenu inside a QMenuBar but the menu is pre-filled with several predefined actions. Consider this as a "standard menu" which is included in many applications. Since I do not want to repeat the design and code everywhere, it has become a custom widget.

    This custom widget is included in a Designer plugin, along with other custom widgets.

    Using Designer, I create a "Main Window" application. The menu bar is here but I cannot drag and drop my QMenu subclass inside the menu bar. In fact, you cannot drop anything in the menu bar. The only thing you can do is use the "Type Here" feature and create all the menus by hand, which is exactly I would like to avoid for my "standard menu".

    The weird thing is that the menus you build manually become instances of QMenu. So, dropping an instance of a subclass of QMenu in the menu bar should make sense.

    The workaround is to create manually the placeholder for my standard menu using "Type Here" and then I use "promote" on the corresponding QMenu to may subclass. This works. The correct standard menu is created at run time. But this is ugly. My standard menu appears as empty in Designer, it does not work in preview mode, etc. This is why I implemented a Designer plugin.

    Is there any solution to use a subclass of QMenu from a Designer plugin?

    Thanks

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tanmay2227
      wrote on last edited by
      #2

      hey did you solve your problem.
      please help if you or anybody did . because i am working on a similar project and facing similar difficulties

      Tanmay Priyadarshi

      1 Reply Last reply
      0
      • T Offline
        T Offline
        thiel
        wrote on last edited by
        #3

        No, I did not solve it, I live with it...

        If fact, I only posted 4 technical questions in Qt Forums, all 4 precise technical questions which seem legitimate like this one, and got zero answer to any of them. Not even a "not possible, sorry" answer. So, you should not expect too much.

        1 Reply Last reply
        0
        • T Offline
          T Offline
          tanmay2227
          wrote on last edited by
          #4

          ok thanks i guess i would have to look for other solutions

          Tanmay Priyadarshi

          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 Extensions
          • Unsolved