summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorA-Team <ateam@pad.test.qt.nokia.com>2010-10-29 22:00:20 (GMT)
committerA-Team <ateam@pad.test.qt.nokia.com>2010-10-29 22:00:20 (GMT)
commit69df8210d4c2a144e7e2da43abb11e3ddb524265 (patch)
tree7dfdf6fbf269224693e16e48fc4f532883a0e324 /src/declarative
parentd5a44f3489b48027db3f0955190446e0324d6bf5 (diff)
parent90f885a7fea4afb719629967567353db84085ea0 (diff)
downloadQt-69df8210d4c2a144e7e2da43abb11e3ddb524265.zip
Qt-69df8210d4c2a144e7e2da43abb11e3ddb524265.tar.gz
Qt-69df8210d4c2a144e7e2da43abb11e3ddb524265.tar.bz2
Merge branch '4.7-upstream' into 4.7-doc
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/debugger/qdeclarativedebugservice.cpp12
-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
6 files changed, 29 insertions, 55 deletions
diff --git a/src/declarative/debugger/qdeclarativedebugservice.cpp b/src/declarative/debugger/qdeclarativedebugservice.cpp
index b98cd5d..c39da3d 100644
--- a/src/declarative/debugger/qdeclarativedebugservice.cpp
+++ b/src/declarative/debugger/qdeclarativedebugservice.cpp
@@ -204,13 +204,13 @@ QDeclarativeDebugServer *QDeclarativeDebugServer::instance()
bool ok = false;
// format: qmljsdebugger=port:3768[,block]
- if (!appD->qmljsDebugArguments.isEmpty()) {
+ if (!appD->qmljsDebugArgumentsString().isEmpty()) {
- if (appD->qmljsDebugArguments.indexOf(QLatin1String("port:")) == 0) {
- int separatorIndex = appD->qmljsDebugArguments.indexOf(QLatin1Char(','));
- port = appD->qmljsDebugArguments.mid(5, separatorIndex - 5).toInt(&ok);
+ if (appD->qmljsDebugArgumentsString().indexOf(QLatin1String("port:")) == 0) {
+ int separatorIndex = appD->qmljsDebugArgumentsString().indexOf(QLatin1Char(','));
+ port = appD->qmljsDebugArgumentsString().mid(5, separatorIndex - 5).toInt(&ok);
}
- block = appD->qmljsDebugArguments.contains(QLatin1String("block"));
+ block = appD->qmljsDebugArgumentsString().contains(QLatin1String("block"));
if (ok) {
server = new QDeclarativeDebugServer(port);
@@ -221,7 +221,7 @@ QDeclarativeDebugServer *QDeclarativeDebugServer::instance()
} else {
qWarning(QString::fromAscii("QDeclarativeDebugServer: Ignoring \"-qmljsdebugger=%1\". "
"Format is -qmljsdebugger=port:<port>[,block]").arg(
- appD->qmljsDebugArguments).toAscii().constData());
+ appD->qmljsDebugArgumentsString()).toAscii().constData());
}
}
#endif
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);