Depends, In some cases, I do them within the program, usually this is in the case where the elements in the dialog my change dynamically. Otherwise, the designer is my friend.
Always. I almost don't know how to layout widgets manually.
Designer? What is that? Nope, never use it.
Depends and the task. Sometimes yes, sometimes no.
Depends, In some cases, I do them within the program, usually this is in the case where the elements in the dialog my change dynamically. Otherwise, the designer is my friend.
I use designer when it's convenient. Some things, like toolbars and such, must be done programmatically (designer has no such functionality in v4), but I don't complain too much there - it's a simple matter. Other things, like truly dynamic menuing systems, obviously cannot be done through designer due to their dynamic nature (for example, a list of pushbuttons that gets populated based on what plugins the user has loaded).
Some things are possible to do in designer, but are very awkward. For example, creating a widget to insert into a bunch of other widgets (re-using functionality). Designer provides this functionality, but you must manually edit the .ui file to properly include it. Much easier to just design the thing via code, though you can of course design the shared portion using designer rather easily.
Of course, most simple widgets and dialogs benefit greatly from designer - being able to see exactly how everything gets placed, how certain modifications look in real-time, etc - it's a valuable resource.
Life without passion is death in disguise
I use Designer if Designer can do what I want. But I find it extremely limited.
If I want a combobox in a toolbar, for example, I'm out of luck. Or if I want to assign a QIcon with different states to an action, instead of a single image. Or if I want to lay-out the status-bar. Or if I want to set my own central widget.
The code would be a lot cleaner if you could do more in Designer.
Last edited by Michiel; 21st May 2007 at 12:58.
"The strength of a civilization is not measured by its ability to wage wars, but rather by its ability to prevent them." - Gene Roddenberry
True, but this is quite easily implementable, so it's highly probable we'll have access to QWidgetAction objects from Designer.
I think this one is possible to do with current Designer, but I'd have to check how it assigns icons to widgets.Or if I want to assign a QIcon with different states to an action, instead of a single image.
True, but this is easily doable by combining two Designer generated widgets and not more than five lines of code.Or if I want to lay-out the status-bar.
Hmm... This one you certainly can do within Designer, especially with the help of custom widgets.Or if I want to set my own central widget.
True, but it'd start to get difficult to use the tool.The code would be a lot cleaner if you could do more in Designer.
Looks to me like you can only select one file or one resource.
Hm.. Could you explain this? Right now I do it with only 4 lines of code, without using designer.True, but this is easily doable by combining two Designer generated widgets and not more than five lines of code.
In Designer, the central widget is a QWidget, which is the parent of my real main widget. This is all in Designer, but it's a bit of a waste to have a QWidget that doesn't really do anything.Hmm... This one you certainly can do within Designer, especially with the help of custom widgets.
Or I can use the setCentralWidget() function in the code. This costs extra lines of code to create the widget, set its properties and make it the central widget.
True, but I don't think we're at that point yet. Right now, many more features could be added without sacrificing simplicity.True, but it'd start to get difficult to use the tool.
"The strength of a civilization is not measured by its ability to wage wars, but rather by its ability to prevent them." - Gene Roddenberry
There are other ways to assign pixmaps.
You can certainly implement your statusBar widget in Designer and then just assign it to the status bar using code. There is also a high chance you could use QStatusBar as the base for your form in Designer and then just replace the default bar with yours with a single line of code. If not, then it's just a matter of subclassing QStatusBar to introduce proper functionality.Hm.. Could you explain this? Right now I do it with only 4 lines of code, without using designer.
That's not much of a waste, isn't it? I'm sure you can spare extra 100 bytes of memory. It's just a pitty you can't promote the default central widget to the proper widget. But maybe that's a suggestion for Trolltech to do it. Should take them not more than 15 minutes to do that.In Designer, the central widget is a QWidget, which is the parent of my real main widget. This is all in Designer, but it's a bit of a waste to have a QWidget that doesn't really do anything.
I'm sure there are features in Designer which you have not discovered yetTrue, but I don't think we're at that point yet. Right now, many more features could be added without sacrificing simplicity.
Edit: I just checked and confirmed it's possible to assign whatever icons you want from within Designer.
Last edited by wysota; 21st May 2007 at 14:10.
Too much trouble. Right now, I only have two QLabels inside the statusbar. And I only require 4 lines of code (6 if you include the member var declarations) to put them there. I simply think you should be able to drag them (and maybe progressbars, etc.) to the statusbar in Designer.
You're right, it's not much of a waste. And I'll sacrifice those 100 bytes to be able to do as much as possible in Designer. I simply think that you should be able to remove any unnecessary layers of code. As you say, it's probably not hard to implement this one.That's not much of a waste, isn't it? I'm sure you can spare extra 100 bytes of memory. It's just a pitty you can't promote the default central widget to the proper widget. But maybe that's a suggestion for Trolltech to do it. Should take them not more than 15 minutes to do that.
I don't think so. Don't misunderstand. I love Designer. It's clean, easy to use and elegant. But there are improvements to be made. You can't take full advantage of the features of Qt 4 in Designer.I'm sure there are features in Designer which you have not discovered yet
Well, don't keep it to yourself. How do I assign a QIcon (with different sizes + enabled/disabled states) to a QAction from within Designer?Edit: I just checked and confirmed it's possible to assign whatever icons you want from within Designer.
"The strength of a civilization is not measured by its ability to wage wars, but rather by its ability to prevent them." - Gene Roddenberry
You use the "pixmap function" feature of Designer.
BTW. I don't say Designer is perfect. See the posts about UIC and container plugins on my blog.
I use Designer for QMainWindow and QDialogs. I find it handy to get the layout right, especially when I want to stretch "correctly", whatever that is depending on the dialog. It helps to connect simple signals/slots such as pressing enter in a text edit box to activate the Apply button. It makes it very easy to write code with the automatic slot naming, such as on_QSpinBox_valueChanged(int ID).
The times I write code are when the contents change.. such as a joystick dialog where it loads sliders for each available axis, and buttons for each available button. A library handles most of the work and gives me counts for each.
You probably don't need it - it is a function you can write to generate pixmaps according to a name. You can substitute the default pixmap generation process (based on a filepath) with it.
You wouldn't see the result in (current) Designer. If icons are your only problem, you can write a simple routine that would set the icons in code and layout the gui in Designer.I've been writing most of my interface code by hand since I need to assign icons containing multiple pixmap sizes to QActions , but if it was possible to do in designer I would switch.
Always the designer.
I also avoid using "clever code" which will give trouble to those that are going to be supporting my aps after June of next year. Writing "inspired" code which you can't figure out when you are not so "inspired" is foolish. The maintainers will hate you for it.
Thank you for this discussion. Because of this I have finally took the time to learn using the forms, excelent.
At the possible I use designer. But if I would know , I would use a text editor.
Colombo C. Da Encarnaçao Q.
I started with Qt4, and i started with the designer. I always had problems with the designer-generated UIs, i could not handle them. So i mainly use it now to visualize what i want to do and then hardcode it. One problem with generated widgets i had was that they never adjusted their size to the widget or mainwindow that contained them.
Not often, I use the designer when my gui design is very complex because it makes the gui very easily...........otherwise I prefer coding to design gui..................
Newbie that I am, I generally use the Designer.
But occasionally when I am trying to add new items, it is a real pain to have to break all the layouts, or have Designer turn your dialog into a tangled mess.
In those cases I usually manually insert items into the *.ui file, using an XML editor.
I don't bother with signals/slots in them. Because the designer creates ugly naming of the slots. etc. But I use it everything else, but depending on what I need it for.
I don't use QT Designer ever.
I guess I'm just old school and prefer controlling everything in my own code.
I also find QTs syntax for building layouts very intuitive so it's easy for me.
Karl
Bookmarks