aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickcontrolsimpl/qquickiconlabel.cpp
diff options
context:
space:
mode:
authorTarja Sundqvist <tarja.sundqvist@qt.io>2026-09-03 12:35:56 +0300
committerTarja Sundqvist <tarja.sundqvist@qt.io>2026-09-03 12:35:56 +0300
commit7ed17317a5013b1ab885ecc4ac61fb0ed3c1ab35 (patch)
tree7c208fe854d7dcfd7421c2ea20e3cd8a0812adfe /src/quickcontrolsimpl/qquickiconlabel.cpp
parent175e30c1a74c2b4efa5a6fe5c45d289660b51d2f (diff)
parent2d9e5e76640cd16724ec2fef20d60109537be0bd (diff)
Merge tag 'v6.5.10-lts-lgpl' into 6.56.5
Qt 6.5.10-lts-lgpl release
Diffstat (limited to 'src/quickcontrolsimpl/qquickiconlabel.cpp')
-rw-r--r--src/quickcontrolsimpl/qquickiconlabel.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/quickcontrolsimpl/qquickiconlabel.cpp b/src/quickcontrolsimpl/qquickiconlabel.cpp
index 7d1561795b..612d98aa26 100644
--- a/src/quickcontrolsimpl/qquickiconlabel.cpp
+++ b/src/quickcontrolsimpl/qquickiconlabel.cpp
@@ -600,6 +600,21 @@ void QQuickIconLabel::componentComplete()
completeComponent(d->label);
QQuickItem::componentComplete();
d->layout();
+
+ // Any items declared as children of us will be parented before the label and icon image,
+ // so they will be drawn below us. This is not intuitive, so move us to the bottom of the pile.
+ const auto paintOrderChildItems = QQuickItemPrivate::get(this)->paintOrderChildItems();
+ const auto bottomMostFosterChildIt = std::find_if(paintOrderChildItems.constBegin(),
+ paintOrderChildItems.constEnd(), [d](QQuickItem *item) {
+ return item != d->label && item != d->image;
+ });
+ if (bottomMostFosterChildIt != paintOrderChildItems.constEnd()) {
+ const QQuickItem *bottomMostFosterChild = *bottomMostFosterChildIt;
+ if (d->label)
+ d->label->stackBefore(bottomMostFosterChild);
+ if (d->image)
+ d->image->stackBefore(bottomMostFosterChild);
+ }
}
void QQuickIconLabel::geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry)