aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.qmake.conf2
-rw-r--r--src/imports/imports.pro2
-rw-r--r--src/qml/qml/qqmlcomponent.cpp10
-rw-r--r--src/qml/qml/qqmlcustomparser_p.h2
-rw-r--r--src/qml/qml/qqmlglobal_p.h4
-rw-r--r--src/qml/qml/qqmlpropertycache_p.h2
-rw-r--r--src/qml/qml/qqmlscript_p.h2
-rw-r--r--src/qml/qml/v8/qscriptisolate_p.h2
-rw-r--r--src/quick/doc/src/tutorial.qdoc2
-rw-r--r--src/quick/items/qquickgridview.cpp2
-rw-r--r--src/quick/items/qquickitem_p.h2
-rw-r--r--src/quick/items/qquicklistview.cpp2
-rw-r--r--src/quick/items/qquicktext.cpp5
-rw-r--r--src/quick/scenegraph/qsgcontext.cpp12
-rw-r--r--tests/auto/qmltest/text/tst_text.qml17
-rw-r--r--tests/auto/qmltest/textedit/tst_textedit.qml7
-rw-r--r--tests/auto/quick/qquicktext/data/elideBeforeMaximumLineCount.qml10
-rw-r--r--tests/auto/quick/qquicktext/tst_qquicktext.cpp14
18 files changed, 73 insertions, 26 deletions
diff --git a/.qmake.conf b/.qmake.conf
index 6aa780ca27..a7e09bffc3 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -1,4 +1,4 @@
load(qt_build_config)
CONFIG += qt_example_installs
-MODULE_VERSION = 5.1.0
+MODULE_VERSION = 5.1.1
diff --git a/src/imports/imports.pro b/src/imports/imports.pro
index 733c7c47bd..7a922a832e 100644
--- a/src/imports/imports.pro
+++ b/src/imports/imports.pro
@@ -16,4 +16,4 @@ qtHaveModule(quick) {
qtHaveModule(xmlpatterns) : SUBDIRS += xmllistmodel
-qtHaveModule(widgets) : SUBDIRS += widgets
+qtHaveModule(quick):qtHaveModule(widgets): SUBDIRS += widgets
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp
index ccef0a6bb6..1fa1c2382f 100644
--- a/src/qml/qml/qqmlcomponent.cpp
+++ b/src/qml/qml/qqmlcomponent.cpp
@@ -767,6 +767,11 @@ QQmlComponent::QQmlComponent(QQmlComponentPrivate &dd, QObject *parent)
If \a context is 0 (the default), it will create the instance in the
engine' s \l {QQmlEngine::rootContext()}{root context}.
+
+ The ownership of the returned object instance is determined by the QQmlEngine.
+ By default the caller has to take care that the object is eventually deleted.
+
+ \sa QQmlEngine::ObjectOwnership
*/
QObject *QQmlComponent::create(QQmlContext *context)
{
@@ -805,7 +810,10 @@ QObject *QQmlComponent::create(QQmlContext *context)
communicate information to an instantiated component, as it allows their
initial values to be configured before property bindings take effect.
- \sa completeCreate()
+ The ownership of the returned object instance is determined by the QQmlEngine.
+ By default the caller has to take care that the object is eventually deleted.
+
+ \sa completeCreate(), QQmlEngine::ObjectOwnership
*/
QObject *QQmlComponent::beginCreate(QQmlContext *publicContext)
{
diff --git a/src/qml/qml/qqmlcustomparser_p.h b/src/qml/qml/qqmlcustomparser_p.h
index 7a3fd47b46..3eaf99191d 100644
--- a/src/qml/qml/qqmlcustomparser_p.h
+++ b/src/qml/qml/qqmlcustomparser_p.h
@@ -149,7 +149,7 @@ private:
Flags m_flags;
friend class QQmlCompiler;
};
-Q_DECLARE_OPERATORS_FOR_FLAGS(QQmlCustomParser::Flags);
+Q_DECLARE_OPERATORS_FOR_FLAGS(QQmlCustomParser::Flags)
#if 0
#define QML_REGISTER_CUSTOM_TYPE(URI, VERSION_MAJ, VERSION_MIN, NAME, TYPE, CUSTOMTYPE) \
diff --git a/src/qml/qml/qqmlglobal_p.h b/src/qml/qml/qqmlglobal_p.h
index 19139ce920..114c076c60 100644
--- a/src/qml/qml/qqmlglobal_p.h
+++ b/src/qml/qml/qqmlglobal_p.h
@@ -344,8 +344,8 @@ protected:
QQmlApplication(QQmlApplicationPrivate &dd, QObject* parent=0);
private:
- Q_DISABLE_COPY(QQmlApplication);
- Q_DECLARE_PRIVATE(QQmlApplication);
+ Q_DISABLE_COPY(QQmlApplication)
+ Q_DECLARE_PRIVATE(QQmlApplication)
};
class QQmlApplicationPrivate : public QObjectPrivate
diff --git a/src/qml/qml/qqmlpropertycache_p.h b/src/qml/qml/qqmlpropertycache_p.h
index 63b8b79fd2..e9fc584a53 100644
--- a/src/qml/qml/qqmlpropertycache_p.h
+++ b/src/qml/qml/qqmlpropertycache_p.h
@@ -213,7 +213,7 @@ private:
friend class QQmlPropertyCache;
quint32 flags;
};
-Q_DECLARE_OPERATORS_FOR_FLAGS(QQmlPropertyRawData::Flags);
+Q_DECLARE_OPERATORS_FOR_FLAGS(QQmlPropertyRawData::Flags)
class QQmlPropertyData : public QQmlPropertyRawData
{
diff --git a/src/qml/qml/qqmlscript_p.h b/src/qml/qml/qqmlscript_p.h
index 54e7a67b65..250c71d6ac 100644
--- a/src/qml/qml/qqmlscript_p.h
+++ b/src/qml/qml/qqmlscript_p.h
@@ -512,7 +512,7 @@ public:
}
-Q_DECLARE_OPERATORS_FOR_FLAGS(QQmlScript::Object::ScriptBlock::Pragmas);
+Q_DECLARE_OPERATORS_FOR_FLAGS(QQmlScript::Object::ScriptBlock::Pragmas)
QT_END_NAMESPACE
diff --git a/src/qml/qml/v8/qscriptisolate_p.h b/src/qml/qml/v8/qscriptisolate_p.h
index d6326bf915..da35069e33 100644
--- a/src/qml/qml/v8/qscriptisolate_p.h
+++ b/src/qml/qml/v8/qscriptisolate_p.h
@@ -78,7 +78,7 @@ public:
}
private:
- Q_DISABLE_COPY(QScriptIsolate);
+ Q_DISABLE_COPY(QScriptIsolate)
const QV8Engine *m_engine;
const OperationMode m_mode;
};
diff --git a/src/quick/doc/src/tutorial.qdoc b/src/quick/doc/src/tutorial.qdoc
index 46125ede18..bd07c9a98d 100644
--- a/src/quick/doc/src/tutorial.qdoc
+++ b/src/quick/doc/src/tutorial.qdoc
@@ -32,7 +32,7 @@
\previouspage Introduction to the QML Language
\nextpage QML Tutorial 1 - Basic Types
-This tutorial gives an introduction to QML, the mark up language for Qt Quick. It doesn't cover everything;
+This tutorial gives an introduction to QML, the declarative language for Qt Quick. It doesn't cover everything;
the emphasis is on teaching the key principles, and features are introduced as needed.
Through the different steps of this tutorial we will learn about QML basic types, we will create our own QML component
diff --git a/src/quick/items/qquickgridview.cpp b/src/quick/items/qquickgridview.cpp
index f4e34da318..bc71a1c064 100644
--- a/src/quick/items/qquickgridview.cpp
+++ b/src/quick/items/qquickgridview.cpp
@@ -2575,7 +2575,7 @@ bool QQuickGridViewPrivate::needsRefillForAddedOrRemovedIndex(int modelIndex) co
This method forces the GridView to immediately respond to any outstanding
changes in the model.
- \since 5.1
+ \since QtQuick 2.1
\b Note: methods should only be called after the Component has completed.
*/
diff --git a/src/quick/items/qquickitem_p.h b/src/quick/items/qquickitem_p.h
index c71da3c330..87b4e01a74 100644
--- a/src/quick/items/qquickitem_p.h
+++ b/src/quick/items/qquickitem_p.h
@@ -894,7 +894,7 @@ QSGNode *QQuickItemPrivate::childContainerNode()
return groupNode;
}
-Q_DECLARE_OPERATORS_FOR_FLAGS(QQuickItemPrivate::ChangeTypes);
+Q_DECLARE_OPERATORS_FOR_FLAGS(QQuickItemPrivate::ChangeTypes)
QT_END_NAMESPACE
diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp
index c5e96a3122..4d42c9ece1 100644
--- a/src/quick/items/qquicklistview.cpp
+++ b/src/quick/items/qquicklistview.cpp
@@ -3118,7 +3118,7 @@ void QQuickListViewPrivate::translateAndTransitionItemsAfter(int afterModelIndex
This method forces the ListView to immediately respond to any outstanding
changes in the model.
- \since 5.1
+ \since QtQuick 2.1
\b Note: methods should only be called after the Component has completed.
*/
diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp
index cf9cb4224f..fbf46f51e4 100644
--- a/src/quick/items/qquicktext.cpp
+++ b/src/quick/items/qquicktext.cpp
@@ -954,7 +954,10 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const baseline)
// Create the remainder of the unwrapped lines up to maxLineCount to get the
// implicit width.
- if (line.isValid() && layoutText.at(line.textStart() + line.textLength()) != QChar::LineSeparator)
+ const int eol = line.isValid()
+ ? line.textStart() + line.textLength()
+ : layoutText.length();
+ if (eol < layoutText.length() && layoutText.at(eol) != QChar::LineSeparator)
line = layout.createLine();
for (; line.isValid() && unwrappedLineCount <= maxLineCount; ++unwrappedLineCount)
line = layout.createLine();
diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp
index 61fb1bc5b9..6d327b8d80 100644
--- a/src/quick/scenegraph/qsgcontext.cpp
+++ b/src/quick/scenegraph/qsgcontext.cpp
@@ -162,15 +162,13 @@ QSGContext::QSGContext(QObject *parent) :
QObject(*(new QSGContextPrivate), parent)
{
Q_D(QSGContext);
- static bool doSubpixel = qApp->arguments().contains(QLatin1String("--text-subpixel-antialiasing"));
- static bool doLowQualSubpixel = qApp->arguments().contains(QLatin1String("--text-subpixel-antialiasing-lowq"));
- static bool doGray = qApp->arguments().contains(QLatin1String("--text-gray-antialiasing"));
- if (doSubpixel)
+ QByteArray mode = qgetenv("QSG_DISTANCEFIELD_ANTIALIASING");
+ if (mode == "subpixel")
d->distanceFieldAntialiasing = QSGGlyphNode::HighQualitySubPixelAntialiasing;
- else if (doLowQualSubpixel)
+ else if (mode == "subpixel-lowq")
d->distanceFieldAntialiasing = QSGGlyphNode::LowQualitySubPixelAntialiasing;
- else if (doGray)
- d->distanceFieldAntialiasing = QSGGlyphNode::GrayAntialiasing;
+ else if (mode == "gray")
+ d->distanceFieldAntialiasing = QSGGlyphNode::GrayAntialiasing;
}
diff --git a/tests/auto/qmltest/text/tst_text.qml b/tests/auto/qmltest/text/tst_text.qml
index 87e9501ccd..b1d743f630 100644
--- a/tests/auto/qmltest/text/tst_text.qml
+++ b/tests/auto/qmltest/text/tst_text.qml
@@ -78,6 +78,13 @@ Item {
font.pixelSize: 18
}
+ Text {
+ id: txtlines
+ property string styledtextvalue: "Line 1<br>Line 2<br>Line 3"
+ text: "Line 1\nLine 2\nLine 3"
+ textFormat: Text.PlainText
+ }
+
TestCase {
name: "Text"
@@ -116,6 +123,16 @@ Item {
txtlinecount.width = 50;
compare(txtlinecount.lineCount, 3)
}
+ function test_linecounts() {
+ compare(txtlines.lineCount, 3)
+ txtlines.text = txtlines.styledtextvalue;
+ compare(txtlines.text, "Line 1<br>Line 2<br>Line 3")
+ tryCompare(txtlines, 'lineCount', 1)
+ txtlines.textFormat = Text.StyledText;
+ tryCompare(txtlines, 'lineCount', 3)
+ txtlines.textFormat = Text.RichText;
+ tryCompare(txtlines, 'lineCount', 3)
+ }
}
}
diff --git a/tests/auto/qmltest/textedit/tst_textedit.qml b/tests/auto/qmltest/textedit/tst_textedit.qml
index 6e5124253c..eb53eaa604 100644
--- a/tests/auto/qmltest/textedit/tst_textedit.qml
+++ b/tests/auto/qmltest/textedit/tst_textedit.qml
@@ -91,7 +91,7 @@ Item {
id: txtlines
property string styledtextvalue: "Line 1<br>Line 2<br>Line 3"
text: "Line 1\nLine 2\nLine 3"
- textFormat: Text.PlainText
+ textFormat: TextEdit.PlainText
}
TestCase {
@@ -180,10 +180,7 @@ Item {
txtlines.text = txtlines.styledtextvalue;
compare(txtlines.text, "Line 1<br>Line 2<br>Line 3")
tryCompare(txtlines, 'lineCount', 1)
- txtlines.textFormat = Text.StyledText;
- expectFail("", "QTBUG-31191")
- tryCompare(txtlines, 'lineCount', 3)
- txtlines.textFormat = Text.RichText;
+ txtlines.textFormat = TextEdit.RichText;
tryCompare(txtlines, 'lineCount', 3)
}
}
diff --git a/tests/auto/quick/qquicktext/data/elideBeforeMaximumLineCount.qml b/tests/auto/quick/qquicktext/data/elideBeforeMaximumLineCount.qml
new file mode 100644
index 0000000000..7f1ce705dd
--- /dev/null
+++ b/tests/auto/quick/qquicktext/data/elideBeforeMaximumLineCount.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+
+Text {
+ width: implicitWidth / 2
+ height: implicitHeight / 2
+ elide: Text.ElideRight
+ maximumLineCount: 4
+
+ text: "Line one\nLine two\nLine three\nLine four"
+}
diff --git a/tests/auto/quick/qquicktext/tst_qquicktext.cpp b/tests/auto/quick/qquicktext/tst_qquicktext.cpp
index b95a646bd6..fb3b62b8d2 100644
--- a/tests/auto/quick/qquicktext/tst_qquicktext.cpp
+++ b/tests/auto/quick/qquicktext/tst_qquicktext.cpp
@@ -149,6 +149,8 @@ private slots:
void htmlLists();
void htmlLists_data();
+ void elideBeforeMaximumLineCount();
+
private:
QStringList standard;
QStringList richText;
@@ -3638,6 +3640,18 @@ void tst_qquicktext::htmlLists_data()
QTest::newRow("unordered list bad") << "<ul type=\"bad\"><li>one</li><li>two</li></ul>" << 2;
}
+void tst_qquicktext::elideBeforeMaximumLineCount()
+{ // QTBUG-31471
+ QQmlComponent component(&engine, testFile("elideBeforeMaximumLineCount.qml"));
+
+ QScopedPointer<QObject> object(component.create());
+
+ QQuickText *item = qobject_cast<QQuickText *>(object.data());
+ QVERIFY(item);
+
+ QCOMPARE(item->lineCount(), 2);
+}
+
QTEST_MAIN(tst_qquicktext)
#include "tst_qquicktext.moc"