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. Setting up a QMenu
QtWS25 Last Chance

Setting up a QMenu

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 1.3k Views
  • 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.
  • S Offline
    S Offline
    Suroh6
    wrote on last edited by
    #1

    I've been looking around at a variety of QMenu creation tutorials one of which comes from the Qt team, http://doc.qt.io/qt-5/qtwidgets-mainwindows-menus-example.html it seems like there is a ton of overhead involved in doing this so my question is, is there an easier way of doing this?

    By easier I don't mean "Less complex" I just mean less code I fully understand what's occurring in the above link I just can't accept that it's the best way of setting up a menu as it seems very inefficient.

    ? 1 Reply Last reply
    0
    • S Suroh6

      I've been looking around at a variety of QMenu creation tutorials one of which comes from the Qt team, http://doc.qt.io/qt-5/qtwidgets-mainwindows-menus-example.html it seems like there is a ton of overhead involved in doing this so my question is, is there an easier way of doing this?

      By easier I don't mean "Less complex" I just mean less code I fully understand what's occurring in the above link I just can't accept that it's the best way of setting up a menu as it seems very inefficient.

      ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      @Suroh6 Hi! You can do this without any code in Qt Designer.

      1 Reply Last reply
      2
      • S Offline
        S Offline
        Suroh6
        wrote on last edited by
        #3

        Yeah, I understand that I just wasn't sure if there was a better way of implementing one without the use of the designer!

        1 Reply Last reply
        0
        • Ni.SumiN Offline
          Ni.SumiN Offline
          Ni.Sumi
          wrote on last edited by
          #4

          Hi @Suroh6 ,

          As @Wieland suggested , using UI is best option . you can have very very less code. you can add signals and other Qt things directly with out any code. you can also access all the objects of the UI again in the code. Like this.. UI *spinBox1->setRange(1,10) ;

          If you want to code only C++, then the option to reduce couple of lines code by coding with skill. But it reduces may be couple of lines that's it.

          Using UI, is always best option for the people who dont want to see more code and its highly user friendly.

          S 1 Reply Last reply
          1
          • Ni.SumiN Ni.Sumi

            Hi @Suroh6 ,

            As @Wieland suggested , using UI is best option . you can have very very less code. you can add signals and other Qt things directly with out any code. you can also access all the objects of the UI again in the code. Like this.. UI *spinBox1->setRange(1,10) ;

            If you want to code only C++, then the option to reduce couple of lines code by coding with skill. But it reduces may be couple of lines that's it.

            Using UI, is always best option for the people who dont want to see more code and its highly user friendly.

            S Offline
            S Offline
            Suroh6
            wrote on last edited by
            #5

            @Ni.Sumi Yeah that's all I've managed to do myself is a handful of lines lol I guess I'll just stick with the Designer choice, thank you both for these responses!

            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