summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems/qdeclarativetext.cpp
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2011-01-19 01:40:49 (GMT)
committerMartin Jones <martin.jones@nokia.com>2011-01-19 01:40:49 (GMT)
commitebd4bc73c46c2962742a682b6a391fb68c482aec (patch)
tree3045a1af9e65ca6500437d4e90ccfd3637fb6976 /src/declarative/graphicsitems/qdeclarativetext.cpp
parent9c1e67d83f6175f339e6771be05ee60ba72426b3 (diff)
parent5d9738ed88da269033333299c16558882d346514 (diff)
downloadQt-ebd4bc73c46c2962742a682b6a391fb68c482aec.zip
Qt-ebd4bc73c46c2962742a682b6a391fb68c482aec.tar.gz
Qt-ebd4bc73c46c2962742a682b6a391fb68c482aec.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into qtquick11
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativetext.cpp')
-rw-r--r--src/declarative/graphicsitems/qdeclarativetext.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp
index 3911d65..64925d0 100644
--- a/src/declarative/graphicsitems/qdeclarativetext.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetext.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -814,19 +814,28 @@ QDeclarativeText::~QDeclarativeText()
QFont QDeclarativeText::font() const
{
Q_D(const QDeclarativeText);
- return d->font;
+ return d->sourceFont;
}
void QDeclarativeText::setFont(const QFont &font)
{
Q_D(QDeclarativeText);
- if (d->font == font)
+ if (d->sourceFont == font)
return;
+ d->sourceFont = font;
+ QFont oldFont = d->font;
d->font = font;
- d->updateLayout();
+ if (d->font.pointSizeF() != -1) {
+ // 0.5pt resolution
+ qreal size = qRound(d->font.pointSizeF()*2.0);
+ d->font.setPointSizeF(size/2.0);
+ }
+
+ if (oldFont != d->font)
+ d->updateLayout();
- emit fontChanged(d->font);
+ emit fontChanged(d->sourceFont);
}
/*!