summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2023-04-15 14:33:26 +0800
committerꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2023-04-15 14:33:26 +0800
commit4b4f6220c1c223febb338c68a95e5e5791fecbca (patch)
tree8454ba4c001ec9bb4221591d8a7bb0930312c9c3
parent9760ed0fca36990ea69e68e6057266e27cba62a9 (diff)
Newly instantiated components check root mode
The ui.qml would be the root, when any attached property is set. Make sure that UI's mode is set by its implementation.
-rw-r--r--Bootstrap.cxx12
-rw-r--r--Label.qml1
2 files changed, 12 insertions, 1 deletions
diff --git a/Bootstrap.cxx b/Bootstrap.cxx
index 38bbba5..e6b07ef 100644
--- a/Bootstrap.cxx
+++ b/Bootstrap.cxx
@@ -115,6 +115,18 @@ Bootstrap::Bootstrap(QObject *parent):
OVERRIDE_HX_FONT_SIZE("H6FontSize", h6FontSize);
toml_free(toml);
+
+ QObject *ancestor;
+ QObject *grandAncestor = parent->parent();
+ while ((ancestor = grandAncestor))
+ if (!(grandAncestor = ancestor->parent()))
+ for (auto child : ancestor->findChildren<QObject *>())
+ if (!strcmp(child->metaObject()->className(),
+ "Bootstrap")) {
+ bsMode = qobject_cast<Bootstrap *>
+ (child)->mode();
+ break;
+ }
}
Bootstrap *Bootstrap::qmlAttachedProperties(QObject *object)
diff --git a/Label.qml b/Label.qml
index 5230131..be125ff 100644
--- a/Label.qml
+++ b/Label.qml
@@ -5,7 +5,6 @@ import Bootstrap 5.3
Label {
id: control
- Bootstrap.mode: Window.window.Bootstrap.mode
font {
family: Bootstrap.heading
? Bootstrap.headingFont.family