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. How should I learn about context menu's? Any good resources? / Object specific context menu
Forum Updated to NodeBB v4.3 + New Features

How should I learn about context menu's? Any good resources? / Object specific context menu

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 391 Views 3 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.
  • B Offline
    B Offline
    bartvrossum
    wrote on last edited by bartvrossum
    #1

    Hi,

    I want to learn about context menu. Is there any good resource or course that covers it?
    Can you have context menu's for specific items in the applications? Let's say, for a QLabel, or for a QTextTabel inside a QTextEdit?

    Appreciate the help. :)

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

      Hi,

      Take a look at the Menus Example.

      It is explained for the QMainWindow class but it's also valid for others as explained at the bottom of the page.

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

      B 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi,

        Take a look at the Menus Example.

        It is explained for the QMainWindow class but it's also valid for others as explained at the bottom of the page.

        B Offline
        B Offline
        bartvrossum
        wrote on last edited by
        #3

        @SGaist

        I kinda get stuck on the "whats the difference between contextMenuEvent() and setContextMenuPolicy()" stuff and on the fact that when i put down this code in my own project:

        protected:
        #ifndef QT_NO_CONTEXTMENU
            void contextMenuEvent(QContextMenuEvent *event) override;
        #endif // QT_NO_CONTEXTMENU
        

        I get this error:

        0_1563749510348_Screenshot 2019-07-22 at 00.51.34.png

        What's up with this?

        Pl45m4P 1 Reply Last reply
        0
        • B bartvrossum

          @SGaist

          I kinda get stuck on the "whats the difference between contextMenuEvent() and setContextMenuPolicy()" stuff and on the fact that when i put down this code in my own project:

          protected:
          #ifndef QT_NO_CONTEXTMENU
              void contextMenuEvent(QContextMenuEvent *event) override;
          #endif // QT_NO_CONTEXTMENU
          

          I get this error:

          0_1563749510348_Screenshot 2019-07-22 at 00.51.34.png

          What's up with this?

          Pl45m4P Offline
          Pl45m4P Offline
          Pl45m4
          wrote on last edited by Pl45m4
          #4

          @bartvrossum

          Exactly what is written there...

          If you redefine a function, you have to mark it as "override".

          Put the override behind your function header and the warning is gone (in your case: destructor)


          If debugging is the process of removing software bugs, then programming must be the process of putting them in.

          ~E. W. Dijkstra

          1 Reply Last reply
          1

          • Login

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