-
Notifications
You must be signed in to change notification settings - Fork 90
Theme: C++ implementation based on propagated attached property #19316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
71355b5 to
d6a2153
Compare
Jenkins BuildsClick to see older builds (257)
|
c1b54b0 to
6cf7b25
Compare
alexjba
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work! I love it :beers
Let's get it merged quickly now that we have the release branch. It's probably a burden to maintain.
cf4e110 to
5309fdb
Compare
caybro
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work! Just some suggestions and minor things
| readonly property alias monoFont: monoFont.font | ||
| readonly property alias codeFont: codeFont.font | ||
|
|
||
| FontLoader { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could (pre)load all these fonts from C++ too, and it would be faster imo :) And just expose the three baseFont/monoFont/codeFont properties
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant https://doc.qt.io/qt-6/qfontdatabase.html#addApplicationFont
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea was to keep the attached type as small/simple as possible. Ideally only stuff that can benefit from propagation should be there. I found it more modular when keeping things like that separated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, this wouldn't be part of the propagation, just initialized and setup somewhere else, not in QML
b16bc5d to
bd198c5
Compare
noeliaSD
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work on this implementation! The structure looks solid and the overall approach makes the theming system feel clean and easy to work with. I’ve left a couple of comments and suggestions, but everything is looking really good.
Next step for me will be to run a full test of the PR on both desktop and mobile to ensure everything behaves correctly across breakpoints.
e9ab1e6 to
f1bfc61
Compare
|
@micieslak, could we postpone merging this PR until a big tokens-related refactor gets merged? |
ca99e7b to
fefffda
Compare
caybro
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work, let's merge this 🚀
fefffda to
c3ed396
Compare
c3ed396 to
658d72a
Compare
658d72a to
af3312b
Compare
What does the PR do
Re-implements
Themefrom stateful singleton to attached property object, with dynamically propagated properties through the visual objects tree.The approach is similar to the one used by buit-in themes, like
MaterialorUniversal.It consists of following elements:
Theme- attached property type, holds state (padding, font size offset, style), which is propagated within the objects tree.StatusColors- singleton, stateless, holds fixed colors definitionsThemePalette<- non-mutable, not creatable component served byTheme, defining colors. We have two instances for dark/light stylesThemeUtils- singleton, stateless utility methods and constantsFonts- singleton, stateless, loads and serves fontsAssets- singleton, stateless, access point for png/svg/emojiBy using attached property type, visual features like colors and sizes are no longer single global state, the same for all components within the app. It brings better flexibility when building responsive layouts for multiple platforms.
Closes: #19213
Affected areas
Entire QML codebase
Architecture compliance
My PR is consistent with this document: QML Architecture Guidelines
Impact on end user
This change doesn't bring any changes visible to the end user.
How to test
Run the app and go through all possible views to detect incorrect colors, fonts, paddings, etc.
Risk
As there are many changes, there is a risk of introducing regressions related to visual appearance.