On Tue, 26 Jun 2012 12:56:06 ext Harri Porten wrote: > Here are my notes from the QWidgets session on June 22th, 2012, 11:30 > o'clock: > > http://qt-project.org/groups/qt-contributors-summit-2012/wiki/QtWidgets > > ,,, > > Help with migration from Qt 3/4 to 5 > ==================================== > - Desktop QML components (using QStyle) > - Wrap QWidgets in QML container element
That's not going to be quite as easy as the inverse. While I think QML needs to be embeddable inside a QWidget scene for 5.0, there are a couple problems with the inverse so it will probably be a while until that works. See examples/declarative/cppextensions/qwidgets (Qt 4.x) for an example, it requires a QGraphicsProxyWidget equivalent (QGPW was almost 2k LoC, a lot more complex than the 103 line QWindowContainer WIP) and it requires a custom class to expose widget properties to QML. So even a complex container element is not enough, you also have to make every widget QML compatible (not actually that hard, most of them use Q_PROPERTY already). > - Educate developers about UI/backend separation > - Converter of .ui files to QML? That's a good idea, and actually pretty close to useful already. All you really need to do is to register all the QWidget types into a QtWidgets import, they're already QObjects and I think all designable attributes are already marked as properties. Write a plugin that's all qmlRegisterType lines, and a utility that turns XML into QML (trivial, and I think I still have one lying around from ye olde days ;) ) and it should be pretty simple. Mind you, there's a big difference between QML and .ui2 - this is one reason why there's a QtQuick module instead of just using the Qt Widgets in QML. Without signals on the properties, bindings won't work. Also without a default children property, the hierarchy doesn't build up naturally (or at all, the plugin of just qmlRegisterTypes might only work for single widget scenes). Neither the property set nor the property implementation is geared towards animation in widgets, so I doubt you'd get good results from trying to animate it using QML animations (worth a test though). All are fixable, but would require significant work on the widget set. All these issues are also reaching beyond features that are provided by .ui files, so go past the issue of porting from Qt 4. I thought I had an ancient example which exposed QWidget in 4.6, but I can't find it. For the reasons described, it wasn't very useful anyway. The key point is that you can have any tree of QObjects described in QML, and it would be trivial to create a wrapper that places the root item as the central widget in a QMainWindow, as opposed to the current wrapper which places the root item into a QQuickItem scene. -- Alan Alpert _______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development