MDI Application and Qt Quick
-
I'm working on porting a large desktop app to Qt and are faced with the Quick vs. Widgets question. I've scoured forums, docs, posts, blogs, etc. and though most folks adamantly say "use Quick" there seems to be some large pieces missing:
- Can a Quick desktop app simultaneously display multiple document windows (that each contain graphics). Some of these windows are different views into the same document (picture different layers of a 3D drawing)?
- Can Quick print a document, not by capturing an image but by rendering to a printer context? Can Quick access the system printer settings dialog?
- Does Quick have access to the system FileOpen/Save dialog, the Font dialog, the Color picker?
- Can Quick access system variables, shortcuts, environment variables?
- Can Quick have a modeless dialog, can that overlap other windows in the app?
- Does Quick support floating toolbars, dockable toolbars?
- Does Quick have access to libraries for SVG, PDF, XML, Compression, Internet/Networking?
- Can Quick support multiple displays, moving from one display to another and adjusting to that display's different resolution? Can it do this live while the application is running? Can it adapt one window of the application on one display and another window on another display?
The more I read the more I feel the answer to these is no, but I can't seem to find anything that addresses these questions directly. More and more I'm getting the impression that Quick can work for smaller desktop apps but not the larger scale ones.
Any advice would be greatly appreciated and thank you in advance.
~Mark
-
Keep in mind that even if a feature is not availabe in QML or Qt Quick, you can still implement it in C++ and expose it to QML. Or even implement it straight in QML for simple stuff.
Doing your UI in QML has the advantage of helping you separate cleanly your UI layer and your business layer.- Can a Quick desktop app simultaneously display multiple document windows (that each contain graphics). Some of these windows are different views into the same document (picture different layers of a 3D drawing)?
You can display multiple windows in a Qt Quick desktop applications, there's no such sing as a
QMdiArea
though. If you need sub windows or dockable windows you would have to do it yourself, not sure if it's worth your time.- Can Quick print a document, not by capturing an image but by rendering to a printer context? Can Quick access the system printer settings dialog?
You can easily call c++ code that prints stuff. Alternatively, if you are using a
TextArea
or aTextEdit
, you can access the underlyingQTextDocument
and print that.- Does Quick have access to the system FileOpen/Save dialog, the Font dialog, the Color picker?
Yes
- Can Quick access system variables, shortcuts, environment variables?
Yes, not sure what you mean by system variables, but you can define shortcuts with a
QKeySequence::StandardKey
value in QML. For envirnoment variable, QML has no direct access to them but you can easily just expose the ones you are interested in from c++, or create a c++ helper to access arbitrary ones.- Can Quick have a modeless dialog, can that overlap other windows in the app?
Yes
- Does Quick support floating toolbars, dockable toolbars?
Not out of the box, but that can be done. Not easily though.
- Does Quick have access to libraries for SVG, PDF, XML, Compression, Internet/Networking?
Qt Quick can display SVG or read XML documents and do some light networking. In the end it has access to c++, so you can do what you want. You wouldn't do file compression in QML, do that in c++.
- Can Quick support multiple displays, moving from one display to another and adjusting to that display's different resolution? Can it do this live while the application is running? Can it adapt one window of the application on one display and another window on another display?
Qt Quick can definitely work with large applications if you correctly separate your UI layer from your business layer.
The only hurdle I would consider in your list is the lack of dockable toolbars and subwindows constrained to a parent window.
That would not stop me but It would for sure be a daunting task for a newcomer to QML and Qt Quick.EDIT: I found that on google : https://github.com/unseon/QQuickDock Haven't tried it and not sure if it works well and if it is polished enough.
Alternatively you could do only some parts of your UI in Qt Quick withQQuickWidget
and the rest in Widgets (maybe only the MDI stuff ?)