aboutsummaryrefslogtreecommitdiffstats
path: root/src/templates
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2016-03-10 17:29:29 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2016-03-11 12:13:01 +0000
commitb6cb8ca2db847912fe70b66217d07ac6d1577811 (patch)
tree6c4b7b39eb77e5ba481e1e9f82fd5f771b1244c9 /src/templates
parent96d5ffe51e8196ea60aab62a480f036daae67a63 (diff)
Fix popup fonts
This is a partial revert of a405919. This change makes popups inherit the window font instead of the parent item font. Change-Id: Ie360e3831aadbd167859e17d381edf3a28945300 Task-number: QTBUG-50984 Task-number: QTBUG-51696 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com> Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
Diffstat (limited to 'src/templates')
-rw-r--r--src/templates/qquickapplicationwindow.cpp2
-rw-r--r--src/templates/qquickcontrol.cpp16
-rw-r--r--src/templates/qquickpopup.cpp4
3 files changed, 4 insertions, 18 deletions
diff --git a/src/templates/qquickapplicationwindow.cpp b/src/templates/qquickapplicationwindow.cpp
index 309c8d3a..e702c785 100644
--- a/src/templates/qquickapplicationwindow.cpp
+++ b/src/templates/qquickapplicationwindow.cpp
@@ -420,7 +420,7 @@ void QQuickApplicationWindowPrivate::updateFont(const QFont &f)
const bool changed = font != f;
font = f;
- QQuickControlPrivate::updateFontRecur(q->contentItem(), f);
+ QQuickControlPrivate::updateFontRecur(q->QQuickWindow::contentItem(), f);
if (changed)
emit q->fontChanged();
diff --git a/src/templates/qquickcontrol.cpp b/src/templates/qquickcontrol.cpp
index f33a6fb2..2f1eb18f 100644
--- a/src/templates/qquickcontrol.cpp
+++ b/src/templates/qquickcontrol.cpp
@@ -230,12 +230,7 @@ QFont QQuickControlPrivate::naturalControlFont(const QQuickItem *q)
QQuickItem *p = q->parentItem();
bool found = false;
while (p) {
- if (QQuickPopupItem *qpi = qobject_cast<QQuickPopupItem *>(p)) {
- if (const QQuickPopup *qp = qobject_cast<const QQuickPopup *>(qpi->parent())) {
- p = qp->parentItem();
- continue;
- }
- } else if (QQuickControl *qc = qobject_cast<QQuickControl *>(p)) {
+ if (QQuickControl *qc = qobject_cast<QQuickControl *>(p)) {
naturalFont = qc->font();
found = true;
break;
@@ -310,13 +305,6 @@ void QQuickControlPrivate::updateFontRecur(QQuickItem *item, const QFont &f)
else
QQuickControlPrivate::updateFontRecur(child, f);
}
-
- foreach (QObject *child, item->children()) {
- if (QQuickPopup *qp = qobject_cast<QQuickPopup *>(child)) {
- if (QQuickPopupItem *qpi = qobject_cast<QQuickPopupItem *>(qp->popupItem()))
- QQuickControlPrivate::updateFontRecur(qpi, f);
- }
- }
}
QString QQuickControl::accessibleName() const
@@ -377,7 +365,7 @@ void QQuickControl::itemChange(QQuickItem::ItemChange change, const QQuickItem::
{
Q_D(QQuickControl);
QQuickItem::itemChange(change, value);
- if (change == ItemParentHasChanged && isComponentComplete()) {
+ if (change == ItemParentHasChanged && value.item) {
d->resolveFont();
if (!d->hasLocale)
d->locale = QQuickControlPrivate::calcLocale(d->parentItem);
diff --git a/src/templates/qquickpopup.cpp b/src/templates/qquickpopup.cpp
index 4fbcb069..90c17e58 100644
--- a/src/templates/qquickpopup.cpp
+++ b/src/templates/qquickpopup.cpp
@@ -1177,10 +1177,8 @@ void QQuickPopup::setParentItem(QQuickItem *parent)
d->parentItem = parent;
if (d->positioner.parentItem())
d->positioner.setParentItem(parent);
- if (parent) {
- QQuickControlPrivate::updateFontRecur(d->popupItem, QQuickControlPrivate::naturalControlFont(parent));
+ if (parent)
QQuickControlPrivate::updateLocaleRecur(d->popupItem, QQuickControlPrivate::calcLocale(parent));
- }
emit parentChanged();
}
}