M
M
MCoder2016-04-17 00:55:02
Qt
MCoder, 2016-04-17 00:55:02

What is the best way to switch to Qml?

Good afternoon.
There is a fairly large project written in Qt. Qt widgets are used.
Now the task is to make mobile versions of this program. I understand that I need to leave QtWidgets for QML. Please tell me the answers to the following questions (who actually faced such tasks).
1. Should I write a universal app that scales with screen size? Or make a separate Qml project and partially use the code base of an existing application?
2. What about different screen sizes? After all, the resolution of the tablet is clearly greater than the phone. How is the issue resolved? Determine the screen parameters at the start, and then load the desired interface?
3. The program has a fairly large number of custom widgets that draw various specific charts, graphs, etc. How to port them under QML? Is it possible to insert what is there or rewrite from scratch in Javascript?
4. Are there opensource projects of a similar plan (multi-platform application on qml) to see how it is actually done correctly?
5. Have you removed the restriction on static linking when posting in the App Store? That is, can a commercial application linked dynamically with Qt be sent there? It seems like it wasn't possible before.
Thanks in advance for your replies.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
J
Jacob E, 2016-04-17
@MCoder

1) Maintaining two branches of the same code, adding features twice is not a good idea, so you need to move entirely.
2) It's not about resolution, but about the physical size of the screen, you need to load different layouts at different sizes
3) Inserting as is is a bad idea, it's better to port it anyway. But if they are drawn through QPainter, then the problem is not big, and you can use something like doc.qt.io/qt-5/qquickpainteditem.html .
4) blog.qt.io/blog/2013/12/10/cross-platform-applicat...
5) EMNIP since iOS 8 dynamic linking works, but there are no restrictions with statics, the license does not prohibit.

N
Nikita Krupenko, 2016-04-29
@BlackRaven86

1-2. The modern way to scale in Qt is to use AA_EnableHighDpiScaling . Widgets and most (but not all!) QML components should work. The technology is still new, so it's worth checking and writing bug reports if something doesn't work right.
And here there is one problem with QML: a set of components that look like widgets (ie QtQuick Controls 1) does not support the new scaling. The new library QtQuick Controls 2 supports scaling, but there controls are mobile, with the appropriate view. So if on the desktop you definitely need controls that look like widgets, then it makes sense to leave the interface on widgets on the desktop, and for mobile devices to make the interface on QML.
3. You can draw in QML using Canvas, or you can draw in C ++ using Scene Graph. Look at the Qt Charts code, as far as I understand, it was originally designed for widgets, but draws charts in QML as well. However, when I tested it, it was slower than my implementation on Canvas :)
5. As far as I know, support in Qt is still in the process of integration . There is another caveat here: the AppStore grafts are not very compatible with copyleft licenses, so a commercial license would be the most reliable choice.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question