[Solved] Exporting QWidgets to QML?
I've got an application which uses QWidgets.
Some special functionality is already implemented, for example I created an eventFilter that the enter key also changes the focus. I would also like to continue to use the validators, the setPlaceHolderText, setInputMask, etc. of the QLineEdit and some other built-in functionality of the QWidgets. Also, I could not find something similar to the QCombobox in QML.
Now I would like to add animations to my application. Is it possible to "export" the QWidgets to QML? Or how can I reuse my existing code when I would like to switch to QML?
I'm very new to QML, therefore I'm sorry if the answer is obvious. I would be really happy if you could recommend me some tutorials regarding this topic. Thank you!
see "this article":http://doc.qt.nokia.com/4.7-snapshot/declarative-cppextensions-qwidgets.html
Also, you can use "Qt Components":http://doc.qt.nokia.com/qt-components-symbian-1.0/qt-components.html. They are available for Symbian, MeeGo and desktop.
I would recommend against the first approach. Yes, it is possible, but no, it is not a good idea. QGraphicsProxyWidget should IMO be avoided. It does not work properly, and is basically depricated due to it being a design flaw to begin with.
Go for the components if you can.
Thank you, I already heard that QGraphicsProxyWidget should be avoided at the Qt Dev Days. Is there an alternative for it if I want to create my own components?
I saw that the native Qt Quick elements are derived from QDeclarativeItem. Maybe this helps when creating my own QML elements, but e.g. the QComboBox seems to be quite a lot of effort.
Why don't you look into how the Quick Desktop Compontents project creates combo boxes?
See "here":http://qt.gitorious.org/qt-components/desktop for the sources and "here":http://www.youtube.com/watch?v=nj5jzv6njKg for the video.
The Quick Desktop Components are amazing!
Are the Qt Components also available for Desktop? I saw that the Page and PageStack qmls are in Symbian / Meego folders.
Do you know if it is planned to include these components in the new QML version?
They are not available yet in the sense of "officially released", however the sources are there for you to use if you want. It is likely that a set of components like these will appear in a future version of Qt, but don't count on it being there before Qt 5.1.
That sounds good!
But it would still be nice if I could reuse all my QWidget dialogs and if I would not have to rebuild them.
[quote author="saho" date="1320329834"]But it would still be nice if I could reuse all my QWidget dialogs and if I would not have to rebuild them.[/quote]
Don't count on that. However, if you now have a good separation between your program logic and your UI, it should be easy to re-use at least the logic part of your application.