[DoNotMerge] ✨Use declarative macros for better Qt integration (e.g. QDS)#172
[DoNotMerge] ✨Use declarative macros for better Qt integration (e.g. QDS)#172Thiesius wants to merge 1 commit intoOlivierLDff:masterfrom
Conversation
| result* | ||
| .direnv | ||
|
|
||
| cmake-build-*/ |
There was a problem hiding this comment.
This is mainly for CLion. As the IDE generates in source build folder like this.
| set(QATERIAL_ENABLE_INSTALL ${_default_QATERIAL_ENABLE_INSTALL} CACHE BOOL "Generate the install target") | ||
|
|
||
| # "d" postfix should also transitively apply to dependencies but won't affect the parent scope | ||
| set(CMAKE_DEBUG_POSTFIX "d") |
There was a problem hiding this comment.
This is useful so you can install both release and debug library in the install folder.
| CLASS_NAME QaterialPlugin | ||
| PLUGIN_TARGET qaterialplugin | ||
| NO_PLUGIN_OPTIONAL | ||
| RESOURCE_PREFIX "/" |
There was a problem hiding this comment.
I had a lot of troubles with these prefixes and what not. I haven't tried to go back to individual subtargets linking into this library.
| NO_PLUGIN_OPTIONAL | ||
| RESOURCE_PREFIX "/" | ||
| SOURCES ${QATERIAL_SRCS} | ||
| OUTPUT_DIRECTORY "${QATERIAL_OUTPUT_DIR}" |
There was a problem hiding this comment.
OUTPUT_DIRECTORY contains everything one might need to install into output "qml" dir. Haven't found some dedicated target for that or example for "how it is done in Qt".
|
|
||
| target_compile_features(${QATERIAL_TARGET} PUBLIC cxx_std_17) | ||
| target_include_directories(${QATERIAL_TARGET} PRIVATE src ${QATERIAL_ICONS_OUTPUT_FOLDER}) | ||
| # Glob all include directories in src Qaterial |
There was a problem hiding this comment.
The next section is needed, because the generated files always include the "parent header" with not prefix. Looks a bit hacky though. There could be better solution.
This is related:
https://forum.qt.io/topic/158392/problem-with-qml_element-for-classes-in-subfolder-of-project
| install(DIRECTORY ${QATERIAL_OUTPUT_DIR} | ||
| DESTINATION ${CMAKE_INSTALL_PREFIX}/qml/ | ||
| FILES_MATCHING PATTERN "*.qml" PATTERN "qmldir" PATTERN "*.qmltypes" PATTERN "*.dll" PATTERN "*.so" | ||
| ) |
There was a problem hiding this comment.
Installs all that is needed for QDS into QML dir.
| ) | ||
|
|
||
| set(SINGLETON_FILES | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/Calendar.qml |
There was a problem hiding this comment.
Bug I think, This can also be probably split and merged immediately.
|
|
||
| parent: Overlay.overlay | ||
| property int dialogImplicitWidth: Qaterial.Style.dialog.implicitWidth | ||
| implicitWidth: Math.floor(Math.min(parent.width - 2 * Qaterial.Style.card.horizontalPadding, dialogImplicitWidth)) |
There was a problem hiding this comment.
I had to remove this line because my AlertDialogs had a cut headers.
E.g. "Failed to blah glah flah" would become "Failed to blah gla..."
Not sure if this is a correct place to treat this, but it works 😄
| static bool registeredTypes = false; | ||
| static bool registeredRes = false; | ||
|
|
||
| void __Qaterial_registerIconsSingleton(); |
There was a problem hiding this comment.
This section can be probably purged more thoroughly. Didn't investigate as I'm not calling anything from here in my C++ code.
|
|
||
| // Behave like QQuickIcon (that is private) | ||
| class QATERIAL_API_ IconDescription : public QObject | ||
| class QATERIAL_API_ IconDescription : public QQuickItem |
There was a problem hiding this comment.
I think QDS was whining about something here.
There was a problem hiding this comment.
This is odd, to me QQuickItem is really only when your object have some kind of visual or a size. Which isn't the case here
|
Thank you for the work and the research to fix things. I don't know anything about QDS and never used it. I always felt just coding qml is dead simple enough. Using QDS feels like something you need when you don't wireframe/prototype your UI with a tool like figma, which is a bad practice. Please note that this library is mainly in maintenance mode for my company's projects, we do not whish to add new features in here (Maybe a v2 in the future). I will leave some review to your comments if you want to open small PRs about what can be merged. I might also need to update Qt version in the CI |
|
|
||
| # ───── QATERIAL TARGET ───── | ||
|
|
||
| qt_policy(SET QTP0004 NEW) |
There was a problem hiding this comment.
This is neat since Qt6.8, thank you for the discovery I missed it. I guess it won't change much in here, but I have some projects that may be affected so I can remove lots of CMake code.
|
After going thru your PR I see couple of things that could be split in different PRs:
I also need to update some actions in the CI (updating Qt version, updating stuff related to gha cache, ...) |
Mainly the changes that I "needed" to do for supporting Qaterial in QDS.
I'm a beginner in Qt, and I found that the documentation of the QML/Qt/QDS to be lacking some important details.
The whole merge request needs to be revisited, because in the pursue of my goal I might have been cutting too much 😃
So this is more of a "reference" to let you know, what I have needed to do. (Since I completely removed STATIC library)
I might have some time to clean this up in upcoming months. But for now I want to mostly focus on my original goal -> actually using the library 😀 . Unless there is some low hanging fruit to be picked - then I would need to know all the scenarios you want to support.
For QDS support I have added "d:/libs/Qaterial/qml" (My install dir.
qmlis a new install subdir for QML + plugin stuff) to theimportPathsinqmlproject. And for qml2puppet I also needed to make the Qaterial.dll to be accessible from PATH, as the plugin has the dependency on it. For my convenience I have copied it right into the QDS bin dir.On the video below you can see how the integration works (Just edited a dummy project that the QDS generates for you)
qat2.mp4
Puppet:

I did some other tiny fixes as well. Some of them can be probably ported to master immediately. I will try to highlight them in self-review.
Otherwise I have been able to use Qaterial in my C++ application with CLion IDE for the C++/QML part and I have used the QDS to just prototype the visuals/UI real quick.
By the way, this is a very cool library. Finally everything looks great without much effort, and my UI doesn't look like a chewed up pencil 🥳 . Thanks for the great library. Well done!