summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-10-29 16:06:48 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-10-29 16:06:48 (GMT)
commit7db218d6860a04df238735ff692010f0910d0c92 (patch)
treead8033623855b3afb17752552ca56b096c1b9159 /src/declarative
parent8943b44c38ee6244c4a5b190c2b35879b1921843 (diff)
parentc02ef9eb331f03dbd59d2fd938c53b54f5c65cea (diff)
downloadQt-7db218d6860a04df238735ff692010f0910d0c92.zip
Qt-7db218d6860a04df238735ff692010f0910d0c92.tar.gz
Qt-7db218d6860a04df238735ff692010f0910d0c92.tar.bz2
Merge branch 4.7 into qt-master-from-4.7
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/graphicsitems/qdeclarativetext.cpp56
-rw-r--r--src/declarative/util/qdeclarativestate_p.h4
-rw-r--r--src/declarative/util/qdeclarativestategroup_p.h2
-rw-r--r--src/declarative/util/qdeclarativetransition_p.h2
-rw-r--r--src/declarative/util/qdeclarativeview.cpp8
5 files changed, 23 insertions, 49 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp
index 0717b78..03c9765 100644
--- a/src/declarative/graphicsitems/qdeclarativetext.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetext.cpp
@@ -221,6 +221,7 @@ void QDeclarativeTextPrivate::updateSize()
if (text.isEmpty()) {
q->setImplicitHeight(fm.height());
emit q->paintedSizeChanged();
+ q->update();
return;
}
@@ -287,16 +288,16 @@ QSize QDeclarativeTextPrivate::setupTextLayout()
Q_Q(QDeclarativeText);
layout.setCacheEnabled(true);
- int height = 0;
- qreal widthUsed = 0;
+ qreal height = 0;
qreal lineWidth = 0;
//set manual width
- if ((wrapMode != QDeclarativeText::NoWrap || elideMode != QDeclarativeText::ElideNone) && q->widthValid())
+ if (q->widthValid())
lineWidth = q->width();
QTextOption textOption = layout.textOption();
textOption.setWrapMode(QTextOption::WrapMode(wrapMode));
+ textOption.setAlignment(Qt::Alignment(hAlign));
layout.setTextOption(textOption);
layout.beginLayout();
@@ -305,37 +306,15 @@ QSize QDeclarativeTextPrivate::setupTextLayout()
if (!line.isValid())
break;
- if ((wrapMode != QDeclarativeText::NoWrap || elideMode != QDeclarativeText::ElideNone) && q->widthValid())
+ if (q->widthValid()) {
line.setLineWidth(lineWidth);
- }
- layout.endLayout();
-
- for (int i = 0; i < layout.lineCount(); ++i) {
- QTextLine line = layout.lineAt(i);
- widthUsed = qMax(widthUsed, line.naturalTextWidth());
- }
-
- qreal layoutWidth = q->widthValid()?q->width():widthUsed;
-
- int x = 0;
- for (int i = 0; i < layout.lineCount(); ++i) {
- QTextLine line = layout.lineAt(i);
- line.setPosition(QPointF(0, height));
- height += int(line.height());
-
- if (!cacheAllTextAsImage) {
- if (hAlign == QDeclarativeText::AlignLeft) {
- x = 0;
- } else if (hAlign == QDeclarativeText::AlignRight) {
- x = layoutWidth - (int)line.naturalTextWidth();
- } else if (hAlign == QDeclarativeText::AlignHCenter) {
- x = (layoutWidth - (int)line.naturalTextWidth()) / 2;
- }
- line.setPosition(QPoint(x, (int)line.y()));
+ line.setPosition(QPointF(0, height));
+ height += line.height();
}
}
+ layout.endLayout();
- return QSize(qCeil(widthUsed), height);
+ return QSize(qCeil(layout.boundingRect().width()), layout.boundingRect().height());
}
/*!
@@ -347,19 +326,6 @@ QPixmap QDeclarativeTextPrivate::textLayoutImage(bool drawStyle)
//do layout
QSize size = layedOutTextSize;
- int x = 0;
- for (int i = 0; i < layout.lineCount(); ++i) {
- QTextLine line = layout.lineAt(i);
- if (hAlign == QDeclarativeText::AlignLeft) {
- x = 0;
- } else if (hAlign == QDeclarativeText::AlignRight) {
- x = size.width() - (int)line.naturalTextWidth();
- } else if (hAlign == QDeclarativeText::AlignHCenter) {
- x = (size.width() - (int)line.naturalTextWidth()) / 2;
- }
- line.setPosition(QPoint(x, (int)line.y()));
- }
-
//paint text
QPixmap img(size);
if (!size.isEmpty()) {
@@ -901,7 +867,7 @@ void QDeclarativeText::setStyleColor(const QColor &color)
and \c Text.AlignVCenter.
Note that for a single line of text, the size of the text is the area of the text. In this common case,
- all alignments are equivalent. If you want the text to be, say, centered in it parent, then you will
+ all alignments are equivalent. If you want the text to be, say, centered in its parent, then you will
need to either modify the Item::anchors, or set horizontalAlignment to Text.AlignHCenter and bind the width to
that of the parent.
*/
@@ -1147,7 +1113,7 @@ void QDeclarativeText::geometryChanged(const QRectF &newGeometry, const QRectF &
if ((!d->internalWidthUpdate && newGeometry.width() != oldGeometry.width())
&& (d->wrapMode != QDeclarativeText::NoWrap
|| d->elideMode != QDeclarativeText::ElideNone
- || d->hAlign != Qt::AlignLeft)) {
+ || d->hAlign != QDeclarativeText::AlignLeft)) {
if (d->singleline && d->elideMode != QDeclarativeText::ElideNone && widthValid()) {
// We need to re-elide
d->updateLayout();
diff --git a/src/declarative/util/qdeclarativestate_p.h b/src/declarative/util/qdeclarativestate_p.h
index d01af4e..fc7c940 100644
--- a/src/declarative/util/qdeclarativestate_p.h
+++ b/src/declarative/util/qdeclarativestate_p.h
@@ -114,7 +114,7 @@ public:
class QDeclarativeStateGroup;
class QDeclarativeState;
class QDeclarativeStateOperationPrivate;
-class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeStateOperation : public QObject
+class Q_DECLARATIVE_EXPORT QDeclarativeStateOperation : public QObject
{
Q_OBJECT
public:
@@ -139,7 +139,7 @@ typedef QDeclarativeStateOperation::ActionList QDeclarativeStateActions;
class QDeclarativeTransition;
class QDeclarativeStatePrivate;
-class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeState : public QObject
+class Q_DECLARATIVE_EXPORT QDeclarativeState : public QObject
{
Q_OBJECT
diff --git a/src/declarative/util/qdeclarativestategroup_p.h b/src/declarative/util/qdeclarativestategroup_p.h
index 0222cf2..cac23f4 100644
--- a/src/declarative/util/qdeclarativestategroup_p.h
+++ b/src/declarative/util/qdeclarativestategroup_p.h
@@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
class QDeclarativeStateGroupPrivate;
-class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeStateGroup : public QObject, public QDeclarativeParserStatus
+class Q_DECLARATIVE_EXPORT QDeclarativeStateGroup : public QObject, public QDeclarativeParserStatus
{
Q_OBJECT
Q_INTERFACES(QDeclarativeParserStatus)
diff --git a/src/declarative/util/qdeclarativetransition_p.h b/src/declarative/util/qdeclarativetransition_p.h
index 5b20cb2..fc7a577 100644
--- a/src/declarative/util/qdeclarativetransition_p.h
+++ b/src/declarative/util/qdeclarativetransition_p.h
@@ -57,7 +57,7 @@ QT_MODULE(Declarative)
class QDeclarativeAbstractAnimation;
class QDeclarativeTransitionPrivate;
class QDeclarativeTransitionManager;
-class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeTransition : public QObject
+class Q_DECLARATIVE_EXPORT QDeclarativeTransition : public QObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QDeclarativeTransition)
diff --git a/src/declarative/util/qdeclarativeview.cpp b/src/declarative/util/qdeclarativeview.cpp
index 163f626..c4d8dde 100644
--- a/src/declarative/util/qdeclarativeview.cpp
+++ b/src/declarative/util/qdeclarativeview.cpp
@@ -72,6 +72,7 @@
QT_BEGIN_NAMESPACE
DEFINE_BOOL_CONFIG_OPTION(frameRateDebug, QML_SHOW_FRAMERATE)
+extern Q_GUI_EXPORT bool qt_applefontsmoothing_enabled;
class QDeclarativeScene : public QGraphicsScene
{
@@ -696,7 +697,14 @@ void QDeclarativeView::paintEvent(QPaintEvent *event)
if (frameRateDebug())
time = d->frameTimer.restart();
+#ifdef Q_WS_MAC
+ bool oldSmooth = qt_applefontsmoothing_enabled;
+ qt_applefontsmoothing_enabled = false;
+#endif
QGraphicsView::paintEvent(event);
+#ifdef Q_WS_MAC
+ qt_applefontsmoothing_enabled = oldSmooth;
+#endif
QDeclarativeDebugTrace::endRange(QDeclarativeDebugTrace::Painting);