C++11 in Qt 5(woboq.com)
woboq.com
C++11 in Qt 5
http://woboq.com/blog/cpp11-in-qt5.html
3 comments
Every time I touch Qt, it feels more like Java than C++
I just wish they something as powerful as the GridBagLayout. No, QGridLayout is not it.
I just wish they something as powerful as the GridBagLayout. No, QGridLayout is not it.
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.
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.
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
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
QT's move to modern C++ standards gives the "which cross-platform C++ framework should I use to create my app" another data point.
Want to use the latest C++ features? QT has your back. Not a fan of modern C++? wxWidgets has your back.
Want to use the latest C++ features? QT has your back. Not a fan of modern C++? wxWidgets has your back.
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++.
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.
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.
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.
I haven't looked at Qt in a long while. Do they still have the MOC?
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
- 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
Yes, Qt still uses moc. I leave it up to you to decide if that's a good thing or a bad thing.
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++.
I was just curious since I haven't touched Qt in years and this post implies it is moving toward more standard C++.
[deleted]
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.