Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved Forms vs window + QVBoxLayout in Qt creator desktop applications

    General and Desktop
    forms widgets layout
    3
    3
    691
    Loading More Posts
    • 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.
    • K
      kweber last edited by

      Hello, I'm just starting to use Qt Creator and find two ways to create desktop apps:

      • When I chose to create a new project, desktop app, Qt Creator creates an empty template for a form and it allows me to drag and drop widgets, move and resize them, etc.

      • When I open some built-in examples, I find some of the examples does not have a form itself but instantiate a QWidget and QVBoxLayout and then add all widgets programmatically.

      Which ones of these is better or what are the pros and cons of them?

      At first sight I find the forms with drag and drop functionality more friendly and easy to modify.

      What is your opinion?

      PS: In my case, portability Windows/Linux is important, in case this aspect does matter here.

      raven-worx 1 Reply Last reply Reply Quote 0
      • raven-worx
        raven-worx Moderators @kweber last edited by

        @kweber said in Forms vs window + QVBoxLayout in Qt creator desktop applications:

        Which ones of these is better or what are the pros and cons of them?

        there is no really better / worse comparison.
        If you like to design your GUI with Drag-n-Drop (=forms, =QtDesigner) then go with it. In the end the form definition is also translated to QWidget instances.

        I personally prefer to have "full control" over my code, so i create and compose the QWidgets myself.

        --- 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 Reply Quote 3
        • mrjj
          mrjj Lifetime Qt Champion last edited by

          Hi
          I do most layouts using Designer and loads mostly data from code.
          But you dont have to choose one way over the other.
          The UI forms is converted to code ( see setupUI() )
          so sometimes i use Designer to create a layout/setup and then use the code from my code as templates.
          The main reason we like using UI files is that it allows the non UX developers to do a bit of GUI sometimes as its less involving to drag a new button to
          a layout than reading heaps of setup code to find right spot.

          But basically, its more a matter of taste than anything technical . But there are things you need to do from code as designer cannot do it.

          1 Reply Last reply Reply Quote 2
          • First post
            Last post