Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Difference coding and using Qt Designer
Forum Updated to NodeBB v4.3 + New Features

Difference coding and using Qt Designer

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
4 Posts 3 Posters 1.2k Views 1 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.
  • C Offline
    C Offline
    Calivernon
    wrote on last edited by
    #1

    Hi I am new on Qt and I don't understand the difference between :

    1. an application with windows, widgets and buttons coded "by hand" I mean create QFrame QLayout and arranging my widgets in them in the code then coding signal/slot etc ...
      OR
    2. the same application using QT Designer and placing my objects (layout frame whatever) graphically drag and dropping (with the designer) and doing signal/slot with the tool in designer and promoting my widgets in different classes.

    I see the difference in generating code with the "Ui::Dialog *ui;" object but I don't really understand what is it and I don't get the main thing of these two ways to code.
    Please could you tell me?

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      Hi! In the end both ways create the same result. If you write clean code by hand then you'll create a class for each of your windows and manually add the code to place the widgets in these windows where you want them. If your window is complex because it contains many widgets then this might become a bit hard because you have to keep a model of that window in your mind and imagine how things will look when you run them. Qt Designer helps you with that. Qt Designer is a graphical code editor and code generator: While you're using Qt Designer you can move around widgets in some kind of preview. During this time Qt Designer creates and manipulates a xml file (*.ui file) that stores all the information about what you want your window to look like, where all the widgets should be etc. When you're finished with designing your window you'll call qmake and this program will generate c++ code for you (a window class in a header and source file). This is just the same code that you could also have written by hand.

      1 Reply Last reply
      1
      • jacmoeJ Offline
        jacmoeJ Offline
        jacmoe
        wrote on last edited by
        #3

        One of the things that I really love about Qt is the fact that the ui files are turned into good, clean C++.
        You can learn from reading the generated C++ files - I often do that.
        Most of the time, though, I write my code by hand, but - as Wieland says - Qt Designer is a Godsend for more complex interfaces. Or for things you don't want to spend time hand coding.. ;)

        Less noise - more signal

        1 Reply Last reply
        0
        • C Offline
          C Offline
          Calivernon
          wrote on last edited by
          #4

          Hi, thank you for explaining it's very clear.

          So because I am struggling coding a simple application by hand I will probably try with the designer ^^
          Thank you

          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