Linked by Thom Holwerda on Tue 1st Dec 2009 19:03 UTC, submitted by poundsmack
Qt Nokia has released the latest version of its cross-platform toolkit Qt, version 4.6. As usual, it comes with a whole slew of improvements and new features, and this time, they even added a new platform into the mix.
Permalink for comment 397351
To read all comments associated with this story, please click here.
RE[3]: KDE
by vivainio on Tue 1st Dec 2009 20:47 UTC in reply to "RE[2]: KDE"
vivainio
Member since:
2008-12-26

In particular, I like how containers (that provide layouts) are widgets themselves, meaning that you can put a complex layout with multiple widgets in it anywhere that you could put a single widget. That's not true in Qt (at least, not without a little extra work): there, layouts are a separate entity from widgets.


I think you may be misunderstanding something here. You can instantiate a QWidget (not subclass, just instantiate), set a layout on it, then add your child widgets there. The resulting QWidget can be used as you would use the layout object in Gtk, i.e. you can add it as a "single" widget to a place that accepts a single widget (e.g. another layout).

You can find 2 source snippets that do just this here:

http://qt.nokia.com/doc/4.6/layout.html#laying-out-widgets-in-code

Of course you could trivially create your QVBoxWidget that does what you want (i.e. avoid the single setLayout call), but I think you'll agree that it wouldn't really help things :-).

Reply Parent Score: 4