1

I am wondering which way is the best to start building a GUI+SOFT in Qt. I am trying to build a sound media player based on a MVC pattern. Until now i have found 3 ways to do so.

1- Should I use a .ui file thanks to Qt designer, is it flexible enough ?

2- Should I use QML to make the design than integrate it to a C++ development ?

3- Should I just start from scratch and do it by hand without Qt Designer and using Qt library ?

Thank you very much for your answers.

ismail
  • 46,010
  • 9
  • 86
  • 95
clenemt
  • 793
  • 1
  • 7
  • 20

4 Answers4

4

NOTE: I'm using PyQt, so my comment may not be the most relevant.

I found Qt Designer to be great to create UIs, but then, when comes the time to modify them later, it becomes somewhat of a problem. Inserting new elements in an existing layout is often tricky, and you have to break all your layouts and re-assemble them (hoping you didn't mess anything up). Moreover, if your app is not trivial, you'll likely end up with code "fixing" what the .ui can't do. There are other tricky cases like that, but I don't remember them right now.

I ended up getting rid of my .ui files. So what I'd recommend is to initially use the designer to create the UI, and then use only the generated code from that point forward.

Virgil Dupras
  • 2,634
  • 20
  • 22
  • I think this technique is great for someone new to Qt. Use the designer to become familiar with the available components and their properties, but write your code with the library for reasons Virgil mentioned. For me, it is faster to just write the code, than to create a UI file and link to it in the code. Note: I use C++ Qt. – GatorGuy Jan 06 '11 at 12:54
4

If you want your UI to be animated and it is not a requirement to follow platform UI appearance, QML is by far the best way to achieve this. If you want a UI that appears like any other application on your system and has limited animation then stick with QtDesigner and standard widgets.

MartinJ
  • 1,656
  • 9
  • 8
1

I would use Qt Designer, as this is the easiest method IMHO.

trojanfoe
  • 120,358
  • 21
  • 212
  • 242
  • Is the Qt Designer for C++ complete, i.e. includes it most/all widgets and layouts? I got intro trouble with the PyQt Designer version, which lacks most classes and some layouts, so I couldn't keep making my GUI with the Designer and hat to switch to handcoding (on the plus side, I now habe more GUI programming experience and the code for the UI is much shorter and cleaner). –  Jan 05 '11 at 16:54
  • Yes it's complete as far as I understand. I think it's the obvious choice. – trojanfoe Jan 05 '11 at 17:01
  • 1
    Qt Designer is very complete, and anything you can't do in it, you can extend in manual C++ code. Check out the demos and tutorials for Qt, they all mention the 2 (or is it 3, I forget) ways to extend a .ui class manually. – rubenvb Jan 05 '11 at 17:02
  • But does any of you used QML and have some opinions on it ? Thank you :d – clenemt Jan 05 '11 at 17:08
1

I prefer building UI completely from scratch. This gives a lot of flexibility and better understanding of what is where, but on the other hand changing layout sometimes is a big headache.

Andrejs Cainikovs
  • 27,428
  • 2
  • 75
  • 95
  • I am using QtDesigner in C++ (included in QtCreator). Has any of you used QML ? – clenemt Jan 05 '11 at 16:56
  • 2
    Javascript for desktop applications? Never. I'm using QtDesigner for project skeleton, and then move everything to Eclipse. I've tried also so called "Qt Eclipse Integration", but found it somewhat uncomfortable, hence using just plain C++ with mingw compiled Qt libs. That's my personal work flow, I think a lot of people will smile on that, I've just get used to that. – Andrejs Cainikovs Jan 05 '11 at 17:01
  • @AndrejsCainikovs Do you run qmake manually then? (cause I came to the same setup, but running qmake w/o creating a batch file (calling qmake) within the project tree and setting appropriate eclipse behavior on project files double-click seems impossible) – mlvljr Jul 03 '12 at 09:26
  • 1
    @mlvljr, you can create/convert your Eclipse project to Makefile-based, and add qmake step into that Makefile. Here is the example makefile, but without qmake execution: http://stackoverflow.com/a/7823366/147407 – Andrejs Cainikovs Jul 03 '12 at 10:26