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. Purely in C++ or Designer mode
Forum Updated to NodeBB v4.3 + New Features

Purely in C++ or Designer mode

Scheduled Pinned Locked Moved Unsolved General and Desktop
21 Posts 12 Posters 5.5k Views 10 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.
  • VRoninV Offline
    VRoninV Offline
    VRonin
    wrote on last edited by
    #10

    Has to be pointed out that using code only shields you from any issue in uic: https://bugreports.qt.io/browse/QTBUG/component/19443/?selectedTab=com.atlassian.jira.jira-projects-plugin:component-issues-panel

    "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
    ~Napoleon Bonaparte

    On a crusade to banish setIndexWidget() from the holy land of Qt

    1 Reply Last reply
    1
    • the_T Offline
      the_T Offline
      the_
      wrote on last edited by
      #11

      I am with @Wieland and @koahnig.

      Basic layout and static content with the help of Designer but as I have a lot of dynamic content the rest of the UI is handwritten.

      -- No support in PM --

      1 Reply Last reply
      0
      • tomyT Offline
        tomyT Offline
        tomy
        wrote on last edited by
        #12

        @Wieland said in Purely in C++ or Designer mode:

        Hi! I think a mixture of both is common. Most forms have pretty static content, so for these using the Designer is the easiest way. On the other hand, if you have forms where the content / layout, number of buttons etc, depend on run-time decisions, you'll use hand-written C++ code.

        Hi!
        First, what do you mean by pretty static content please?
        And Do you generally mean that it depends on the app we want to create? That is, we first consider the means we use to create an app and then we choose hand-writing C++ or Designer?

        1 Reply Last reply
        0
        • mrjjM mrjj

          Hi

          I use mostly Designer. :)

          Even when i need something dynamic,
          I design the layout/look in Designer and simply
          take the c++ code from setupUI().

          For me its much easier to visually design with layouts and WYSIWYG
          than coding it. For others, it is reversed.

          Also the promote feature of Creator makes designing with own Widgets very easy and
          thereby make Designer useful most of the time.

          tomyT Offline
          tomyT Offline
          tomy
          wrote on last edited by tomy
          #13

          @mrjj said in Purely in C++ or Designer mode:

          Hi

          I use mostly Designer. :)

          Even when i need something dynamic,
          I design the layout/look in Designer and simply
          take the c++ code from setupUI().

          For me its much easier to visually design with layouts and WYSIWYG
          than coding it. For others, it is reversed.

          Also the promote feature of Creator makes designing with own Widgets very easy and
          thereby make Designer useful most of the time.

          Hi mrjj. :) Thanks.

          Please consider the experience I got. I'm studying the formal book on Qt4.x. I'm in chapter 2. The scenario for making programs have been this way:

          Using code:
          1- Making a .h file
          2- Making a C++ file.
          3- Making a main.cpp and then running qmake. Now the app can be run.

          Using Designer:
          1- Creating a Form
          2- Making a main.cpp (running qmake)
          3- Making a .h file
          4- Making a .cpp file. Now the app can be run.

          The difference, to me, is that using Designer needs one more step and also the other steps are more complex than hand-code.
          Do you not agree?

          mrjjM 1 Reply Last reply
          0
          • tomyT Offline
            tomyT Offline
            tomy
            wrote on last edited by
            #14

            By reading the answers I think I concluded that when we have static contents we had better use Designer. And when we have dynamic contents we should use hand-coding. Is it right?

            raven-worxR kshegunovK 2 Replies Last reply
            0
            • tomyT tomy

              By reading the answers I think I concluded that when we have static contents we had better use Designer. And when we have dynamic contents we should use hand-coding. Is it right?

              raven-worxR Offline
              raven-worxR Offline
              raven-worx
              Moderators
              wrote on last edited by
              #15

              @tomy said in Purely in C++ or Designer mode:

              By reading the answers I think I concluded that when we have static contents we had better use Designer. And when we have dynamic contents we should use hand-coding. Is it right?

              There is no direct wrong or right. You got opinions/recommendations as answers.
              Use whatever you feel comfortable with. If you need quick and functional results there is nothing wrong in using the designer.
              IMO you may get a better understanding of the Qt mechanisms when coding directly.
              But build your own opinion ;)

              --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
              If you have a question please use the forum so others can benefit from the solution in the future

              1 Reply Last reply
              2
              • tomyT tomy

                @mrjj said in Purely in C++ or Designer mode:

                Hi

                I use mostly Designer. :)

                Even when i need something dynamic,
                I design the layout/look in Designer and simply
                take the c++ code from setupUI().

                For me its much easier to visually design with layouts and WYSIWYG
                than coding it. For others, it is reversed.

                Also the promote feature of Creator makes designing with own Widgets very easy and
                thereby make Designer useful most of the time.

                Hi mrjj. :) Thanks.

                Please consider the experience I got. I'm studying the formal book on Qt4.x. I'm in chapter 2. The scenario for making programs have been this way:

                Using code:
                1- Making a .h file
                2- Making a C++ file.
                3- Making a main.cpp and then running qmake. Now the app can be run.

                Using Designer:
                1- Creating a Form
                2- Making a main.cpp (running qmake)
                3- Making a .h file
                4- Making a .cpp file. Now the app can be run.

                The difference, to me, is that using Designer needs one more step and also the other steps are more complex than hand-code.
                Do you not agree?

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by mrjj
                #16

                @tomy
                Hi
                You can make a full running app very easy.
                No need to add .h or .cpp by hand.
                You get mainwindow.cpp /h and main.cpp
                Use "New File or Project" from File
                alt text

                You can also insert new form with class so there is both UI , cpp and h.
                alt text

                So adding it by hand is by far more time consuming for me. :)

                But yes, if you app is so small that creating the interface in main.cpp seems the
                best way, then Creator might be overkill.

                If you plan on multiple forms ( windows ) and a more complex setup then
                Creator might become more useful.

                Also, even if you use UI files, its not something really different from code since it just creates
                the c++ code for you.
                So if you later, thinks. hey UI is lame. Then its not so hard to use hand written code.

                There is one thing to consider if you work in teams.
                Those on the team not using Qt for interface will have to know Qt in details to add say a
                button in pure code. I actually tested this in small scale and it took lookup in help and
                even more help adding the connect. Whereas Dragging it from right side to some place on a
                form , right click and select goto slot was far less involving
                and allows them to add a button etc to test some backbone function.

                This is often called Anecdotal evidence and its not meant as truth about
                how it works for other teams but for us its a huge bonus that
                it is WYSIWYG and not heaps of code.

                as @raven-worx says, its good learning doing by hand! And since you cannot do everything in Creator
                there will be code too along the way.

                So you should definitely try both and see what feels best to you.
                Both are valid approaches and there is nothing you can do in Creator that code can't so
                nothing to lose :)

                A 1 Reply Last reply
                3
                • mrjjM mrjj

                  @tomy
                  Hi
                  You can make a full running app very easy.
                  No need to add .h or .cpp by hand.
                  You get mainwindow.cpp /h and main.cpp
                  Use "New File or Project" from File
                  alt text

                  You can also insert new form with class so there is both UI , cpp and h.
                  alt text

                  So adding it by hand is by far more time consuming for me. :)

                  But yes, if you app is so small that creating the interface in main.cpp seems the
                  best way, then Creator might be overkill.

                  If you plan on multiple forms ( windows ) and a more complex setup then
                  Creator might become more useful.

                  Also, even if you use UI files, its not something really different from code since it just creates
                  the c++ code for you.
                  So if you later, thinks. hey UI is lame. Then its not so hard to use hand written code.

                  There is one thing to consider if you work in teams.
                  Those on the team not using Qt for interface will have to know Qt in details to add say a
                  button in pure code. I actually tested this in small scale and it took lookup in help and
                  even more help adding the connect. Whereas Dragging it from right side to some place on a
                  form , right click and select goto slot was far less involving
                  and allows them to add a button etc to test some backbone function.

                  This is often called Anecdotal evidence and its not meant as truth about
                  how it works for other teams but for us its a huge bonus that
                  it is WYSIWYG and not heaps of code.

                  as @raven-worx says, its good learning doing by hand! And since you cannot do everything in Creator
                  there will be code too along the way.

                  So you should definitely try both and see what feels best to you.
                  Both are valid approaches and there is nothing you can do in Creator that code can't so
                  nothing to lose :)

                  A Offline
                  A Offline
                  ambershark
                  wrote on last edited by
                  #17

                  @mrjj said in Purely in C++ or Designer mode:

                  There is one thing to consider if you work in teams.
                  Those on the team not using Qt for interface will have to know Qt in details to add say a
                  button in pure code. I actually tested this in small scale and it took lookup in help and

                  This is usually when I end up with lots of .ui in my projects is when I work on teams that don't want to hand code everything.

                  I agree sometimes it is faster to use the designer, but usually I can put together a UI in code as fast as someone else can in the designer. Then I don't have to worry about coding the parts the designer can't handle since they are already written.

                  I also type at 115wpm though so that helps when coding easy things like UIs. :) I find it slower to take my hands off the keyboard and use my mouse for things in the designer, especially signals/slots.

                  But as I get older my typing is slowing down.. I was 120wpm 10 years ago, so maybe in a few more years I'll be in the designer more, lol. My wife even teased me the other day when I scored a 108 on a typing test with a new keyboard I was testing... she's like oh you're getting slow. :P

                  My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

                  1 Reply Last reply
                  2
                  • BuckwheatB Offline
                    BuckwheatB Offline
                    Buckwheat
                    wrote on last edited by
                    #18

                    @tomy

                    I use both. I started using only C++ because I found using the Designer a little daunting and what I needed was simple. As time went on I learned the ins/outs of designer and now do even the smaller UI components with it. This gives me maintainability over just C++. It is purely a design decision!

                    As a wish-list item... I would love to see Qt have an XRC-like (wxWidgets) component to create UI at runtime with the .UI files instead of generating code for them. This would make things like branding (when a style sheet just will not do) and testing new components much simpler. *** Food for though ***

                    Dave Fileccia

                    Chris KawaC 1 Reply Last reply
                    2
                    • BuckwheatB Buckwheat

                      @tomy

                      I use both. I started using only C++ because I found using the Designer a little daunting and what I needed was simple. As time went on I learned the ins/outs of designer and now do even the smaller UI components with it. This gives me maintainability over just C++. It is purely a design decision!

                      As a wish-list item... I would love to see Qt have an XRC-like (wxWidgets) component to create UI at runtime with the .UI files instead of generating code for them. This would make things like branding (when a style sheet just will not do) and testing new components much simpler. *** Food for though ***

                      Chris KawaC Offline
                      Chris KawaC Offline
                      Chris Kawa
                      Lifetime Qt Champion
                      wrote on last edited by
                      #19

                      @Buckwheat I'm not a wxWidgets user but do you mean QUiLoader?

                      1 Reply Last reply
                      3
                      • BuckwheatB Offline
                        BuckwheatB Offline
                        Buckwheat
                        wrote on last edited by
                        #20

                        @Chris-Kawa

                        Why yes, yes I do mean that! Thank you. I love learning something knew every day!

                        Dave Fileccia

                        1 Reply Last reply
                        1
                        • tomyT tomy

                          By reading the answers I think I concluded that when we have static contents we had better use Designer. And when we have dynamic contents we should use hand-coding. Is it right?

                          kshegunovK Offline
                          kshegunovK Offline
                          kshegunov
                          Moderators
                          wrote on last edited by
                          #21

                          Hey, I'll chime in here too. I personally almost exclusively use the designer and almost exclusively don't derive from QWidget. I only derive from the widget when I want to have a custom widget, otherwise I initialize everything from a QObject subclass. Also I prefer to use the designer even with "dynamic" content, where I prepare a "prototype" of the repeatable pattern and initialize a generic QWidget object with the form.

                          Read and abide by the Qt Code of Conduct

                          1 Reply Last reply
                          3

                          • Login

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