summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-10-29 05:46:52 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-10-29 05:46:52 (GMT)
commit60d37c9c2f99ee1b10293c4dbc0264664dd8cad0 (patch)
tree0927df98b56de254d784dc2efe6c722607b36dfe /src/declarative
parenta864e1501f211b400046fe2331aa6fe3c4eb4d18 (diff)
parent95ef9a3d7eb851d47dabe3248672ea03e5faa0ce (diff)
downloadQt-60d37c9c2f99ee1b10293c4dbc0264664dd8cad0.zip
Qt-60d37c9c2f99ee1b10293c4dbc0264664dd8cad0.tar.gz
Qt-60d37c9c2f99ee1b10293c4dbc0264664dd8cad0.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: (28 commits) Regression: horizontal alignment bug with single line text Add 'skip' property that QML visual tests can use Almost all visual tests pass on linux Disable WebView visualtests Clean up repeater visual tests Clean up QML Rect visual tests Update qdeclarativespringanimation visual tests Regression: QML fonts look bad on Mac with font smoothing on Clean up qdeclarativesmoothedanimation visual tests Clean up qdeclarativepositioner tests Update visuals for qdeclarativepathview visual tests Clean up qdeclarativeparticles visual test Mark qdeclarativegridview autotests as expect-fail Clean up qdeclarativeflickable visual tests Clean up qdeclarativeboarderimage visual tests Add a test for multiline text alignment Update when text changes to "" Shrink and update qdeclarativetext visual tests Clean up package views visual test Clean up qmlvisual/qdeclarativetextinput visual tests ...
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 2381172..0e31a20 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);