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. Forms vs window + QVBoxLayout in Qt creator desktop applications
Forum Update on Monday, May 27th 2025

Forms vs window + QVBoxLayout in Qt creator desktop applications

Scheduled Pinned Locked Moved Unsolved General and Desktop
formswidgetslayout
3 Posts 3 Posters 1.1k 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.
  • K Offline
    K Offline
    kweber
    wrote on last edited by
    #1

    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-worxR 1 Reply Last reply
    0
    • K kweber

      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-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @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
      3
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #3

        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
        2

        • Login

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