Re:C++11 in Qt 5
by zokier on Monday June 11, 2012 @03:58PM
(#4096587)
Every time I touch Qt, it feels more like Java than C++. Both because it has reimplemented everything and abstracted the OS completely (write once, debug everywhere). And the memory use patterns seem similar too, Qt feels very lax on how memory is used, and seems to prefer heap allocations a lot.
Those are just superficial impressions, but while Qt is terrific GUI toolkit and set of libraries, the all-encompassing framework style doesn't fit to me.
Re:C++11 in Qt 5
by rubashov on Monday June 11, 2012 @07:27PM
(#4097680)
Qt is what it is because in the 90s and much of the aughts they needed to implement loads of their own stuff for support across many compilers and platforms. That's not really true anymore and using their containers and smart-pointers and so forth is now really annoying.
Anyone used gtkmm? That seems to be the one cross platform C++ GUI framework that doesn't try to re-implement massive chunks of the standard library and forsake modern C++ programming style and idioms.
Re:C++11 in Qt 5
by excuse-me on Monday June 11, 2012 @04:20PM
(#4096709)
An all encompassing framework is useful if you want cross platform - you can still have Createfile(Handle) fopen(FILE*) if you want with a bunch of #ifdefs.
Most of it's own collection classes have been replaced with std:: versions. There is still QString but it does a lot more than std::string, especially if you need to be multi-lingual
Signals/slots I like more than the boost equivalents. The multithreading probably is better in c++11
Re:C++11 in Qt 5
by gecko on Monday June 11, 2012 @03:19PM
(#4096338)
I don't quite follow your last point, unless you're mocking wxWidgets. Qt doesn't require you to jump to the C++11 bandwagon, unless you want to. In fact, that post even explicitly highlighted how the old signals and slots will continue to work, and how several of the new Qt macros are no-ops on legacy C++ compilers. Seems like Qt's got your back no matter what your attitude on modern v. older C++.
Re:C++11 in Qt 5
by icefox on Monday June 11, 2012 @03:18PM
(#4096325)
Sounds like you didn't read the article. For example rather than using 'override' if you use the Q_DECL_OVERRIDE macro it will spit out 'override' when you want to compile with C++11 and when you don't it does nothing. Not a fan of modern C++ or can't use C++11 for some project, but you can for others? Qt has your back while from your tone wxWidgets forces you to not use the new C++11 features.
Re:C++11 in Qt 5
by rpwilcox on Monday June 11, 2012 @04:17PM
(#4096692)
My point was that QT has adopted the new ideas from C++ (like the new override operator), where as wxWidgets (last time I looked, a few years ago) has barely moved to using the STL for containers.
wxWidgets is a much more conservative framework, where QT seems to embrace the new stuff (and provide backwards compatible hooks where possible).
Of course, you could use different C++ styles and ignore "what you don't like" from either framework, but there's a little impedance mismatch.
Re:C++11 in Qt 5
by FigBug on Monday June 11, 2012 @03:53PM
(#4096568)
Yes, it's still used for several reasons, including:
- enumerate the properties, signals, slots and other methods as well as decorations (classinfo) present in a class (this feature is called “type reflection”, which is common in scripted languages, but is also present in Java)
- get and set properties by name and without knowing th exact type of the property (though technically the latter is a product of the related, but independent Meta Type system)
- place calls to extracted member functions (the “invokable” functions) by name
- the last two features together allow us also to integrate C++ classes easily with other languages and IPC mechanisms without the need to write specialised parsers (D-Bus, EcmaScript, QML, but also the many bindings to Qt like Python or C#)
- instantiate types by simply having access to the meta object
Re:C++11 in Qt 5
by ajasmin on Monday June 11, 2012 @05:01PM
(#4096954)
I certainly don't think it's a bad thing. Seems like without a MOC the programmer would have to write more code or file all that meta data in a separate file. So it's all good.
I was just curious since I haven't touched Qt in years and this post implies it is moving toward more standard C++.
Those are just superficial impressions, but while Qt is terrific GUI toolkit and set of libraries, the all-encompassing framework style doesn't fit to me.
I just wish they something as powerful as the GridBagLayout. No, QGridLayout is not it.
Anyone used gtkmm? That seems to be the one cross platform C++ GUI framework that doesn't try to re-implement massive chunks of the standard library and forsake modern C++ programming style and idioms.
Most of it's own collection classes have been replaced with std:: versions. There is still QString but it does a lot more than std::string, especially if you need to be multi-lingual
Signals/slots I like more than the boost equivalents. The multithreading probably is better in c++11
Want to use the latest C++ features? QT has your back. Not a fan of modern C++? wxWidgets has your back.
wxWidgets is a much more conservative framework, where QT seems to embrace the new stuff (and provide backwards compatible hooks where possible).
Of course, you could use different C++ styles and ignore "what you don't like" from either framework, but there's a little impedance mismatch.
- enumerate the properties, signals, slots and other methods as well as decorations (classinfo) present in a class (this feature is called “type reflection”, which is common in scripted languages, but is also present in Java)
- get and set properties by name and without knowing th exact type of the property (though technically the latter is a product of the related, but independent Meta Type system)
- place calls to extracted member functions (the “invokable” functions) by name
- the last two features together allow us also to integrate C++ classes easily with other languages and IPC mechanisms without the need to write specialised parsers (D-Bus, EcmaScript, QML, but also the many bindings to Qt like Python or C#)
- instantiate types by simply having access to the meta object
I was just curious since I haven't touched Qt in years and this post implies it is moving toward more standard C++.