aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@theqtcompany.com>2015-06-04 10:24:46 +0200
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2015-06-04 10:28:48 +0200
commit9556f6d075b61fa95d6e1057f305e522a26f71d6 (patch)
tree53190472453390810c47b9b5a47b23188a00267e
parent42ffe9b193a5bd958b0853233fd0d94170722bd1 (diff)
parent1fd0cdc6a2e01775d8a79c6614910cc5a2fbf2b3 (diff)
Merge remote-tracking branch 'origin/5.5' into dev
Conflicts: src/qml/jsruntime/qv4engine_p.h src/quick/items/qquickitemsmodule.cpp src/quick/items/qquicktext.cpp src/quick/util/qquickpixmapcache.cpp tests/auto/quick/qquickwindow/tst_qquickwindow.cpp Change-Id: I90ecaad6a4bfaa4f36149a7463f4d7141f4a516a
-rw-r--r--examples/qml/qml-i18n/i18n/qml_en_AU.ts4
-rw-r--r--examples/qml/qml-i18n/i18n/qml_fr.ts4
-rw-r--r--examples/quick/demos/calqlatr/content/Display.qml2
-rw-r--r--examples/quick/rendercontrol/window_multithreaded.cpp12
-rw-r--r--examples/quick/rendercontrol/window_singlethreaded.cpp50
-rw-r--r--examples/quick/rendercontrol/window_singlethreaded.h3
-rw-r--r--src/3rdparty/masm/stubs/ExecutableAllocator.h3
-rw-r--r--src/3rdparty/masm/wtf/OSAllocatorWinRT.cpp2
-rw-r--r--src/imports/folderlistmodel/fileinfothread.cpp2
-rw-r--r--src/qml/compiler/qqmlirbuilder.cpp2
-rw-r--r--src/qml/compiler/qv4codegen.cpp2
-rw-r--r--src/qml/compiler/qv4compileddata_p.h2
-rw-r--r--src/qml/compiler/qv4compiler.cpp2
-rw-r--r--src/qml/doc/snippets/delegatemodel/visualdatagroup.qml11
-rw-r--r--src/qml/doc/snippets/delegatemodel/visualdatamodel.qml3
-rw-r--r--src/qml/doc/snippets/delegatemodel/visualdatamodel_rootindex/view.qml3
-rw-r--r--src/qml/jsruntime/qv4arraydata.cpp5
-rw-r--r--src/qml/jsruntime/qv4engine.cpp8
-rw-r--r--src/qml/jsruntime/qv4engine_p.h5
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper.cpp49
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper_p.h20
-rw-r--r--src/qml/memory/qv4mm.cpp2
-rw-r--r--src/qml/qml/qqmldata_p.h4
-rw-r--r--src/qml/qml/qqmlimport.cpp10
-rw-r--r--src/qml/qml/qqmlvmemetaobject.cpp13
-rw-r--r--src/qml/qml/qqmlxmlhttprequest.cpp2
-rw-r--r--src/qml/types/qquickpackage.cpp4
-rw-r--r--src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc35
-rw-r--r--src/quick/doc/src/qmltypereference.qdoc12
-rw-r--r--src/quick/items/qquickborderimage.cpp71
-rw-r--r--src/quick/items/qquickdroparea.cpp20
-rw-r--r--src/quick/items/qquickdroparea_p.h1
-rw-r--r--src/quick/items/qquickframebufferobject.cpp11
-rw-r--r--src/quick/items/qquickimage.cpp11
-rw-r--r--src/quick/items/qquickimage_p.h2
-rw-r--r--src/quick/items/qquickimagebase.cpp29
-rw-r--r--src/quick/items/qquickimagebase_p.h4
-rw-r--r--src/quick/items/qquickimagebase_p_p.h6
-rw-r--r--src/quick/items/qquickitem.cpp14
-rw-r--r--src/quick/items/qquickitemsmodule.cpp1
-rw-r--r--src/quick/items/qquickrendercontrol.cpp5
-rw-r--r--src/quick/items/qquickscreen.cpp27
-rw-r--r--src/quick/items/qquickshadereffectnode.cpp28
-rw-r--r--src/quick/items/qquicktext.cpp41
-rw-r--r--src/quick/items/qquicktextedit.cpp16
-rw-r--r--src/quick/items/qquicktextinput.cpp13
-rw-r--r--src/quick/items/qquickwindow.cpp37
-rw-r--r--src/quick/items/qquickwindow_p.h3
-rw-r--r--src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp8
-rw-r--r--src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h7
-rw-r--r--src/quick/scenegraph/coreapi/qsgnode.cpp14
-rw-r--r--src/quick/scenegraph/qsgcontext.cpp10
-rw-r--r--src/quick/scenegraph/qsgrenderloop.cpp3
-rw-r--r--src/quick/scenegraph/qsgthreadedrenderloop.cpp7
-rw-r--r--src/quick/scenegraph/qsgwindowsrenderloop.cpp1
-rw-r--r--src/quick/util/qquickanimation.cpp4
-rw-r--r--src/quick/util/qquickimageprovider.h6
-rw-r--r--src/quick/util/qquickpixmapcache.cpp104
-rw-r--r--src/quick/util/qquickpixmapcache_p.h8
-rw-r--r--src/quick/util/qquicksmoothedanimation.cpp2
-rw-r--r--src/quick/util/qquickspringanimation.cpp2
-rw-r--r--src/quick/util/qquicktimeline.cpp2
-rw-r--r--src/quick/util/qquickvaluetypes_p.h14
-rw-r--r--src/quickwidgets/qquickwidget.cpp16
-rw-r--r--tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler.pro15
-rw-r--r--tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/data/test.qml (renamed from tests/auto/qml/debugger/qqmldebuggingenabler/data/test.qml)0
-rw-r--r--tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/qqmldebuggingenabler.pro13
-rw-r--r--tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/tst_qqmldebuggingenabler.cpp (renamed from tests/auto/qml/debugger/qqmldebuggingenabler/tst_qqmldebuggingenabler.cpp)25
-rw-r--r--tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenablerserver/qqmldebuggingenablerserver.cpp66
-rw-r--r--tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenablerserver/qqmldebuggingenablerserver.pro11
-rw-r--r--tests/auto/qml/qjsengine/tst_qjsengine.cpp21
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/statusText.qml2
-rw-r--r--tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp29
-rw-r--r--tests/auto/quick/qquicktext/data/implicitSizes.qml99
-rw-r--r--tests/auto/quick/qquicktext/tst_qquicktext.cpp57
-rw-r--r--tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp2
-rw-r--r--tests/auto/quick/qquickwindow/tst_qquickwindow.cpp139
-rw-r--r--tests/auto/quick/shared/viewtestutil.cpp4
-rw-r--r--tests/manual/highdpi/BorderImage.pngbin0 -> 9420 bytes
-rw-r--r--tests/manual/highdpi/BorderImage@2x.pngbin0 -> 15852 bytes
-rw-r--r--tests/manual/highdpi/TiledBorderImage.pngbin0 -> 2029 bytes
-rw-r--r--tests/manual/highdpi/TiledBorderImage@2x.pngbin0 -> 11799 bytes
-rw-r--r--tests/manual/highdpi/borderimage.qml99
-rw-r--r--tools/qmllint/main.cpp6
84 files changed, 1096 insertions, 316 deletions
diff --git a/examples/qml/qml-i18n/i18n/qml_en_AU.ts b/examples/qml/qml-i18n/i18n/qml_en_AU.ts
index e991affe7f..047817d006 100644
--- a/examples/qml/qml-i18n/i18n/qml_en_AU.ts
+++ b/examples/qml/qml-i18n/i18n/qml_en_AU.ts
@@ -2,9 +2,9 @@
<!DOCTYPE TS>
<TS version="2.0" language="en_AU" sourcelanguage="en">
<context>
- <name>i18n</name>
+ <name>qml-i18n</name>
<message>
- <location filename="../i18n.qml" line="30"/>
+ <location filename="../qml-i18n.qml" line="56"/>
<source>Hello</source>
<translation>G&apos;day</translation>
</message>
diff --git a/examples/qml/qml-i18n/i18n/qml_fr.ts b/examples/qml/qml-i18n/i18n/qml_fr.ts
index 1784914f42..41ca3a9194 100644
--- a/examples/qml/qml-i18n/i18n/qml_fr.ts
+++ b/examples/qml/qml-i18n/i18n/qml_fr.ts
@@ -2,9 +2,9 @@
<!DOCTYPE TS>
<TS version="2.0" language="fr" sourcelanguage="en">
<context>
- <name>i18n</name>
+ <name>qml-i18n</name>
<message>
- <location filename="../qml-i18n.qml" line="30"/>
+ <location filename="../qml-i18n.qml" line="56"/>
<source>Hello</source>
<translation>Bonjour</translation>
</message>
diff --git a/examples/quick/demos/calqlatr/content/Display.qml b/examples/quick/demos/calqlatr/content/Display.qml
index 119e99602f..cf93d878bb 100644
--- a/examples/quick/demos/calqlatr/content/Display.qml
+++ b/examples/quick/demos/calqlatr/content/Display.qml
@@ -168,7 +168,7 @@ Item {
width: display.width
height: display.height - 50 - y
delegate: Item {
- height: 20
+ height: display.fontSize * 1.1
width: parent.width
Text {
id: operator
diff --git a/examples/quick/rendercontrol/window_multithreaded.cpp b/examples/quick/rendercontrol/window_multithreaded.cpp
index 9b6020a347..8de5a7776d 100644
--- a/examples/quick/rendercontrol/window_multithreaded.cpp
+++ b/examples/quick/rendercontrol/window_multithreaded.cpp
@@ -213,6 +213,16 @@ void QuickRenderer::aboutToQuit()
m_quit = true;
}
+class RenderControl : public QQuickRenderControl
+{
+public:
+ RenderControl(QWindow *w) : m_window(w) { }
+ QWindow *renderWindow(QPoint *offset) Q_DECL_OVERRIDE;
+
+private:
+ QWindow *m_window;
+};
+
WindowMultiThreaded::WindowMultiThreaded()
: m_qmlComponent(Q_NULLPTR),
m_rootItem(0),
@@ -239,7 +249,7 @@ WindowMultiThreaded::WindowMultiThreaded()
m_offscreenSurface->setFormat(m_context->format());
m_offscreenSurface->create();
- m_renderControl = new QQuickRenderControl(this);
+ m_renderControl = new RenderControl(this);
// Create a QQuickWindow that is associated with out render control. Note that this
// window never gets created or shown, meaning that it will never get an underlying
diff --git a/examples/quick/rendercontrol/window_singlethreaded.cpp b/examples/quick/rendercontrol/window_singlethreaded.cpp
index 5377c56376..1e81f08f7e 100644
--- a/examples/quick/rendercontrol/window_singlethreaded.cpp
+++ b/examples/quick/rendercontrol/window_singlethreaded.cpp
@@ -48,6 +48,7 @@
#include <QOpenGLBuffer>
#include <QOpenGLVertexArrayObject>
#include <QOffscreenSurface>
+#include <QScreen>
#include <QQmlEngine>
#include <QQmlComponent>
#include <QQuickItem>
@@ -55,11 +56,29 @@
#include <QQuickRenderControl>
#include <QCoreApplication>
+class RenderControl : public QQuickRenderControl
+{
+public:
+ RenderControl(QWindow *w) : m_window(w) { }
+ QWindow *renderWindow(QPoint *offset) Q_DECL_OVERRIDE;
+
+private:
+ QWindow *m_window;
+};
+
+QWindow *RenderControl::renderWindow(QPoint *offset)
+{
+ if (offset)
+ *offset = QPoint(0, 0);
+ return m_window;
+}
+
WindowSingleThreaded::WindowSingleThreaded()
: m_rootItem(0),
m_fbo(0),
m_quickInitialized(false),
- m_quickReady(false)
+ m_quickReady(false),
+ m_dpr(0)
{
setSurfaceType(QSurface::OpenGLSurface);
@@ -83,7 +102,7 @@ WindowSingleThreaded::WindowSingleThreaded()
m_cubeRenderer = new CubeRenderer(m_offscreenSurface);
- m_renderControl = new QQuickRenderControl(this);
+ m_renderControl = new RenderControl(this);
// Create a QQuickWindow that is associated with out render control. Note that this
// window never gets created or shown, meaning that it will never get an underlying
@@ -108,6 +127,11 @@ WindowSingleThreaded::WindowSingleThreaded()
connect(m_quickWindow, &QQuickWindow::sceneGraphInvalidated, this, &WindowSingleThreaded::destroyFbo);
connect(m_renderControl, &QQuickRenderControl::renderRequested, this, &WindowSingleThreaded::requestUpdate);
connect(m_renderControl, &QQuickRenderControl::sceneChanged, this, &WindowSingleThreaded::requestUpdate);
+
+ // Just recreating the FBO on resize is not sufficient, when moving between screens
+ // with different devicePixelRatio the QWindow size may remain the same but the FBO
+ // dimension is to change regardless.
+ connect(this, &QWindow::screenChanged, this, &WindowSingleThreaded::handleScreenChange);
}
WindowSingleThreaded::~WindowSingleThreaded()
@@ -139,7 +163,8 @@ void WindowSingleThreaded::createFbo()
{
// The scene graph has been initialized. It is now time to create an FBO and associate
// it with the QQuickWindow.
- m_fbo = new QOpenGLFramebufferObject(size() * devicePixelRatio(), QOpenGLFramebufferObject::CombinedDepthStencil);
+ m_dpr = devicePixelRatio();
+ m_fbo = new QOpenGLFramebufferObject(size() * m_dpr, QOpenGLFramebufferObject::CombinedDepthStencil);
m_quickWindow->setRenderTarget(m_fbo);
}
@@ -246,18 +271,31 @@ void WindowSingleThreaded::exposeEvent(QExposeEvent *)
}
}
-void WindowSingleThreaded::resizeEvent(QResizeEvent *)
+void WindowSingleThreaded::resizeFbo()
{
- // If this is a resize after the scene is up and running, recreate the fbo and the
- // Quick item and scene.
if (m_rootItem && m_context->makeCurrent(m_offscreenSurface)) {
delete m_fbo;
createFbo();
m_context->doneCurrent();
updateSizes();
+ render();
}
}
+void WindowSingleThreaded::resizeEvent(QResizeEvent *)
+{
+ // If this is a resize after the scene is up and running, recreate the fbo and the
+ // Quick item and scene.
+ if (m_fbo && m_fbo->size() != size() * devicePixelRatio())
+ resizeFbo();
+}
+
+void WindowSingleThreaded::handleScreenChange()
+{
+ if (m_dpr != devicePixelRatio())
+ resizeFbo();
+}
+
void WindowSingleThreaded::mousePressEvent(QMouseEvent *e)
{
// Use the constructor taking localPos and screenPos. That puts localPos into the
diff --git a/examples/quick/rendercontrol/window_singlethreaded.h b/examples/quick/rendercontrol/window_singlethreaded.h
index 5344199c18..534d6b9bc3 100644
--- a/examples/quick/rendercontrol/window_singlethreaded.h
+++ b/examples/quick/rendercontrol/window_singlethreaded.h
@@ -77,10 +77,12 @@ private slots:
void destroyFbo();
void render();
void requestUpdate();
+ void handleScreenChange();
private:
void startQuick(const QString &filename);
void updateSizes();
+ void resizeFbo();
QOpenGLContext *m_context;
QOffscreenSurface *m_offscreenSurface;
@@ -94,6 +96,7 @@ private:
bool m_quickReady;
QTimer m_updateTimer;
CubeRenderer *m_cubeRenderer;
+ qreal m_dpr;
};
#endif
diff --git a/src/3rdparty/masm/stubs/ExecutableAllocator.h b/src/3rdparty/masm/stubs/ExecutableAllocator.h
index f937f93025..5f7d5678ab 100644
--- a/src/3rdparty/masm/stubs/ExecutableAllocator.h
+++ b/src/3rdparty/masm/stubs/ExecutableAllocator.h
@@ -114,6 +114,9 @@ struct ExecutableAllocator {
#if !OS(WINRT)
DWORD oldProtect;
VirtualProtect(reinterpret_cast<void*>(roundAddr), size + (iaddr - roundAddr), PAGE_EXECUTE_READWRITE, &oldProtect);
+#else
+ (void)size; // suppress unused parameter warning
+ (void)roundAddr; // suppress unused parameter warning
#endif
#else
int mode = PROT_READ | PROT_EXEC;
diff --git a/src/3rdparty/masm/wtf/OSAllocatorWinRT.cpp b/src/3rdparty/masm/wtf/OSAllocatorWinRT.cpp
index ba251d2ecf..d684367ec6 100644
--- a/src/3rdparty/masm/wtf/OSAllocatorWinRT.cpp
+++ b/src/3rdparty/masm/wtf/OSAllocatorWinRT.cpp
@@ -55,7 +55,7 @@ void* OSAllocator::reserveAndCommit(size_t bytes, Usage usage, bool writable, bo
return reserveUncommitted(bytes, usage, writable, executable);
}
-void OSAllocator::commit(void* address, size_t bytes, bool writable, bool executable)
+void OSAllocator::commit(void*, size_t, bool, bool)
{
CRASH(); // Unimplemented
}
diff --git a/src/imports/folderlistmodel/fileinfothread.cpp b/src/imports/folderlistmodel/fileinfothread.cpp
index b085233f01..e1db7834ec 100644
--- a/src/imports/folderlistmodel/fileinfothread.cpp
+++ b/src/imports/folderlistmodel/fileinfothread.cpp
@@ -86,6 +86,8 @@ void FileInfoThread::removePath(const QString &path)
#ifndef QT_NO_FILESYSTEMWATCHER
if (!path.startsWith(QLatin1Char(':')))
watcher->removePath(path);
+#else
+ Q_UNUSED(path);
#endif
currentPath.clear();
}
diff --git a/src/qml/compiler/qqmlirbuilder.cpp b/src/qml/compiler/qqmlirbuilder.cpp
index 82206ed836..cc9da2817a 100644
--- a/src/qml/compiler/qqmlirbuilder.cpp
+++ b/src/qml/compiler/qqmlirbuilder.cpp
@@ -290,6 +290,7 @@ void Document::removeScriptPragmas(QString &script)
Document::Document(bool debugMode)
: jsModule(debugMode)
, program(0)
+ , indexOfRootObject(0)
, jsGenerator(&jsModule)
, unitFlags(0)
{
@@ -1318,6 +1319,7 @@ QV4::CompiledData::Unit *QmlUnitGenerator::generate(Document &output)
const int totalSize = unitSize + importSize + objectOffsetTableSize + objectsSize + output.jsGenerator.stringTable.sizeOfTableAndData();
char *data = (char*)malloc(totalSize);
memcpy(data, jsUnit, unitSize);
+ memset(data + unitSize, 0, totalSize - unitSize);
if (jsUnit != compilationUnit->data)
free(jsUnit);
jsUnit = 0;
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp
index 0d766c2e87..ea82d07e69 100644
--- a/src/qml/compiler/qv4codegen.cpp
+++ b/src/qml/compiler/qv4codegen.cpp
@@ -539,7 +539,7 @@ IR::Expr *Codegen::subscript(IR::Expr *base, IR::Expr *index)
IR::Expr *Codegen::argument(IR::Expr *expr)
{
- if (expr && !expr->asTemp() && !expr->asArgLocal()) {
+ if (expr && !expr->asTemp()) {
const unsigned t = _block->newTemp();
move(_block->TEMP(t), expr);
expr = _block->TEMP(t);
diff --git a/src/qml/compiler/qv4compileddata_p.h b/src/qml/compiler/qv4compileddata_p.h
index f46e27fe98..48324fbbc4 100644
--- a/src/qml/compiler/qv4compileddata_p.h
+++ b/src/qml/compiler/qv4compileddata_p.h
@@ -135,7 +135,7 @@ struct String
// uint16 strdata[]
static int calculateSize(const QString &str) {
- return (sizeof(String) + (str.length() + 1) * sizeof(quint16) + 7) & ~0x7;
+ return (sizeof(String) + str.length() * sizeof(quint16) + 7) & ~0x7;
}
};
diff --git a/src/qml/compiler/qv4compiler.cpp b/src/qml/compiler/qv4compiler.cpp
index 19ea7ef04d..9e4c7560c1 100644
--- a/src/qml/compiler/qv4compiler.cpp
+++ b/src/qml/compiler/qv4compiler.cpp
@@ -78,7 +78,7 @@ void QV4::Compiler::StringTableGenerator::serialize(CompiledData::Unit *unit)
QV4::CompiledData::String *s = (QV4::CompiledData::String*)(stringData);
s->flags = 0; // ###
s->size = qstr.length();
- memcpy(s + 1, qstr.constData(), (qstr.length() + 1)*sizeof(ushort));
+ memcpy(s + 1, qstr.constData(), qstr.length()*sizeof(ushort));
stringData += QV4::CompiledData::String::calculateSize(qstr);
}
diff --git a/src/qml/doc/snippets/delegatemodel/visualdatagroup.qml b/src/qml/doc/snippets/delegatemodel/visualdatagroup.qml
index ca72e16b35..85ac83ae52 100644
--- a/src/qml/doc/snippets/delegatemodel/visualdatagroup.qml
+++ b/src/qml/doc/snippets/delegatemodel/visualdatagroup.qml
@@ -39,11 +39,12 @@
****************************************************************************/
//![0]
import QtQuick 2.0
+import QtQml.Models 2.2
Rectangle {
width: 200; height: 100
- VisualDataModel {
+ DelegateModel {
id: visualModel
model: ListModel {
ListElement { name: "Apple" }
@@ -51,7 +52,7 @@ Rectangle {
}
groups: [
- VisualDataGroup { name: "selected" }
+ DelegateModelGroup { name: "selected" }
]
delegate: Rectangle {
@@ -61,14 +62,14 @@ Rectangle {
Text {
text: {
var text = "Name: " + name
- if (item.VisualDataModel.inSelected)
- text += " (" + item.VisualDataModel.selectedIndex + ")"
+ if (item.DelegateModel.inSelected)
+ text += " (" + item.DelegateModel.selectedIndex + ")"
return text;
}
}
MouseArea {
anchors.fill: parent
- onClicked: item.VisualDataModel.inSelected = !item.VisualDataModel.inSelected
+ onClicked: item.DelegateModel.inSelected = !item.DelegateModel.inSelected
}
}
}
diff --git a/src/qml/doc/snippets/delegatemodel/visualdatamodel.qml b/src/qml/doc/snippets/delegatemodel/visualdatamodel.qml
index cf6b5aafb9..438eafeed1 100644
--- a/src/qml/doc/snippets/delegatemodel/visualdatamodel.qml
+++ b/src/qml/doc/snippets/delegatemodel/visualdatamodel.qml
@@ -39,11 +39,12 @@
****************************************************************************/
//![0]
import QtQuick 2.0
+import QtQml.Models 2.2
Rectangle {
width: 200; height: 100
- VisualDataModel {
+ DelegateModel {
id: visualModel
model: ListModel {
ListElement { name: "Apple" }
diff --git a/src/qml/doc/snippets/delegatemodel/visualdatamodel_rootindex/view.qml b/src/qml/doc/snippets/delegatemodel/visualdatamodel_rootindex/view.qml
index f4e18f6ac0..719d16ff7d 100644
--- a/src/qml/doc/snippets/delegatemodel/visualdatamodel_rootindex/view.qml
+++ b/src/qml/doc/snippets/delegatemodel/visualdatamodel_rootindex/view.qml
@@ -39,13 +39,14 @@
****************************************************************************/
//![0]
import QtQuick 2.0
+import QtQml.Models 2.2
ListView {
id: view
width: 300
height: 400
- model: VisualDataModel {
+ model: DelegateModel {
model: dirModel
delegate: Rectangle {
diff --git a/src/qml/jsruntime/qv4arraydata.cpp b/src/qml/jsruntime/qv4arraydata.cpp
index f1c941b600..627aed0192 100644
--- a/src/qml/jsruntime/qv4arraydata.cpp
+++ b/src/qml/jsruntime/qv4arraydata.cpp
@@ -217,9 +217,8 @@ void ArrayData::ensureAttributes(Object *o)
void SimpleArrayData::markObjects(Heap::Base *d, ExecutionEngine *e)
{
Heap::SimpleArrayData *dd = static_cast<Heap::SimpleArrayData *>(d);
- uint l = dd->len;
- for (uint i = 0; i < l; ++i)
- dd->arrayData[i].mark(e);
+ for (uint i = 0; i < dd->len; ++i)
+ dd->arrayData[dd->mappedIndex(i)].mark(e);
}
ReturnedValue SimpleArrayData::get(const Heap::ArrayData *d, uint index)
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index d8c09d80a5..eacd4220cd 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -1223,6 +1223,8 @@ static QVariant toVariant(QV4::ExecutionEngine *e, const QV4::Value &value, int
return ld->d()->locale;
if (const QV4::DateObject *d = value.as<DateObject>())
return d->toQDateTime();
+ if (const QV4::ArrayBuffer *d = value.as<ArrayBuffer>())
+ return d->asByteArray();
// NOTE: since we convert QTime to JS Date, round trip will change the variant type (to QDateTime)!
QV4::ScopedObject o(scope, value);
@@ -1580,6 +1582,12 @@ QV4::ReturnedValue ExecutionEngine::metaTypeToJS(int type, const void *data)
return 0;
}
+void ExecutionEngine::assertObjectBelongsToEngine(const Heap::Base &baseObject)
+{
+ Q_ASSERT(!baseObject.vtable->isObject || static_cast<const Heap::Object&>(baseObject).internalClass->engine == this);
+ Q_UNUSED(baseObject);
+}
+
// Converts a JS value to a meta-type.
// data must point to a place that can store a value of the given type.
// Returns true if conversion succeeded, false otherwise.
diff --git a/src/qml/jsruntime/qv4engine_p.h b/src/qml/jsruntime/qv4engine_p.h
index 92376d55ea..79aafeb268 100644
--- a/src/qml/jsruntime/qv4engine_p.h
+++ b/src/qml/jsruntime/qv4engine_p.h
@@ -392,6 +392,8 @@ public:
bool metaTypeFromJS(const Value &value, int type, void *data);
QV4::ReturnedValue metaTypeToJS(int type, const void *data);
+ void assertObjectBelongsToEngine(const Heap::Base &baseObject);
+
private:
QmlExtensions *m_qmlExtensions;
};
@@ -432,6 +434,9 @@ void Heap::Base::mark(QV4::ExecutionEngine *engine)
Q_ASSERT(inUse());
if (isMarked())
return;
+#ifndef QT_NO_DEBUG
+ engine->assertObjectBelongsToEngine(*this);
+#endif
setMarkBit();
engine->pushForGC(this);
}
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp
index c421fae1ff..e985c62228 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper.cpp
+++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp
@@ -590,7 +590,7 @@ ReturnedValue QObjectWrapper::wrap(ExecutionEngine *engine, QObject *object)
} else if (ddata->jsWrapper.isUndefined() &&
(ddata->jsEngineId == engine->m_engineId || // We own the QObject
ddata->jsEngineId == 0 || // No one owns the QObject
- !ddata->hasTaintedV8Object)) { // Someone else has used the QObject, but it isn't tainted
+ !ddata->hasTaintedV4Object)) { // Someone else has used the QObject, but it isn't tainted
QV4::ScopedValue rv(scope, create(engine, object));
ddata->jsWrapper.set(scope.engine, rv);
@@ -601,11 +601,11 @@ ReturnedValue QObjectWrapper::wrap(ExecutionEngine *engine, QObject *object)
// If this object is tainted, we have to check to see if it is in our
// tainted object list
ScopedObject alternateWrapper(scope, (Object *)0);
- if (engine->m_multiplyWrappedQObjects && ddata->hasTaintedV8Object)
+ if (engine->m_multiplyWrappedQObjects && ddata->hasTaintedV4Object)
alternateWrapper = engine->m_multiplyWrappedQObjects->value(object);
// If our tainted handle doesn't exist or has been collected, and there isn't
- // a handle in the ddata, we can assume ownership of the ddata->v8object
+ // a handle in the ddata, we can assume ownership of the ddata->jsWrapper
if (ddata->jsWrapper.isUndefined() && !alternateWrapper) {
QV4::ScopedValue result(scope, create(engine, object));
ddata->jsWrapper.set(scope.engine, result);
@@ -617,14 +617,29 @@ ReturnedValue QObjectWrapper::wrap(ExecutionEngine *engine, QObject *object)
alternateWrapper = create(engine, object);
if (!engine->m_multiplyWrappedQObjects)
engine->m_multiplyWrappedQObjects = new MultiplyWrappedQObjectMap;
- engine->m_multiplyWrappedQObjects->insert(object, alternateWrapper);
- ddata->hasTaintedV8Object = true;
+ engine->m_multiplyWrappedQObjects->insert(object, alternateWrapper->d());
+ ddata->hasTaintedV4Object = true;
}
return alternateWrapper.asReturnedValue();
}
}
+void QObjectWrapper::markWrapper(QObject *object, ExecutionEngine *engine)
+{
+ if (QQmlData::wasDeleted(object))
+ return;
+
+ QQmlData *ddata = QQmlData::get(object);
+ if (!ddata)
+ return;
+
+ if (ddata->jsEngineId == engine->m_engineId)
+ ddata->jsWrapper.markOnce(engine);
+ else if (engine->m_multiplyWrappedQObjects && ddata->hasTaintedV4Object)
+ engine->m_multiplyWrappedQObjects->mark(object, engine);
+}
+
ReturnedValue QObjectWrapper::getProperty(QObject *object, ExecutionContext *ctx, int propertyIndex, bool captureRequired)
{
if (QQmlData::wasDeleted(object))
@@ -994,9 +1009,7 @@ static void markChildQObjectsRecursively(QObject *parent, QV4::ExecutionEngine *
QObject *child = children.at(i);
if (!child)
continue;
- QQmlData *ddata = QQmlData::get(child, /*create*/false);
- if (ddata)
- ddata->jsWrapper.markOnce(e);
+ QObjectWrapper::markWrapper(child, e);
markChildQObjectsRecursively(child, e);
}
}
@@ -1909,16 +1922,20 @@ Heap::QmlSignalHandler::QmlSignalHandler(QV4::ExecutionEngine *engine, QObject *
DEFINE_OBJECT_VTABLE(QmlSignalHandler);
-void MultiplyWrappedQObjectMap::insert(QObject *key, Object *value)
+void MultiplyWrappedQObjectMap::insert(QObject *key, Heap::Object *value)
{
- QHash<QObject*, Object*>::insert(key, value);
+ QV4::WeakValue v;
+ v.set(value->internalClass->engine, value);
+ QHash<QObject*, QV4::WeakValue>::insert(key, v);
connect(key, SIGNAL(destroyed(QObject*)), this, SLOT(removeDestroyedObject(QObject*)));
}
+
+
MultiplyWrappedQObjectMap::Iterator MultiplyWrappedQObjectMap::erase(MultiplyWrappedQObjectMap::Iterator it)
{
disconnect(it.key(), SIGNAL(destroyed(QObject*)), this, SLOT(removeDestroyedObject(QObject*)));
- return QHash<QObject*, Object*>::erase(it);
+ return QHash<QObject*, QV4::WeakValue>::erase(it);
}
void MultiplyWrappedQObjectMap::remove(QObject *key)
@@ -1929,9 +1946,17 @@ void MultiplyWrappedQObjectMap::remove(QObject *key)
erase(it);
}
+void MultiplyWrappedQObjectMap::mark(QObject *key, ExecutionEngine *engine)
+{
+ Iterator it = find(key);
+ if (it == end())
+ return;
+ it->markOnce(engine);
+}
+
void MultiplyWrappedQObjectMap::removeDestroyedObject(QObject *object)
{
- QHash<QObject*, Object*>::remove(object);
+ QHash<QObject*, QV4::WeakValue>::remove(object);
}
QT_END_NAMESPACE
diff --git a/src/qml/jsruntime/qv4qobjectwrapper_p.h b/src/qml/jsruntime/qv4qobjectwrapper_p.h
index 1308e304b6..ac7aad3378 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper_p.h
+++ b/src/qml/jsruntime/qv4qobjectwrapper_p.h
@@ -110,6 +110,7 @@ struct Q_QML_EXPORT QObjectWrapper : public Object
static bool setQmlProperty(ExecutionEngine *engine, QQmlContextData *qmlContext, QObject *object, String *name, RevisionMode revisionMode, const Value &value);
static ReturnedValue wrap(ExecutionEngine *engine, QObject *object);
+ static void markWrapper(QObject *object, ExecutionEngine *engine);
using Object::get;
@@ -173,22 +174,23 @@ struct QmlSignalHandler : public QV4::Object
};
class MultiplyWrappedQObjectMap : public QObject,
- private QHash<QObject*, Object*>
+ private QHash<QObject*, QV4::WeakValue>
{
Q_OBJECT
public:
- typedef QHash<QObject*, Object*>::ConstIterator ConstIterator;
- typedef QHash<QObject*, Object*>::Iterator Iterator;
+ typedef QHash<QObject*, QV4::WeakValue>::ConstIterator ConstIterator;
+ typedef QHash<QObject*, QV4::WeakValue>::Iterator Iterator;
- ConstIterator begin() const { return QHash<QObject*, Object*>::constBegin(); }
- Iterator begin() { return QHash<QObject*, Object*>::begin(); }
- ConstIterator end() const { return QHash<QObject*, Object*>::constEnd(); }
- Iterator end() { return QHash<QObject*, Object*>::end(); }
+ ConstIterator begin() const { return QHash<QObject*, QV4::WeakValue>::constBegin(); }
+ Iterator begin() { return QHash<QObject*, QV4::WeakValue>::begin(); }
+ ConstIterator end() const { return QHash<QObject*, QV4::WeakValue>::constEnd(); }
+ Iterator end() { return QHash<QObject*, QV4::WeakValue>::end(); }
- void insert(QObject *key, Object *value);
- Object *value(QObject *key) const { return QHash<QObject*, Object*>::value(key, 0); }
+ void insert(QObject *key, Heap::Object *value);
+ ReturnedValue value(QObject *key) const { return QHash<QObject*, QV4::WeakValue>::value(key).value(); }
Iterator erase(Iterator it);
void remove(QObject *key);
+ void mark(QObject *key, ExecutionEngine *engine);
private Q_SLOTS:
void removeDestroyedObject(QObject*);
diff --git a/src/qml/memory/qv4mm.cpp b/src/qml/memory/qv4mm.cpp
index 7df66342e2..7dbf12ff11 100644
--- a/src/qml/memory/qv4mm.cpp
+++ b/src/qml/memory/qv4mm.cpp
@@ -390,7 +390,7 @@ void MemoryManager::sweep(bool lastSweep)
if (MultiplyWrappedQObjectMap *multiplyWrappedQObjects = m_d->engine->m_multiplyWrappedQObjects) {
for (MultiplyWrappedQObjectMap::Iterator it = multiplyWrappedQObjects->begin(); it != multiplyWrappedQObjects->end();) {
- if (!it.value()->markBit())
+ if (!it.value().isNullOrUndefined())
it = multiplyWrappedQObjects->erase(it);
else
++it;
diff --git a/src/qml/qml/qqmldata_p.h b/src/qml/qml/qqmldata_p.h
index 8541b4e43c..5cef128e7e 100644
--- a/src/qml/qml/qqmldata_p.h
+++ b/src/qml/qml/qqmldata_p.h
@@ -75,7 +75,7 @@ class Q_QML_PRIVATE_EXPORT QQmlData : public QAbstractDeclarativeData
public:
QQmlData()
: ownedByQml1(false), ownMemory(true), ownContext(false), indestructible(true), explicitIndestructibleSet(false),
- hasTaintedV8Object(false), isQueuedForDeletion(false), rootObjectInCreation(false),
+ hasTaintedV4Object(false), isQueuedForDeletion(false), rootObjectInCreation(false),
hasVMEMetaObject(false), parentFrozen(false), bindingBitsSize(0), bindingBits(0), notifyList(0), context(0), outerContext(0),
bindings(0), signalHandlers(0), nextContextObject(0), prevContextObject(0),
lineNumber(0), columnNumber(0), jsEngineId(0), compiledData(0), deferredData(0),
@@ -113,7 +113,7 @@ public:
quint32 ownContext:1;
quint32 indestructible:1;
quint32 explicitIndestructibleSet:1;
- quint32 hasTaintedV8Object:1;
+ quint32 hasTaintedV4Object:1;
quint32 isQueuedForDeletion:1;
/*
* rootObjectInCreation should be true only when creating top level CPP and QML objects,
diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp
index 906e073cab..5a54609e12 100644
--- a/src/qml/qml/qqmlimport.cpp
+++ b/src/qml/qml/qqmlimport.cpp
@@ -653,9 +653,10 @@ bool QQmlImportNamespace::Import::resolveType(QQmlTypeLoader *typeLoader,
}
if (candidate != end) {
+ QQmlType *returnType = getTypeForUrl(componentUrl, type, isCompositeSingleton, 0);
if (type_return)
- *type_return = getTypeForUrl(componentUrl, type, isCompositeSingleton, 0);
- return (*type_return != 0);
+ *type_return = returnType;
+ return returnType != 0;
}
} else if (!isLibrary) {
QString qmlUrl;
@@ -679,9 +680,10 @@ bool QQmlImportNamespace::Import::resolveType(QQmlTypeLoader *typeLoader,
if (typeRecursionDetected)
*typeRecursionDetected = true;
} else {
+ QQmlType *returnType = getTypeForUrl(qmlUrl, type, false, 0);
if (type_return)
- *type_return = getTypeForUrl(qmlUrl, type, false, 0);
- return (*type_return) != 0;
+ *type_return = returnType;
+ return returnType != 0;
}
}
}
diff --git a/src/qml/qml/qqmlvmemetaobject.cpp b/src/qml/qml/qqmlvmemetaobject.cpp
index 586d4aa0b1..15017a2572 100644
--- a/src/qml/qml/qqmlvmemetaobject.cpp
+++ b/src/qml/qml/qqmlvmemetaobject.cpp
@@ -1225,6 +1225,11 @@ void QQmlVMEMetaObject::ensureQObjectWrapper()
void QQmlVMEMetaObject::mark(QV4::ExecutionEngine *e)
{
+ QQmlEnginePrivate *ep = (ctxt == 0 || ctxt->engine == 0) ? 0 : QQmlEnginePrivate::get(ctxt->engine);
+ QV4::ExecutionEngine *v4 = (ep == 0) ? 0 : ep->v4engine();
+ if (v4 != e)
+ return;
+
varProperties.markOnce(e);
// add references created by VMEVariant properties
@@ -1232,12 +1237,8 @@ void QQmlVMEMetaObject::mark(QV4::ExecutionEngine *e)
for (int ii = 0; ii < maxDataIdx; ++ii) { // XXX TODO: optimize?
if (data[ii].dataType() == QMetaType::QObjectStar) {
// possible QObject reference.
- QObject *ref = data[ii].asQObject();
- if (ref) {
- QQmlData *ddata = QQmlData::get(ref);
- if (ddata)
- ddata->jsWrapper.markOnce(e);
- }
+ if (QObject *ref = data[ii].asQObject())
+ QV4::QObjectWrapper::markWrapper(ref, e);
}
}
diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp
index b526775640..fd06ff4654 100644
--- a/src/qml/qml/qqmlxmlhttprequest.cpp
+++ b/src/qml/qml/qqmlxmlhttprequest.cpp
@@ -2005,7 +2005,7 @@ ReturnedValue QQmlXMLHttpRequestCtor::method_get_response(CallContext *ctx)
return QV4::Encode(scope.engine->newString(QString()));
const QString& responseType = r->responseType();
- if (responseType.compare(QLatin1String("text"), Qt::CaseInsensitive) == 0) {
+ if (responseType.compare(QLatin1String("text"), Qt::CaseInsensitive) == 0 || responseType.isEmpty()) {
return QV4::Encode(scope.engine->newString(r->responseBody()));
} else if (responseType.compare(QLatin1String("arraybuffer"), Qt::CaseInsensitive) == 0) {
return QV4::Encode(scope.engine->newArrayBuffer(r->rawResponseBody()));
diff --git a/src/qml/types/qquickpackage.cpp b/src/qml/types/qquickpackage.cpp
index 5fe73ec0e0..69bf058e6f 100644
--- a/src/qml/types/qquickpackage.cpp
+++ b/src/qml/types/qquickpackage.cpp
@@ -45,8 +45,8 @@ QT_BEGIN_NAMESPACE
\ingroup qtquick-views
\brief Specifies a collection of named items
- The Package class is used in conjunction with
- VisualDataModel to enable delegates with a shared context
+ The Package type is used in conjunction with
+ DelegateModel to enable delegates with a shared context
to be provided to multiple views.
Any item within a Package may be assigned a name via the
diff --git a/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc b/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc
index ec6e0e93d5..8ef77dac4c 100644
--- a/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc
+++ b/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc
@@ -173,8 +173,26 @@ defined by the render loop.
For detailed description of how the scene graph renderer works, see
\l {Qt Quick Scene Graph Renderer}.
-
-\section2 Threaded Render Loop
+There are three render loop variants available: \c basic, \c windows,
+and \c threaded. Out of these, \c basic and \c windows are
+single-threaded, while \c threaded performs scene graph rendering on a
+dedicated thread. Qt attempts to choose a suitable loop based on the
+platform and possibly the graphics drivers in use. When this is not
+satisfactory, or for testing purposes, the environment variable
+\c QSG_RENDER_LOOP can be used to force the usage of a given loop. To
+verify which render loop is in use, launch the application with
+\c QSG_INFO set to \c 1.
+
+\note The \c threaded and \c windows render loops rely on the OpenGL
+implementation for throttling by requesting a swap interval of 1. Some
+graphics drivers allow users to override this setting and turn it off,
+ignoring Qt's request. Without blocking in the swap buffers operation
+(or elsewhere), the render loop will run animations too fast and spin
+the CPU at 100%. If a system is known to be unable to provide
+vsync-based throttling, use the \c basic render loop instead by
+setting \c {QSG_RENDER_LOOP=basic} in the environment.
+
+\section2 Threaded Render Loop ("threaded")
On many configurations, the scene graph rendering will happen on a
dedicated render thread. This is done to increase parallelism of
@@ -245,11 +263,12 @@ animations, process events, etc.
\endlist
The threaded renderer is currently used by default on Windows with
-opengl32.dll, Linux with non-Mesa based drivers, OS X and EGLFS but
-this is subject to change. It is possible to force use of the threaded
-renderer by setting \c {QSG_RENDER_LOOP=threaded} in the environment.
+opengl32.dll, Linux with non-Mesa based drivers, OS X, mobile
+platforms, and Embedded Linux with EGLFS but this is subject to
+change. It is possible to force use of the threaded renderer by
+setting \c {QSG_RENDER_LOOP=threaded} in the environment.
-\section2 Non-threaded Render Loop
+\section2 Non-threaded Render Loops ("basic" and "windows")
The non-threaded render loop is currently used by default on Windows
with ANGLE or a non-default opengl32 implementation and Linux with
@@ -259,6 +278,10 @@ been tested. At the same time implementations like ANGLE or Mesa
llvmpipe are not able to function properly with threaded rendering at
all so not using threaded rendering is essential for these.
+By default \c windows is used for non-threaded rendering on Windows
+with ANGLE, while \c basic is used for all other platforms when
+non-threaded rendering is needed.
+
Even when using the non-threaded render loop, you should write your
code as if you are using the threaded renderer, as failing to do so
will make the code non-portable.
diff --git a/src/quick/doc/src/qmltypereference.qdoc b/src/quick/doc/src/qmltypereference.qdoc
index 0dbc342baa..e3641f2d76 100644
--- a/src/quick/doc/src/qmltypereference.qdoc
+++ b/src/quick/doc/src/qmltypereference.qdoc
@@ -185,18 +185,30 @@ available when you import \c QtQuick.
\table
\row
+ \li \c Font.Thin
+ \li 0
+ \row
+ \li \c Font.ExtraLight
+ \li 12
+ \row
\li \c Font.Light
\li 25
\row
\li \c Font.Normal
\li 50
\row
+ \li \c Font.Medium
+ \li 57
+ \row
\li \c Font.DemiBold
\li 63
\row
\li \c Font.Bold
\li 75
\row
+ \li \c Font.ExtraBold
+ \li 81
+ \row
\li \c Font.Black
\li 87
\endtable
diff --git a/src/quick/items/qquickborderimage.cpp b/src/quick/items/qquickborderimage.cpp
index fc3548053c..f345a77e15 100644
--- a/src/quick/items/qquickborderimage.cpp
+++ b/src/quick/items/qquickborderimage.cpp
@@ -40,6 +40,7 @@
#include <QtNetwork/qnetworkreply.h>
#include <QtCore/qfile.h>
#include <QtCore/qmath.h>
+#include <QtGui/qguiapplication.h>
#include <private/qqmlglobal_p.h>
@@ -321,7 +322,13 @@ void QQuickBorderImage::load()
if (d->cache)
options |= QQuickPixmap::Cache;
d->pix.clear(this);
- d->pix.load(qmlEngine(this), d->url, options);
+
+ const qreal targetDevicePixelRatio = (window() ? window()->effectiveDevicePixelRatio() : qGuiApp->devicePixelRatio());
+ d->devicePixelRatio = 1.0;
+
+ QUrl loadUrl = d->url;
+ resolve2xLocalFile(d->url, targetDevicePixelRatio, &loadUrl, &d->devicePixelRatio);
+ d->pix.load(qmlEngine(this), loadUrl, d->sourcesize * d->devicePixelRatio, options);
if (d->pix.isLoading()) {
if (d->progress != 0.0) {
@@ -329,8 +336,19 @@ void QQuickBorderImage::load()
emit progressChanged(d->progress);
}
d->status = Loading;
- d->pix.connectFinished(this, SLOT(requestFinished()));
- d->pix.connectDownloadProgress(this, SLOT(requestProgress(qint64,qint64)));
+
+ static int thisRequestProgress = -1;
+ static int thisRequestFinished = -1;
+ if (thisRequestProgress == -1) {
+ thisRequestProgress =
+ QQuickImageBase::staticMetaObject.indexOfSlot("requestProgress(qint64,qint64)");
+ thisRequestFinished =
+ QQuickImageBase::staticMetaObject.indexOfSlot("requestFinished()");
+ }
+ d->pix.connectFinished(this, thisRequestFinished);
+ d->pix.connectDownloadProgress(this, thisRequestProgress);
+
+ update(); //pixmap may have invalidated texture, updatePaintNode needs to be called before the next repaint
} else {
requestFinished();
return;
@@ -495,7 +513,7 @@ void QQuickBorderImage::requestFinished()
}
}
- setImplicitSize(impsize.width(), impsize.height());
+ setImplicitSize(impsize.width() / d->devicePixelRatio, impsize.height() / d->devicePixelRatio);
emit statusChanged(d->status);
if (sourceSize() != d->oldSourceSize) {
d->oldSourceSize = sourceSize();
@@ -569,40 +587,29 @@ QSGNode *QQuickBorderImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDat
QRectF innerTargetRect = targetRect;
if (d->border) {
const QQuickScaleGrid *border = d->getScaleGrid();
- innerSourceRect = QRectF(border->left() / qreal(d->pix.width()),
- border->top() / qreal(d->pix.height()),
- qMax<qreal>(0, d->pix.width() - border->right() - border->left()) / d->pix.width(),
- qMax<qreal>(0, d->pix.height() - border->bottom() - border->top()) / d->pix.height());
+ innerSourceRect = QRectF(border->left() * d->devicePixelRatio / qreal(d->pix.width()),
+ border->top() * d->devicePixelRatio / qreal(d->pix.height()),
+ qMax<qreal>(0, d->pix.width() - (border->right() + border->left()) * d->devicePixelRatio) / d->pix.width(),
+ qMax<qreal>(0, d->pix.height() - (border->bottom() + border->top()) * d->devicePixelRatio) / d->pix.height());
innerTargetRect = QRectF(border->left(),
border->top(),
- qMax<qreal>(0, width() - border->right() - border->left()),
- qMax<qreal>(0, height() - border->bottom() - border->top()));
+ qMax<qreal>(0, width() - (border->right() + border->left())),
+ qMax<qreal>(0, height() - (border->bottom() + border->top())));
}
qreal hTiles = 1;
qreal vTiles = 1;
- if (innerSourceRect.width() != 0) {
- switch (d->horizontalTileMode) {
- case QQuickBorderImage::Repeat:
- hTiles = innerTargetRect.width() / qreal(innerSourceRect.width() * d->pix.width());
- break;
- case QQuickBorderImage::Round:
- hTiles = qCeil(innerTargetRect.width() / qreal(innerSourceRect.width() * d->pix.width()));
- break;
- default:
- break;
- }
+ const QSizeF innerTargetSize = innerTargetRect.size() * d->devicePixelRatio;
+ if (innerSourceRect.width() != 0
+ && d->horizontalTileMode != QQuickBorderImage::Stretch) {
+ hTiles = innerTargetSize.width() / qreal(innerSourceRect.width() * d->pix.width());
+ if (d->horizontalTileMode == QQuickBorderImage::Round)
+ hTiles = qCeil(hTiles);
}
- if (innerSourceRect.height() != 0) {
- switch (d->verticalTileMode) {
- case QQuickBorderImage::Repeat:
- vTiles = innerTargetRect.height() / qreal(innerSourceRect.height() * d->pix.height());
- break;
- case QQuickBorderImage::Round:
- vTiles = qCeil(innerTargetRect.height() / qreal(innerSourceRect.height() * d->pix.height()));
- break;
- default:
- break;
- }
+ if (innerSourceRect.height() != 0
+ && d->verticalTileMode != QQuickBorderImage::Stretch) {
+ vTiles = innerTargetSize.height() / qreal(innerSourceRect.height() * d->pix.height());
+ if (d->verticalTileMode == QQuickBorderImage::Round)
+ vTiles = qCeil(vTiles);
}
node->setTargetRect(targetRect);
diff --git a/src/quick/items/qquickdroparea.cpp b/src/quick/items/qquickdroparea.cpp
index 217b455d43..e46d546a16 100644
--- a/src/quick/items/qquickdroparea.cpp
+++ b/src/quick/items/qquickdroparea.cpp
@@ -36,6 +36,7 @@
#include "qquickitem_p.h"
#include "qquickwindow.h"
+#include <private/qv4arraybuffer_p.h>
#include <private/qqmlengine_p.h>
#ifndef QT_NO_DRAGANDDROP
@@ -496,6 +497,14 @@ void QQuickDropArea::dropEvent(QDropEvent *event)
Returns the data for the given \a format converted to a string. \a format should be one contained in the \l formats property.
*/
+/*!
+ \qmlmethod string QtQuick::DragEvent::getDataAsArrayBuffer(string format)
+ \since 5.5
+
+ Returns the data for the given \a format into an ArrayBuffer, which can
+ easily be translated into a QByteArray. \a format should be one contained in the \l formats property.
+*/
+
QObject *QQuickDropEvent::source()
{
if (const QQuickDragMimeData *dragMime = qobject_cast<const QQuickDragMimeData *>(event->mimeData()))
@@ -566,6 +575,17 @@ void QQuickDropEvent::getDataAsString(QQmlV4Function *args)
}
}
+void QQuickDropEvent::getDataAsArrayBuffer(QQmlV4Function *args)
+{
+ if (args->length() != 0) {
+ QV4::ExecutionEngine *v4 = args->v4engine();
+ QV4::Scope scope(v4);
+ QV4::ScopedValue v(scope, (*args)[0]);
+ const QString format = v->toQString();
+ args->setReturnValue(v4->newArrayBuffer(event->mimeData()->data(format))->asReturnedValue());
+ }
+}
+
void QQuickDropEvent::acceptProposedAction(QQmlV4Function *)
{
event->acceptProposedAction();
diff --git a/src/quick/items/qquickdroparea_p.h b/src/quick/items/qquickdroparea_p.h
index e35ec40757..3223f4203b 100644
--- a/src/quick/items/qquickdroparea_p.h
+++ b/src/quick/items/qquickdroparea_p.h
@@ -96,6 +96,7 @@ public:
QStringList formats() const;
Q_INVOKABLE void getDataAsString(QQmlV4Function *);
+ Q_INVOKABLE void getDataAsArrayBuffer(QQmlV4Function *);
Q_INVOKABLE void acceptProposedAction(QQmlV4Function *);
Q_INVOKABLE void accept(QQmlV4Function *);
diff --git a/src/quick/items/qquickframebufferobject.cpp b/src/quick/items/qquickframebufferobject.cpp
index 758727ed9e..c3e5b97baf 100644
--- a/src/quick/items/qquickframebufferobject.cpp
+++ b/src/quick/items/qquickframebufferobject.cpp
@@ -386,6 +386,17 @@ QOpenGLFramebufferObject *QQuickFramebufferObject::Renderer::framebufferObject()
* the FBO size.
*
* The FBO will be automatically unbound after the function returns.
+ *
+ * \note Do not assume that the OpenGL state is all set to the defaults when
+ * this function is invoked, or that it is maintained between calls. Both the Qt
+ * Quick renderer and the custom rendering code uses the same OpenGL
+ * context. This means that the state might have been modified by Quick before
+ * invoking this function.
+ *
+ * \note It is recommended to call QQuickWindow::resetOpenGLState() before
+ * returning. This resets OpenGL state used by the Qt Quick renderer and thus
+ * avoids interference from the state changes made by the rendering code in this
+ * function.
*/
/*!
diff --git a/src/quick/items/qquickimage.cpp b/src/quick/items/qquickimage.cpp
index a278fb72a2..f0f17551b7 100644
--- a/src/quick/items/qquickimage.cpp
+++ b/src/quick/items/qquickimage.cpp
@@ -152,6 +152,7 @@ QQuickImagePrivate::QQuickImagePrivate()
QQuickImage::QQuickImage(QQuickItem *parent)
: QQuickImageBase(*(new QQuickImagePrivate), parent)
{
+ connect(this, SIGNAL(autoTransformBaseChanged()), SIGNAL(autoTransformChanged()));
}
QQuickImage::QQuickImage(QQuickImagePrivate &dd, QQuickItem *parent)
@@ -820,4 +821,14 @@ void QQuickImage::setMipmap(bool use)
update();
}
+/*!
+ \qmlproperty bool QtQuick::Image::autoTransform
+ \since 5.5
+
+ This property holds whether the image should automatically apply
+ image transformation metadata such as EXIF orientation.
+
+ By default, this property is set to false.
+ */
+
QT_END_NAMESPACE
diff --git a/src/quick/items/qquickimage_p.h b/src/quick/items/qquickimage_p.h
index 181efc719f..443d796c44 100644
--- a/src/quick/items/qquickimage_p.h
+++ b/src/quick/items/qquickimage_p.h
@@ -53,6 +53,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickImage : public QQuickImageBase
Q_PROPERTY(HAlignment horizontalAlignment READ horizontalAlignment WRITE setHorizontalAlignment NOTIFY horizontalAlignmentChanged)
Q_PROPERTY(VAlignment verticalAlignment READ verticalAlignment WRITE setVerticalAlignment NOTIFY verticalAlignmentChanged)
Q_PROPERTY(bool mipmap READ mipmap WRITE setMipmap NOTIFY mipmapChanged REVISION 1)
+ Q_PROPERTY(bool autoTransform READ autoTransform WRITE setAutoTransform NOTIFY autoTransformChanged REVISION 2)
public:
QQuickImage(QQuickItem *parent=0);
@@ -93,6 +94,7 @@ Q_SIGNALS:
void horizontalAlignmentChanged(HAlignment alignment);
void verticalAlignmentChanged(VAlignment alignment);
Q_REVISION(1) void mipmapChanged(bool);
+ Q_REVISION(2) void autoTransformChanged();
private Q_SLOTS:
void invalidateSceneGraph();
diff --git a/src/quick/items/qquickimagebase.cpp b/src/quick/items/qquickimagebase.cpp
index b54c34765f..0e2134842b 100644
--- a/src/quick/items/qquickimagebase.cpp
+++ b/src/quick/items/qquickimagebase.cpp
@@ -195,6 +195,10 @@ void QQuickImageBase::load()
d->oldSourceSize = sourceSize();
emit sourceSizeChanged();
}
+ if (autoTransform() != d->oldAutoTransform) {
+ d->oldAutoTransform = autoTransform();
+ emit autoTransformBaseChanged();
+ }
update();
} else {
@@ -215,7 +219,7 @@ void QQuickImageBase::load()
// QQuickImageProvider and SVG can generate a high resolution image when
// sourceSize is set. If sourceSize is not set then the provider default size
// will be used, as usual.
- if (d->sourcesize.isValid())
+ if (!d->sourcesize.isEmpty())
d->devicePixelRatio = targetDevicePixelRatio;
} else {
// (possible) local file: loadUrl and d->devicePixelRatio will be modified if
@@ -223,7 +227,7 @@ void QQuickImageBase::load()
resolve2xLocalFile(d->url, targetDevicePixelRatio, &loadUrl, &d->devicePixelRatio);
}
- d->pix.load(qmlEngine(this), loadUrl, d->sourcesize * d->devicePixelRatio, options);
+ d->pix.load(qmlEngine(this), loadUrl, d->sourcesize * d->devicePixelRatio, options, d->autoTransform);
if (d->pix.isLoading()) {
if (d->progress != 0.0) {
@@ -278,6 +282,10 @@ void QQuickImageBase::requestFinished()
d->oldSourceSize = sourceSize();
emit sourceSizeChanged();
}
+ if (autoTransform() != d->oldAutoTransform) {
+ d->oldAutoTransform = autoTransform();
+ emit autoTransformBaseChanged();
+ }
update();
}
@@ -368,4 +376,21 @@ void QQuickImageBase::resolve2xLocalFile(const QUrl &url, qreal targetDevicePixe
*sourceDevicePixelRatio = qreal(2.0);
}
+bool QQuickImageBase::autoTransform() const
+{
+ Q_D(const QQuickImageBase);
+ if (d->autoTransform == UsePluginDefault)
+ return d->pix.autoTransform() == ApplyTransform;
+ return d->autoTransform == ApplyTransform;
+}
+
+void QQuickImageBase::setAutoTransform(bool transform)
+{
+ Q_D(QQuickImageBase);
+ if (d->autoTransform != UsePluginDefault && transform == (d->autoTransform == ApplyTransform))
+ return;
+ d->autoTransform = transform ? ApplyTransform : DoNotApplyTransform;
+ emit autoTransformBaseChanged();
+}
+
QT_END_NAMESPACE
diff --git a/src/quick/items/qquickimagebase_p.h b/src/quick/items/qquickimagebase_p.h
index 978004f8fd..d43822bebe 100644
--- a/src/quick/items/qquickimagebase_p.h
+++ b/src/quick/items/qquickimagebase_p.h
@@ -78,6 +78,9 @@ public:
virtual void setMirror(bool mirror);
bool mirror() const;
+ virtual void setAutoTransform(bool transform);
+ bool autoTransform() const;
+
void resolve2xLocalFile(const QUrl &url, qreal targetDevicePixelRatio, QUrl *sourceUrl, qreal *sourceDevicePixelRatio);
Q_SIGNALS:
@@ -88,6 +91,7 @@ Q_SIGNALS:
void asynchronousChanged();
void cacheChanged();
void mirrorChanged();
+ void autoTransformBaseChanged();
protected:
virtual void load();
diff --git a/src/quick/items/qquickimagebase_p_p.h b/src/quick/items/qquickimagebase_p_p.h
index ebdf352e4e..cffe709116 100644
--- a/src/quick/items/qquickimagebase_p_p.h
+++ b/src/quick/items/qquickimagebase_p_p.h
@@ -62,9 +62,11 @@ public:
: status(QQuickImageBase::Null),
progress(0.0),
devicePixelRatio(1.0),
+ autoTransform(UsePluginDefault),
async(false),
cache(true),
- mirror(false)
+ mirror(false),
+ oldAutoTransform(false)
{
}
@@ -75,9 +77,11 @@ public:
QSize sourcesize;
QSize oldSourceSize;
qreal devicePixelRatio;
+ AutoTransform autoTransform;
bool async : 1;
bool cache : 1;
bool mirror: 1;
+ bool oldAutoTransform : 1;
};
QT_END_NAMESPACE
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index 4d1bb696fa..3d0f550d14 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -4244,7 +4244,7 @@ void QQuickItem::mapToItem(QQmlV4Function *args) const
This method sets focus on the item and ensures that all ancestor
FocusScope objects in the object hierarchy are also given \l focus.
- The reason for the focus change will be \a Qt::OtherFocusReason. Use
+ The reason for the focus change will be \l [CPP] Qt::OtherFocusReason. Use
the overloaded method to specify the focus reason to enable better
handling of the focus change.
@@ -6105,7 +6105,7 @@ qreal QQuickItem::implicitWidth() const
Defines the natural width or height of the Item if no \l width or \l height is specified.
The default implicit size for most items is 0x0, however some items have an inherent
- implicit size which cannot be overridden, e.g. Image, Text.
+ implicit size which cannot be overridden, for example, \l [QML] Image and \l [QML] Text.
Setting the implicit size is useful for defining components that have a preferred size
based on their content, for example:
@@ -6129,7 +6129,7 @@ qreal QQuickItem::implicitWidth() const
}
\endqml
- \b Note: using implicitWidth of Text or TextEdit and setting the width explicitly
+ \note Using implicitWidth of \l [QML] Text or \l [QML] TextEdit and setting the width explicitly
incurs a performance penalty as the text must be laid out twice.
*/
/*!
@@ -6139,7 +6139,7 @@ qreal QQuickItem::implicitWidth() const
Defines the natural width or height of the Item if no \l width or \l height is specified.
The default implicit size for most items is 0x0, however some items have an inherent
- implicit size which cannot be overridden, e.g. Image, Text.
+ implicit size which cannot be overridden, for example, \l [QML] Image and \l [QML] Text.
Setting the implicit size is useful for defining components that have a preferred size
based on their content, for example:
@@ -6163,7 +6163,7 @@ qreal QQuickItem::implicitWidth() const
}
\endqml
- \b Note: using implicitWidth of Text or TextEdit and setting the width explicitly
+ \note Using implicitWidth of \l [QML] Text or \l [QML] TextEdit and setting the width explicitly
incurs a performance penalty as the text must be laid out twice.
*/
void QQuickItem::setImplicitWidth(qreal w)
@@ -6740,9 +6740,7 @@ void QQuickItemPrivate::setHasCursorInChild(bool hasCursor)
void QQuickItemPrivate::markObjects(QV4::ExecutionEngine *e)
{
Q_Q(QQuickItem);
- QQmlData *ddata = QQmlData::get(q);
- if (ddata)
- ddata->jsWrapper.markOnce(e);
+ QV4::QObjectWrapper::markWrapper(q, e);
foreach (QQuickItem *child, childItems)
QQuickItemPrivate::get(child)->markObjects(e);
diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp
index c736244b0e..6e50a9a77b 100644
--- a/src/quick/items/qquickitemsmodule.cpp
+++ b/src/quick/items/qquickitemsmodule.cpp
@@ -259,6 +259,7 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor)
qmlRegisterUncreatableType<QQuickOpenGLInfo>(uri, 2, 4,"OpenGLInfo", QQuickOpenGLInfo::tr("OpenGLInfo is only available via attached properties"));
qmlRegisterType<QQuickPinchArea, 1>(uri, 2, 5,"PinchArea");
+ qmlRegisterType<QQuickImage, 2>(uri, 2, 5,"Image");
qmlRegisterType<QQuickText, 6>(uri, 2, 6, "Text");
qmlRegisterType<QQuickTextEdit, 6>(uri, 2, 6, "TextEdit");
diff --git a/src/quick/items/qquickrendercontrol.cpp b/src/quick/items/qquickrendercontrol.cpp
index e1ca662277..fd4787be98 100644
--- a/src/quick/items/qquickrendercontrol.cpp
+++ b/src/quick/items/qquickrendercontrol.cpp
@@ -367,6 +367,11 @@ void QQuickRenderControlPrivate::maybeUpdate()
If \a offset in non-null, it is set to the offset of the control
inside the window.
+
+ \note While not mandatory, reimplementing this function becomes essential for
+ supporting multiple screens with different device pixel ratios and properly positioning
+ popup windows opened from QML. Therefore providing it in subclasses is highly
+ recommended.
*/
/*!
diff --git a/src/quick/items/qquickscreen.cpp b/src/quick/items/qquickscreen.cpp
index 5bd6430f2d..3bf7229b33 100644
--- a/src/quick/items/qquickscreen.cpp
+++ b/src/quick/items/qquickscreen.cpp
@@ -351,24 +351,15 @@ void QQuickScreenAttached::screenChanged(QScreen *screen)
emit orientationUpdateMaskChanged();
}
- if (!oldScreen || screen->size() != oldScreen->size()) {
- emit widthChanged();
- emit heightChanged();
- }
- if (!oldScreen || screen->name() != oldScreen->name())
- emit nameChanged();
- if (!oldScreen || screen->orientation() != oldScreen->orientation())
- emit orientationChanged();
- if (!oldScreen || screen->primaryOrientation() != oldScreen->primaryOrientation())
- emit primaryOrientationChanged();
- if (!oldScreen || screen->availableVirtualGeometry() != oldScreen->availableVirtualGeometry())
- emit desktopGeometryChanged();
- if (!oldScreen || screen->logicalDotsPerInch() != oldScreen->logicalDotsPerInch())
- emit logicalPixelDensityChanged();
- if (!oldScreen || screen->physicalDotsPerInch() != oldScreen->physicalDotsPerInch())
- emit pixelDensityChanged();
- if (!oldScreen || screen->devicePixelRatio() != oldScreen->devicePixelRatio())
- emit devicePixelRatioChanged();
+ emit widthChanged();
+ emit heightChanged();
+ emit nameChanged();
+ emit orientationChanged();
+ emit primaryOrientationChanged();
+ emit desktopGeometryChanged();
+ emit logicalPixelDensityChanged();
+ emit pixelDensityChanged();
+ emit devicePixelRatioChanged();
connect(screen, SIGNAL(geometryChanged(QRect)),
this, SIGNAL(widthChanged()));
diff --git a/src/quick/items/qquickshadereffectnode.cpp b/src/quick/items/qquickshadereffectnode.cpp
index e593112ef5..de6cae0ea6 100644
--- a/src/quick/items/qquickshadereffectnode.cpp
+++ b/src/quick/items/qquickshadereffectnode.cpp
@@ -341,7 +341,7 @@ bool QQuickShaderEffectMaterialKey::operator != (const QQuickShaderEffectMateria
uint qHash(const QQuickShaderEffectMaterialKey &key)
{
- uint hash = qHash((void *)key.className);
+ uint hash = qHash((const void *)key.className);
typedef QQuickShaderEffectMaterialKey Key;
for (int shaderType = 0; shaderType < Key::ShaderTypeCount; ++shaderType)
hash = hash * 31337 + qHash(key.sourceCode[shaderType]);
@@ -381,11 +381,10 @@ bool QQuickShaderEffectMaterial::UniformData::operator == (const UniformData &ot
return false;
if (specialType == UniformData::Sampler) {
- QQuickItem *source = qobject_cast<QQuickItem *>(qvariant_cast<QObject *>(value));
- QQuickItem *otherSource = qobject_cast<QQuickItem *>(qvariant_cast<QObject *>(other.value));
- if (!source || !otherSource || !source->isTextureProvider() || !otherSource->isTextureProvider())
- return false;
- return source->textureProvider()->texture()->textureId() == otherSource->textureProvider()->texture()->textureId();
+ // We can't check the source objects as these live in the GUI thread,
+ // so return true here and rely on the textureProvider check for
+ // equality of these..
+ return true;
} else {
return value == other.value;
}
@@ -402,6 +401,23 @@ int QQuickShaderEffectMaterial::compare(const QSGMaterial *o) const
if (uniforms[shaderType] != other->uniforms[shaderType])
return 1;
}
+
+ // Check the texture providers..
+ if (textureProviders.size() != other->textureProviders.size())
+ return 1;
+ for (int i=0; i<textureProviders.size(); ++i) {
+ QSGTextureProvider *tp1 = textureProviders.at(i);
+ QSGTextureProvider *tp2 = other->textureProviders.at(i);
+ if (!tp1 || !tp2)
+ return tp1 == tp2 ? 0 : 1;
+ QSGTexture *t1 = tp1->texture();
+ QSGTexture *t2 = tp2->texture();
+ if (!t1 || !t2)
+ return t1 == t2 ? 0 : 1;
+ // Check texture id's as textures may be in the same atlas.
+ if (t1->textureId() != t2->textureId())
+ return 1;
+ }
return 0;
}
diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp
index 9db5fa2059..799b1465ea 100644
--- a/src/quick/items/qquicktext.cpp
+++ b/src/quick/items/qquicktext.cpp
@@ -809,7 +809,7 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const baseline)
lineWidth = (q->widthValid() || implicitWidthValid) && q->width() > 0
? q->width()
: FLT_MAX;
- qreal maxHeight = q->heightValid() ? q->height() : FLT_MAX;
+ qreal maxHeight = q->heightValid() ? availableHeight() : FLT_MAX;
const bool customLayout = isLineLaidOutConnected();
const bool wasTruncated = truncated;
@@ -829,6 +829,7 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const baseline)
: largeFont;
int scaledFontSize = largeFont;
+ bool widthChanged = false;
widthExceeded = availableWidth() <= 0 && (singlelineElide || canWrap || horizontalFit);
heightExceeded = availableHeight() <= 0 && (multilineElide || verticalFit);
@@ -1028,6 +1029,7 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const baseline)
if ((lineWidth < qMin(oldWidth, naturalWidth) || (widthExceeded && lineWidth > oldWidth))
&& (singlelineElide || multilineElide || canWrap || horizontalFit
|| q->effectiveHAlign() != QQuickText::AlignLeft)) {
+ widthChanged = true;
widthExceeded = false;
heightExceeded = false;
continue;
@@ -1049,6 +1051,39 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const baseline)
heightExceeded = false;
continue;
}
+ } else if (widthChanged) {
+ widthChanged = false;
+ if (line.isValid()) {
+ for (int lineCount = layout.lineCount(); lineCount < maxLineCount; ++lineCount) {
+ line = layout.createLine();
+ if (!line.isValid())
+ break;
+ setLineGeometry(line, lineWidth, naturalHeight);
+ }
+ }
+ layout.endLayout();
+
+ bool wasInLayout = internalWidthUpdate;
+ internalWidthUpdate = true;
+ q->setImplicitHeight(naturalHeight);
+ internalWidthUpdate = wasInLayout;
+
+ multilineElide = elideMode == QQuickText::ElideRight
+ && q->widthValid()
+ && (q->heightValid() || maximumLineCountValid);
+ verticalFit = fontSizeMode() & QQuickText::VerticalFit
+ && (q->heightValid() || (maximumLineCountValid && canWrap));
+
+ const qreal oldHeight = maxHeight;
+ maxHeight = q->heightValid() ? availableHeight() : FLT_MAX;
+ // If the height of the item has changed and it's possible the result of eliding,
+ // line count truncation or scaling has changed, do another layout.
+ if ((maxHeight < qMin(oldHeight, naturalHeight) || (heightExceeded && maxHeight > oldHeight))
+ && (multilineElide || (canWrap && maximumLineCountValid))) {
+ widthExceeded = false;
+ heightExceeded = false;
+ continue;
+ }
} else {
layout.endLayout();
}
@@ -1420,10 +1455,14 @@ QQuickText::~QQuickText()
The weight can be one of:
\list
+ \li Font.Thin
\li Font.Light
+ \li Font.ExtraLight
\li Font.Normal - the default
+ \li Font.Medium
\li Font.DemiBold
\li Font.Bold
+ \li Font.ExtraBold
\li Font.Black
\endlist
diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp
index 4df7a3caeb..0601932beb 100644
--- a/src/quick/items/qquicktextedit.cpp
+++ b/src/quick/items/qquicktextedit.cpp
@@ -211,10 +211,14 @@ QString QQuickTextEdit::text() const
The weight can be one of:
\list
+ \li Font.Thin
\li Font.Light
+ \li Font.ExtraLight
\li Font.Normal - the default
+ \li Font.Medium
\li Font.DemiBold
\li Font.Bold
+ \li Font.ExtraBold
\li Font.Black
\endlist
@@ -1488,6 +1492,11 @@ void QQuickTextEdit::setReadOnly(bool r)
emit readOnlyChanged(r);
if (!d->selectByKeyboardSet)
emit selectByKeyboardChanged(!r);
+ if (r) {
+ setCursorVisible(false);
+ } else if (hasActiveFocus()) {
+ setCursorVisible(true);
+ }
}
bool QQuickTextEdit::isReadOnly() const
@@ -1989,9 +1998,9 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *
std::sort(d->textNodeMap.begin(), d->textNodeMap.end(), &comesBefore);
}
- if (d->cursorComponent == 0 && !isReadOnly()) {
+ if (d->cursorComponent == 0) {
QSGRectangleNode* cursor = 0;
- if (d->cursorVisible && d->control->cursorOn())
+ if (!isReadOnly() && d->cursorVisible && d->control->cursorOn())
cursor = d->sceneGraphContext()->createRectangleNode(d->control->cursorRect(), d->color);
rootNode->resetCursorNode(cursor);
}
@@ -2460,7 +2469,8 @@ void QQuickTextEditPrivate::handleFocusEvent(QFocusEvent *event)
{
Q_Q(QQuickTextEdit);
bool focus = event->type() == QEvent::FocusIn;
- q->setCursorVisible(focus);
+ if (!q->isReadOnly())
+ q->setCursorVisible(focus);
control->processEvent(event, QPointF(-xoff, -yoff));
if (focus) {
q->q_updateAlignment();
diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp
index 35576e3341..c5f3f3ffaf 100644
--- a/src/quick/items/qquicktextinput.cpp
+++ b/src/quick/items/qquicktextinput.cpp
@@ -234,10 +234,14 @@ QString QQuickTextInputPrivate::realText() const
The weight can be one of:
\list
+ \li Font.Thin
\li Font.Light
+ \li Font.ExtraLight
\li Font.Normal - the default
+ \li Font.Medium
\li Font.DemiBold
\li Font.Bold
+ \li Font.ExtraBold
\li Font.Black
\endlist
@@ -658,6 +662,12 @@ void QQuickTextInput::setReadOnly(bool ro)
q_canPasteChanged();
d->emitUndoRedoChanged();
emit readOnlyChanged(ro);
+ if (ro) {
+ setCursorVisible(false);
+ } else if (hasActiveFocus()) {
+ setCursorVisible(true);
+ }
+ update();
}
/*!
@@ -2420,7 +2430,8 @@ void QQuickTextInputPrivate::handleFocusEvent(QFocusEvent *event)
{
Q_Q(QQuickTextInput);
bool focus = event->gotFocus();
- q->setCursorVisible(focus);
+ if (!m_readOnly)
+ q->setCursorVisible(focus);
if (focus) {
q->q_updateAlignment();
#ifndef QT_NO_IM
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index 47c7a28834..ee2556af64 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -467,8 +467,6 @@ void QQuickWindowPrivate::init(QQuickWindow *c, QQuickRenderControl *control)
animationController = new QQuickAnimatorController(q);
- delayedTouch = 0;
-
QObject::connect(context, SIGNAL(initialized()), q, SIGNAL(sceneGraphInitialized()), Qt::DirectConnection);
QObject::connect(context, SIGNAL(invalidated()), q, SIGNAL(sceneGraphInvalidated()), Qt::DirectConnection);
QObject::connect(context, SIGNAL(invalidated()), q, SLOT(cleanupSceneGraph()), Qt::DirectConnection);
@@ -1835,6 +1833,15 @@ bool QQuickWindowPrivate::deliverTouchCancelEvent(QTouchEvent *event)
return true;
}
+void QQuickWindowPrivate::deliverDelayedTouchEvent()
+{
+ // Deliver and delete delayedTouch.
+ // Set delayedTouch to 0 before delivery to avoid redelivery in case of
+ // event loop recursions (e.g if it the touch starts a dnd session).
+ QScopedPointer<QTouchEvent> e(delayedTouch.take());
+ reallyDeliverTouchEvent(e.data());
+}
+
static bool qquickwindow_no_touch_compression = qEnvironmentVariableIsSet("QML_NO_TOUCH_COMPRESSION");
// check what kind of touch we have (begin/update) and
@@ -1854,7 +1861,7 @@ void QQuickWindowPrivate::deliverTouchEvent(QTouchEvent *event)
&& ((states & (Qt::TouchPointPressed | Qt::TouchPointReleased)) == 0)) {
// we can only compress something that isn't a press or release
if (!delayedTouch) {
- delayedTouch = new QTouchEvent(event->type(), event->device(), event->modifiers(), event->touchPointStates(), event->touchPoints());
+ delayedTouch.reset(new QTouchEvent(event->type(), event->device(), event->modifiers(), event->touchPointStates(), event->touchPoints()));
delayedTouch->setTimestamp(event->timestamp());
if (renderControl)
QQuickRenderControlPrivate::get(renderControl)->maybeUpdate();
@@ -1900,19 +1907,14 @@ void QQuickWindowPrivate::deliverTouchEvent(QTouchEvent *event)
}
// merging wasn't possible, so deliver the delayed event first, and then delay this one
- reallyDeliverTouchEvent(delayedTouch);
- delete delayedTouch;
- delayedTouch = new QTouchEvent(event->type(), event->device(), event->modifiers(), event->touchPointStates(), event->touchPoints());
+ deliverDelayedTouchEvent();
+ delayedTouch.reset(new QTouchEvent(event->type(), event->device(), event->modifiers(), event->touchPointStates(), event->touchPoints()));
delayedTouch->setTimestamp(event->timestamp());
return;
}
} else {
- if (delayedTouch) {
- // deliver the delayed touch first
- reallyDeliverTouchEvent(delayedTouch);
- delete delayedTouch;
- delayedTouch = 0;
- }
+ if (delayedTouch)
+ deliverDelayedTouchEvent();
reallyDeliverTouchEvent(event);
}
}
@@ -1920,9 +1922,7 @@ void QQuickWindowPrivate::deliverTouchEvent(QTouchEvent *event)
void QQuickWindowPrivate::flushDelayedTouchEvent()
{
if (delayedTouch) {
- reallyDeliverTouchEvent(delayedTouch);
- delete delayedTouch;
- delayedTouch = 0;
+ deliverDelayedTouchEvent();
// Touch events which constantly start animations (such as a behavior tracking
// the mouse point) need animations to start.
@@ -1989,7 +1989,12 @@ void QQuickWindowPrivate::reallyDeliverTouchEvent(QTouchEvent *event)
}
if (event->type() == QEvent::TouchEnd) {
- Q_ASSERT(itemForTouchPointId.isEmpty());
+ if (!itemForTouchPointId.isEmpty()) {
+ qWarning() << "No release received for" << itemForTouchPointId.size()
+ << "touch points over" << itemForTouchPointId.begin().value()
+ << "on touch end.";
+ itemForTouchPointId.clear();
+ }
}
--touchRecursionGuard;
diff --git a/src/quick/items/qquickwindow_p.h b/src/quick/items/qquickwindow_p.h
index a61c0b0346..605a36fb1d 100644
--- a/src/quick/items/qquickwindow_p.h
+++ b/src/quick/items/qquickwindow_p.h
@@ -151,6 +151,7 @@ public:
void deliverTouchEvent(QTouchEvent *);
void reallyDeliverTouchEvent(QTouchEvent *);
bool deliverTouchCancelEvent(QTouchEvent *);
+ void deliverDelayedTouchEvent();
void flushDelayedTouchEvent();
bool deliverHoverEvent(QQuickItem *, const QPointF &scenePos, const QPointF &lastScenePos, Qt::KeyboardModifiers modifiers, bool &accepted);
bool deliverMatchingPointsToItem(QQuickItem *item, QTouchEvent *event, QSet<int> *acceptedNewPoints, const QSet<int> &matchingNewPoints, const QList<QTouchEvent::TouchPoint> &matchingPoints, QSet<QQuickItem*> *filtered);
@@ -219,7 +220,7 @@ public:
QSGRenderLoop *windowManager;
QQuickRenderControl *renderControl;
QQuickAnimatorController *animationController;
- QTouchEvent *delayedTouch;
+ QScopedPointer<QTouchEvent> delayedTouch;
int touchRecursionGuard;
QQuickCustomRenderStage *customRenderStage;
diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
index f056b1767e..81e72b7946 100644
--- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
+++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
@@ -1696,8 +1696,8 @@ void Renderer::uploadMergedElement(Element *e, int vaOffset, char **vertexData,
if (((const QMatrix4x4_Accessor &) localx).flagBits == 1) {
for (int i=0; i<vCount; ++i) {
Pt *p = (Pt *) vdata;
- p->x += ((QMatrix4x4_Accessor &) localx).m[3][0];
- p->y += ((QMatrix4x4_Accessor &) localx).m[3][1];
+ p->x += ((const QMatrix4x4_Accessor &) localx).m[3][0];
+ p->y += ((const QMatrix4x4_Accessor &) localx).m[3][1];
vdata += vSize;
}
} else if (((const QMatrix4x4_Accessor &) localx).flagBits > 1) {
@@ -1938,11 +1938,11 @@ void Renderer::uploadBatch(Batch *b)
if (attr.isVertexCoordinate)
dump << "* ";
for (int t=0; t<attr.tupleSize; ++t)
- dump << *(float *)(vd + offset + t * sizeof(float)) << " ";
+ dump << *(const float *)(vd + offset + t * sizeof(float)) << " ";
} else if (attr.type == GL_UNSIGNED_BYTE) {
dump << "ubyte ";
for (int t=0; t<attr.tupleSize; ++t)
- dump << *(unsigned char *)(vd + offset + t * sizeof(unsigned char)) << " ";
+ dump << *(const unsigned char *)(vd + offset + t * sizeof(unsigned char)) << " ";
}
dump << ") ";
offset += attr.tupleSize * size_of_type(attr.type);
diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h
index 8996d5a092..f87dd75c8c 100644
--- a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h
+++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h
@@ -85,7 +85,12 @@ public:
for (int i=0; i<PageSize; ++i) blocks[i] = i;
}
- Type *at(uint index) const
+ const Type *at(uint index) const
+ {
+ return (Type *) &data[index * sizeof(Type)];
+ }
+
+ Type *at(uint index)
{
return (Type *) &data[index * sizeof(Type)];
}
diff --git a/src/quick/scenegraph/coreapi/qsgnode.cpp b/src/quick/scenegraph/coreapi/qsgnode.cpp
index e52713e804..71f4f62db9 100644
--- a/src/quick/scenegraph/coreapi/qsgnode.cpp
+++ b/src/quick/scenegraph/coreapi/qsgnode.cpp
@@ -1457,7 +1457,7 @@ QDebug operator<<(QDebug d, const QSGGeometryNode *n)
d << "Geometry(null)";
return d;
}
- d << "GeometryNode(" << hex << (void *) n << dec;
+ d << "GeometryNode(" << hex << (const void *) n << dec;
const QSGGeometry *g = n->geometry();
@@ -1508,7 +1508,7 @@ QDebug operator<<(QDebug d, const QSGClipNode *n)
d << "ClipNode(null)";
return d;
}
- d << "ClipNode(" << hex << (void *) n << dec;
+ d << "ClipNode(" << hex << (const void *) n << dec;
if (n->childCount())
d << "children=" << n->childCount();
@@ -1531,7 +1531,7 @@ QDebug operator<<(QDebug d, const QSGTransformNode *n)
}
const QMatrix4x4 m = n->matrix();
d << "TransformNode(";
- d << hex << (void *) n << dec;
+ d << hex << (const void *) n << dec;
if (m.isIdentity())
d << "identity";
else if (m.determinant() == 1 && m(0, 0) == 1 && m(1, 1) == 1 && m(2, 2) == 1)
@@ -1553,7 +1553,7 @@ QDebug operator<<(QDebug d, const QSGOpacityNode *n)
return d;
}
d << "OpacityNode(";
- d << hex << (void *) n << dec;
+ d << hex << (const void *) n << dec;
d << "opacity=" << n->opacity()
<< "combined=" << n->combinedOpacity()
<< (n->isSubtreeBlocked() ? "*BLOCKED*" : "");
@@ -1571,7 +1571,7 @@ QDebug operator<<(QDebug d, const QSGRootNode *n)
d << "RootNode(null)";
return d;
}
- d << "RootNode" << hex << (void *) n << (n->isSubtreeBlocked() ? "*BLOCKED*" : "");
+ d << "RootNode" << hex << (const void *) n << (n->isSubtreeBlocked() ? "*BLOCKED*" : "");
#ifdef QSG_RUNTIME_DESCRIPTION
d << QSGNodePrivate::description(n);
#endif
@@ -1604,7 +1604,7 @@ QDebug operator<<(QDebug d, const QSGNode *n)
d << static_cast<const QSGOpacityNode *>(n);
break;
case QSGNode::RenderNodeType:
- d << "RenderNode(" << hex << (void *) n << dec
+ d << "RenderNode(" << hex << (const void *) n << dec
<< "flags=" << (int) n->flags() << dec
<< (n->isSubtreeBlocked() ? "*BLOCKED*" : "");
#ifdef QSG_RUNTIME_DESCRIPTION
@@ -1613,7 +1613,7 @@ QDebug operator<<(QDebug d, const QSGNode *n)
d << ')';
break;
default:
- d << "Node(" << hex << (void *) n << dec
+ d << "Node(" << hex << (const void *) n << dec
<< "flags=" << (int) n->flags() << dec
<< (n->isSubtreeBlocked() ? "*BLOCKED*" : "");
#ifdef QSG_RUNTIME_DESCRIPTION
diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp
index dd071d757e..418d571ae6 100644
--- a/src/quick/scenegraph/qsgcontext.cpp
+++ b/src/quick/scenegraph/qsgcontext.cpp
@@ -315,11 +315,11 @@ QSGContext::QSGContext(QObject *parent) :
// Adds compatibility with Qt 5.3 and earlier's QSG_RENDER_TIMING
if (qEnvironmentVariableIsSet("QSG_RENDER_TIMING")) {
- ((QLoggingCategory &) QSG_LOG_TIME_GLYPH()).setEnabled(QtDebugMsg, true);
- ((QLoggingCategory &) QSG_LOG_TIME_TEXTURE()).setEnabled(QtDebugMsg, true);
- ((QLoggingCategory &) QSG_LOG_TIME_RENDERER()).setEnabled(QtDebugMsg, true);
- ((QLoggingCategory &) QSG_LOG_TIME_RENDERLOOP()).setEnabled(QtDebugMsg, true);
- ((QLoggingCategory &) QSG_LOG_TIME_COMPILATION()).setEnabled(QtDebugMsg, true);
+ const_cast<QLoggingCategory &>(QSG_LOG_TIME_GLYPH()).setEnabled(QtDebugMsg, true);
+ const_cast<QLoggingCategory &>(QSG_LOG_TIME_TEXTURE()).setEnabled(QtDebugMsg, true);
+ const_cast<QLoggingCategory &>(QSG_LOG_TIME_RENDERER()).setEnabled(QtDebugMsg, true);
+ const_cast<QLoggingCategory &>(QSG_LOG_TIME_RENDERLOOP()).setEnabled(QtDebugMsg, true);
+ const_cast<QLoggingCategory &>(QSG_LOG_TIME_COMPILATION()).setEnabled(QtDebugMsg, true);
}
}
diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp
index 0c39602dab..6c7fb89b6f 100644
--- a/src/quick/scenegraph/qsgrenderloop.cpp
+++ b/src/quick/scenegraph/qsgrenderloop.cpp
@@ -168,7 +168,7 @@ QSGRenderLoop *QSGRenderLoop::instance()
// For compatibility with 5.3 and earlier's QSG_INFO environment variables
if (qEnvironmentVariableIsSet("QSG_INFO"))
- ((QLoggingCategory &) QSG_LOG_INFO()).setEnabled(QtDebugMsg, true);
+ const_cast<QLoggingCategory &>(QSG_LOG_INFO()).setEnabled(QtDebugMsg, true);
s_instance = QSGContext::createWindowManager();
@@ -336,6 +336,7 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window)
if (!gl) {
gl = new QOpenGLContext();
gl->setFormat(window->requestedFormat());
+ gl->setScreen(window->screen());
if (qt_gl_global_share_context())
gl->setShareContext(qt_gl_global_share_context());
if (!gl->create()) {
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
index 95a0d0f02a..074e7633da 100644
--- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp
+++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
@@ -910,9 +910,11 @@ void QSGThreadedRenderLoop::handleExposure(QQuickWindow *window)
w->thread->window = window;
if (w->window->width() <= 0 || w->window->height() <= 0
- || !w->window->geometry().intersects(w->window->screen()->availableGeometry())) {
+ || (w->window->isTopLevel() && !w->window->geometry().intersects(w->window->screen()->availableGeometry()))) {
#ifndef QT_NO_DEBUG
- qWarning("QSGThreadedRenderLoop: expose event received for window with invalid geometry.");
+ qWarning().noquote().nospace() << "QSGThreadedRenderLoop: expose event received for window "
+ << w->window << " with invalid geometry: " << w->window->geometry()
+ << " on " << w->window->screen();
#endif
}
@@ -931,6 +933,7 @@ void QSGThreadedRenderLoop::handleExposure(QQuickWindow *window)
if (qt_gl_global_share_context())
w->thread->gl->setShareContext(qt_gl_global_share_context());
w->thread->gl->setFormat(w->window->requestedFormat());
+ w->thread->gl->setScreen(w->window->screen());
if (!w->thread->gl->create()) {
const bool isEs = w->thread->gl->isOpenGLES();
delete w->thread->gl;
diff --git a/src/quick/scenegraph/qsgwindowsrenderloop.cpp b/src/quick/scenegraph/qsgwindowsrenderloop.cpp
index 309e877dae..c571e60018 100644
--- a/src/quick/scenegraph/qsgwindowsrenderloop.cpp
+++ b/src/quick/scenegraph/qsgwindowsrenderloop.cpp
@@ -162,6 +162,7 @@ void QSGWindowsRenderLoop::show(QQuickWindow *window)
RLDEBUG(" - creating GL context");
m_gl = new QOpenGLContext();
m_gl->setFormat(window->requestedFormat());
+ m_gl->setScreen(window->screen());
if (qt_gl_global_share_context())
m_gl->setShareContext(qt_gl_global_share_context());
bool created = m_gl->create();
diff --git a/src/quick/util/qquickanimation.cpp b/src/quick/util/qquickanimation.cpp
index a39d734de3..3a0c19e3d2 100644
--- a/src/quick/util/qquickanimation.cpp
+++ b/src/quick/util/qquickanimation.cpp
@@ -867,7 +867,7 @@ void QActionAnimation::updateState(State newState, State oldState)
void QActionAnimation::debugAnimation(QDebug d) const
{
- d << "ActionAnimation(" << hex << (void *) this << dec << ")";
+ d << "ActionAnimation(" << hex << (const void *) this << dec << ")";
if (animAction) {
int indentLevel = 1;
@@ -1960,7 +1960,7 @@ void QQuickBulkValueAnimator::topLevelAnimationLoopChanged()
void QQuickBulkValueAnimator::debugAnimation(QDebug d) const
{
- d << "BulkValueAnimation(" << hex << (void *) this << dec << ")" << "duration:" << duration();
+ d << "BulkValueAnimation(" << hex << (const void *) this << dec << ")" << "duration:" << duration();
if (animValue) {
int indentLevel = 1;
diff --git a/src/quick/util/qquickimageprovider.h b/src/quick/util/qquickimageprovider.h
index ea3f37c478..cc03eb0fa0 100644
--- a/src/quick/util/qquickimageprovider.h
+++ b/src/quick/util/qquickimageprovider.h
@@ -87,9 +87,15 @@ public:
ImageType imageType() const;
Flags flags() const;
+#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
+ virtual QImage requestImage(const QString &id, QSize *size, const QSize& requestedSize, bool requestedAutoTransform);
+ virtual QPixmap requestPixmap(const QString &id, QSize *size, const QSize& requestedSize, bool requestedAutoTransform);
+ virtual QQuickTextureFactory *requestTexture(const QString &id, QSize *size, const QSize &requestedSize, bool requestedAutoTransform);
+#else
virtual QImage requestImage(const QString &id, QSize *size, const QSize& requestedSize);
virtual QPixmap requestPixmap(const QString &id, QSize *size, const QSize& requestedSize);
virtual QQuickTextureFactory *requestTexture(const QString &id, QSize *size, const QSize &requestedSize);
+#endif
private:
QQuickImageProviderPrivate *d;
diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp
index 810629cdb6..f36d06d00d 100644
--- a/src/quick/util/qquickpixmapcache.cpp
+++ b/src/quick/util/qquickpixmapcache.cpp
@@ -131,15 +131,17 @@ public:
QUrl url;
bool loading;
+ AutoTransform autoTransform;
int redirectCount;
class Event : public QEvent {
public:
- Event(ReadError, const QString &, const QSize &, QQuickTextureFactory *factory);
+ Event(ReadError, const QString &, const QSize &, AutoTransform, QQuickTextureFactory *factory);
ReadError error;
QString errorString;
QSize implicitSize;
+ AutoTransform autoTransform;
QQuickTextureFactory *textureFactory;
};
void postReply(ReadError, const QString &, const QSize &, QQuickTextureFactory *factory);
@@ -193,7 +195,7 @@ protected:
private:
friend class QQuickPixmapReaderThreadObject;
void processJobs();
- void processJob(QQuickPixmapReply *, const QUrl &, const QString &, QQuickImageProvider::ImageType, QQuickImageProvider *);
+ void processJob(QQuickPixmapReply *, const QUrl &, const QString &, AutoTransform, QQuickImageProvider::ImageType, QQuickImageProvider *);
void networkRequestDone(QNetworkReply *);
void asyncResponseFinished(QQuickImageResponse *);
@@ -224,25 +226,32 @@ public:
class QQuickPixmapData
{
public:
- QQuickPixmapData(QQuickPixmap *pixmap, const QUrl &u, const QSize &s, const QString &e)
+ QQuickPixmapData(QQuickPixmap *pixmap, const QUrl &u, const QSize &s, AutoTransform transform, const QString &e)
: refCount(1), inCache(false), pixmapStatus(QQuickPixmap::Error),
- url(u), errorString(e), requestSize(s), textureFactory(0), reply(0), prevUnreferenced(0),
+ url(u), errorString(e), requestSize(s),
+ requestedTransform(transform), appliedTransform(UsePluginDefault),
+ textureFactory(0), reply(0), prevUnreferenced(0),
prevUnreferencedPtr(0), nextUnreferenced(0)
{
declarativePixmaps.insert(pixmap);
}
- QQuickPixmapData(QQuickPixmap *pixmap, const QUrl &u, const QSize &r)
+ QQuickPixmapData(QQuickPixmap *pixmap, const QUrl &u, const QSize &r, AutoTransform rTransform, AutoTransform aTransform)
: refCount(1), inCache(false), pixmapStatus(QQuickPixmap::Loading),
- url(u), requestSize(r), textureFactory(0), reply(0), prevUnreferenced(0), prevUnreferencedPtr(0),
+ url(u), requestSize(r),
+ requestedTransform(rTransform), appliedTransform(aTransform),
+ textureFactory(0), reply(0), prevUnreferenced(0), prevUnreferencedPtr(0),
nextUnreferenced(0)
{
declarativePixmaps.insert(pixmap);
}
- QQuickPixmapData(QQuickPixmap *pixmap, const QUrl &u, QQuickTextureFactory *texture, const QSize &s, const QSize &r)
+ QQuickPixmapData(QQuickPixmap *pixmap, const QUrl &u, QQuickTextureFactory *texture,
+ const QSize &s, const QSize &r, AutoTransform rTransform, AutoTransform aTransform)
: refCount(1), inCache(false), pixmapStatus(QQuickPixmap::Ready),
- url(u), implicitSize(s), requestSize(r), textureFactory(texture), reply(0), prevUnreferenced(0),
+ url(u), implicitSize(s), requestSize(r),
+ requestedTransform(rTransform), appliedTransform(aTransform),
+ textureFactory(texture), reply(0), prevUnreferenced(0),
prevUnreferencedPtr(0), nextUnreferenced(0)
{
declarativePixmaps.insert(pixmap);
@@ -250,6 +259,7 @@ public:
QQuickPixmapData(QQuickPixmap *pixmap, QQuickTextureFactory *texture)
: refCount(1), inCache(false), pixmapStatus(QQuickPixmap::Ready),
+ requestedTransform(UsePluginDefault), appliedTransform(UsePluginDefault),
textureFactory(texture), reply(0), prevUnreferenced(0),
prevUnreferencedPtr(0), nextUnreferenced(0)
{
@@ -283,6 +293,8 @@ public:
QString errorString;
QSize implicitSize;
QSize requestSize;
+ AutoTransform requestedTransform;
+ AutoTransform appliedTransform;
QQuickTextureFactory *textureFactory;
@@ -311,11 +323,11 @@ void QQuickPixmapReply::postReply(ReadError error, const QString &errorString,
const QSize &implicitSize, QQuickTextureFactory *factory)
{
loading = false;
- QCoreApplication::postEvent(this, new Event(error, errorString, implicitSize, factory));
+ QCoreApplication::postEvent(this, new Event(error, errorString, implicitSize, autoTransform, factory));
}
-QQuickPixmapReply::Event::Event(ReadError e, const QString &s, const QSize &iSize, QQuickTextureFactory *factory)
- : QEvent(QEvent::User), error(e), errorString(s), implicitSize(iSize), textureFactory(factory)
+QQuickPixmapReply::Event::Event(ReadError e, const QString &s, const QSize &iSize, AutoTransform iTransformed, QQuickTextureFactory *factory)
+ : QEvent(QEvent::User), error(e), errorString(s), implicitSize(iSize), autoTransform(iTransformed), textureFactory(factory)
{
}
@@ -352,9 +364,13 @@ static void maybeRemoveAlpha(QImage *image)
}
static bool readImage(const QUrl& url, QIODevice *dev, QImage *image, QString *errorString, QSize *impsize,
- const QSize &requestSize)
+ const QSize &requestSize, AutoTransform &autoTransform)
{
QImageReader imgio(dev);
+ if (autoTransform != UsePluginDefault)
+ imgio.setAutoTransform(autoTransform == ApplyTransform);
+ else
+ autoTransform = imgio.autoTransform() ? ApplyTransform : DoNotApplyTransform;
const bool force_scale = imgio.format() == "svg" || imgio.format() == "svgz";
@@ -464,7 +480,7 @@ void QQuickPixmapReader::networkRequestDone(QNetworkReply *reply)
QByteArray all = reply->readAll();
QBuffer buff(&all);
buff.open(QIODevice::ReadOnly);
- if (!readImage(reply->url(), &buff, &image, &errorString, &readSize, job->requestSize))
+ if (!readImage(reply->url(), &buff, &image, &errorString, &readSize, job->requestSize, job->autoTransform))
error = QQuickPixmapReply::Decoding;
}
// send completion event to the QQuickPixmapReply
@@ -599,8 +615,9 @@ void QQuickPixmapReader::processJobs()
PIXMAP_PROFILE(pixmapStateChanged<QQuickProfiler::PixmapLoadingStarted>(url));
+ AutoTransform autoTransform = job->autoTransform;
locker.unlock();
- processJob(job, url, localFile, imageType, provider);
+ processJob(job, url, localFile, autoTransform, imageType, provider);
locker.relock();
}
}
@@ -612,7 +629,7 @@ void QQuickPixmapReader::processJobs()
}
void QQuickPixmapReader::processJob(QQuickPixmapReply *runningJob, const QUrl &url, const QString &localFile,
- QQuickImageProvider::ImageType imageType, QQuickImageProvider *provider)
+ AutoTransform autoTransform, QQuickImageProvider::ImageType imageType, QQuickImageProvider *provider)
{
// fetch
if (url.scheme() == QLatin1String("image")) {
@@ -701,7 +718,7 @@ void QQuickPixmapReader::processJob(QQuickPixmapReply *runningJob, const QUrl &u
QFile f(localFile);
QSize readSize;
if (f.open(QIODevice::ReadOnly)) {
- if (!readImage(url, &f, &image, &errorStr, &readSize, runningJob->requestSize))
+ if (!readImage(url, &f, &image, &errorStr, &readSize, runningJob->requestSize, autoTransform))
errorCode = QQuickPixmapReply::Loading;
} else {
errorStr = QQuickPixmap::tr("Cannot open: %1").arg(url.toString());
@@ -800,16 +817,17 @@ class QQuickPixmapKey
public:
const QUrl *url;
const QSize *size;
+ AutoTransform autoTransform;
};
inline bool operator==(const QQuickPixmapKey &lhs, const QQuickPixmapKey &rhs)
{
- return *lhs.size == *rhs.size && *lhs.url == *rhs.url;
+ return *lhs.size == *rhs.size && *lhs.url == *rhs.url && lhs.autoTransform == rhs.autoTransform;
}
inline uint qHash(const QQuickPixmapKey &key)
{
- return qHash(*key.url) ^ key.size->width() ^ key.size->height();
+ return qHash(*key.url) ^ (key.size->width()*7) ^ (key.size->height()*17) ^ (key.autoTransform * 0x5c5c5c5c);
}
class QQuickPixmapStore : public QObject
@@ -977,7 +995,7 @@ void QQuickPixmap::purgeCache()
}
QQuickPixmapReply::QQuickPixmapReply(QQuickPixmapData *d)
-: data(d), engineForReader(0), requestSize(d->requestSize), url(d->url), loading(false), redirectCount(0)
+: data(d), engineForReader(0), requestSize(d->requestSize), url(d->url), loading(false), autoTransform(d->appliedTransform), redirectCount(0)
{
if (finishedIndex == -1) {
finishedIndex = QMetaMethod::fromSignal(&QQuickPixmapReply::finished).methodIndex();
@@ -1001,6 +1019,7 @@ bool QQuickPixmapReply::event(QEvent *event)
if (data->pixmapStatus == QQuickPixmap::Ready) {
data->textureFactory = de->textureFactory;
data->implicitSize = de->implicitSize;
+ data->appliedTransform = de->autoTransform;
PIXMAP_PROFILE(pixmapLoadingFinished(data->url,
data->textureFactory != 0 && data->textureFactory->textureSize().isValid() ?
data->textureFactory->textureSize() :
@@ -1071,7 +1090,7 @@ void QQuickPixmapData::release()
void QQuickPixmapData::addToCache()
{
if (!inCache) {
- QQuickPixmapKey key = { &url, &requestSize };
+ QQuickPixmapKey key = { &url, &requestSize, requestedTransform };
pixmapStore()->m_cache.insert(key, this);
inCache = true;
PIXMAP_PROFILE(pixmapCountChanged<QQuickProfiler::PixmapCacheCountChanged>(
@@ -1082,7 +1101,7 @@ void QQuickPixmapData::addToCache()
void QQuickPixmapData::removeFromCache()
{
if (inCache) {
- QQuickPixmapKey key = { &url, &requestSize };
+ QQuickPixmapKey key = { &url, &requestSize, requestedTransform };
pixmapStore()->m_cache.remove(key);
inCache = false;
PIXMAP_PROFILE(pixmapCountChanged<QQuickProfiler::PixmapCacheCountChanged>(
@@ -1090,7 +1109,7 @@ void QQuickPixmapData::removeFromCache()
}
}
-static QQuickPixmapData* createPixmapDataSync(QQuickPixmap *declarativePixmap, QQmlEngine *engine, const QUrl &url, const QSize &requestSize, bool *ok)
+static QQuickPixmapData* createPixmapDataSync(QQuickPixmap *declarativePixmap, QQmlEngine *engine, const QUrl &url, const QSize &requestSize, AutoTransform autoTransform, bool *ok)
{
if (url.scheme() == QLatin1String("image")) {
QSize readSize;
@@ -1102,14 +1121,14 @@ static QQuickPixmapData* createPixmapDataSync(QQuickPixmap *declarativePixmap, Q
switch (imageType) {
case QQuickImageProvider::Invalid:
- return new QQuickPixmapData(declarativePixmap, url, requestSize,
+ return new QQuickPixmapData(declarativePixmap, url, requestSize, autoTransform,
QQuickPixmap::tr("Invalid image provider: %1").arg(url.toString()));
case QQuickImageProvider::Texture:
{
QQuickTextureFactory *texture = provider->requestTexture(imageId(url), &readSize, requestSize);
if (texture) {
*ok = true;
- return new QQuickPixmapData(declarativePixmap, url, texture, readSize, requestSize);
+ return new QQuickPixmapData(declarativePixmap, url, texture, readSize, requestSize, autoTransform, UsePluginDefault);
}
}
@@ -1118,7 +1137,7 @@ static QQuickPixmapData* createPixmapDataSync(QQuickPixmap *declarativePixmap, Q
QImage image = provider->requestImage(imageId(url), &readSize, requestSize);
if (!image.isNull()) {
*ok = true;
- return new QQuickPixmapData(declarativePixmap, url, QQuickTextureFactory::textureFactoryForImage(image), readSize, requestSize);
+ return new QQuickPixmapData(declarativePixmap, url, QQuickTextureFactory::textureFactoryForImage(image), readSize, requestSize, autoTransform, UsePluginDefault);
}
}
case QQuickImageProvider::Pixmap:
@@ -1126,7 +1145,7 @@ static QQuickPixmapData* createPixmapDataSync(QQuickPixmap *declarativePixmap, Q
QPixmap pixmap = provider->requestPixmap(imageId(url), &readSize, requestSize);
if (!pixmap.isNull()) {
*ok = true;
- return new QQuickPixmapData(declarativePixmap, url, QQuickTextureFactory::textureFactoryForImage(pixmap.toImage()), readSize, requestSize);
+ return new QQuickPixmapData(declarativePixmap, url, QQuickTextureFactory::textureFactoryForImage(pixmap.toImage()), readSize, requestSize, autoTransform, UsePluginDefault);
}
}
case QQuickImageProvider::ImageResponse:
@@ -1137,7 +1156,7 @@ static QQuickPixmapData* createPixmapDataSync(QQuickPixmap *declarativePixmap, Q
}
// provider has bad image type, or provider returned null image
- return new QQuickPixmapData(declarativePixmap, url, requestSize,
+ return new QQuickPixmapData(declarativePixmap, url, requestSize, autoTransform,
QQuickPixmap::tr("Failed to get image from provider: %1").arg(url.toString()));
}
@@ -1151,17 +1170,17 @@ static QQuickPixmapData* createPixmapDataSync(QQuickPixmap *declarativePixmap, Q
if (f.open(QIODevice::ReadOnly)) {
QImage image;
-
- if (readImage(url, &f, &image, &errorString, &readSize, requestSize)) {
+ AutoTransform appliedTransform = autoTransform;
+ if (readImage(url, &f, &image, &errorString, &readSize, requestSize, appliedTransform)) {
*ok = true;
- return new QQuickPixmapData(declarativePixmap, url, QQuickTextureFactory::textureFactoryForImage(image), readSize, requestSize);
+ return new QQuickPixmapData(declarativePixmap, url, QQuickTextureFactory::textureFactoryForImage(image), readSize, requestSize, autoTransform, appliedTransform);
}
errorString = QQuickPixmap::tr("Invalid image data: %1").arg(url.toString());
} else {
errorString = QQuickPixmap::tr("Cannot open: %1").arg(url.toString());
}
- return new QQuickPixmapData(declarativePixmap, url, requestSize, errorString);
+ return new QQuickPixmapData(declarativePixmap, url, requestSize, autoTransform, errorString);
}
@@ -1190,7 +1209,7 @@ QQuickPixmap::QQuickPixmap(QQmlEngine *engine, const QUrl &url, const QSize &siz
QQuickPixmap::QQuickPixmap(const QUrl &url, const QImage &image)
{
- d = new QQuickPixmapData(this, url, new QQuickDefaultTextureFactory(image), image.size(), QSize());
+ d = new QQuickPixmapData(this, url, new QQuickDefaultTextureFactory(image), image.size(), QSize(), UsePluginDefault, UsePluginDefault);
d->addToCache();
}
@@ -1263,6 +1282,14 @@ const QSize &QQuickPixmap::requestSize() const
return nullPixmap()->size;
}
+AutoTransform QQuickPixmap::autoTransform() const
+{
+ if (d)
+ return d->appliedTransform;
+ else
+ return UsePluginDefault;
+}
+
QQuickTextureFactory *QQuickPixmap::textureFactory() const
{
if (d)
@@ -1338,13 +1365,18 @@ void QQuickPixmap::load(QQmlEngine *engine, const QUrl &url, const QSize &size)
void QQuickPixmap::load(QQmlEngine *engine, const QUrl &url, const QSize &requestSize, QQuickPixmap::Options options)
{
+ load(engine, url, requestSize, options, UsePluginDefault);
+}
+
+void QQuickPixmap::load(QQmlEngine *engine, const QUrl &url, const QSize &requestSize, QQuickPixmap::Options options, AutoTransform requestAutoTransform)
+{
if (d) {
d->declarativePixmaps.remove(this);
d->release();
d = 0;
}
- QQuickPixmapKey key = { &url, &requestSize };
+ QQuickPixmapKey key = { &url, &requestSize, requestAutoTransform };
QQuickPixmapStore *store = pixmapStore();
QHash<QQuickPixmapKey, QQuickPixmapData *>::Iterator iter = store->m_cache.end();
@@ -1370,7 +1402,7 @@ void QQuickPixmap::load(QQmlEngine *engine, const QUrl &url, const QSize &reques
if (!(options & QQuickPixmap::Asynchronous)) {
bool ok = false;
PIXMAP_PROFILE(pixmapStateChanged<QQuickProfiler::PixmapLoadingStarted>(url));
- d = createPixmapDataSync(this, engine, url, requestSize, &ok);
+ d = createPixmapDataSync(this, engine, url, requestSize, requestAutoTransform, &ok);
if (ok) {
PIXMAP_PROFILE(pixmapLoadingFinished(url, QSize(width(), height())));
if (options & QQuickPixmap::Cache)
@@ -1386,7 +1418,7 @@ void QQuickPixmap::load(QQmlEngine *engine, const QUrl &url, const QSize &reques
if (!engine)
return;
- d = new QQuickPixmapData(this, url, requestSize);
+ d = new QQuickPixmapData(this, url, requestSize, requestAutoTransform, requestAutoTransform);
if (options & QQuickPixmap::Cache)
d->addToCache();
@@ -1422,7 +1454,7 @@ void QQuickPixmap::clear(QObject *obj)
bool QQuickPixmap::isCached(const QUrl &url, const QSize &requestSize)
{
- QQuickPixmapKey key = { &url, &requestSize };
+ QQuickPixmapKey key = { &url, &requestSize, UsePluginDefault };
QQuickPixmapStore *store = pixmapStore();
return store->m_cache.contains(key);
diff --git a/src/quick/util/qquickpixmapcache_p.h b/src/quick/util/qquickpixmapcache_p.h
index 50a9e1254c..482a2e5653 100644
--- a/src/quick/util/qquickpixmapcache_p.h
+++ b/src/quick/util/qquickpixmapcache_p.h
@@ -49,6 +49,12 @@ class QQmlEngine;
class QQuickPixmapData;
class QQuickTextureFactory;
+enum AutoTransform {
+ UsePluginDefault = -1,
+ ApplyTransform = 0,
+ DoNotApplyTransform = 1
+};
+
class QQuickDefaultTextureFactory : public QQuickTextureFactory
{
Q_OBJECT
@@ -92,6 +98,7 @@ public:
const QUrl &url() const;
const QSize &implicitSize() const;
const QSize &requestSize() const;
+ AutoTransform autoTransform() const;
QImage image() const;
void setImage(const QImage &);
void setPixmap(const QQuickPixmap &other);
@@ -106,6 +113,7 @@ public:
void load(QQmlEngine *, const QUrl &, QQuickPixmap::Options options);
void load(QQmlEngine *, const QUrl &, const QSize &);
void load(QQmlEngine *, const QUrl &, const QSize &, QQuickPixmap::Options options);
+ void load(QQmlEngine *, const QUrl &, const QSize &, QQuickPixmap::Options options, AutoTransform autoTransform);
void clear();
void clear(QObject *);
diff --git a/src/quick/util/qquicksmoothedanimation.cpp b/src/quick/util/qquicksmoothedanimation.cpp
index 71dacfcb1d..6d585d38a7 100644
--- a/src/quick/util/qquicksmoothedanimation.cpp
+++ b/src/quick/util/qquicksmoothedanimation.cpp
@@ -307,7 +307,7 @@ void QSmoothedAnimation::init()
void QSmoothedAnimation::debugAnimation(QDebug d) const
{
- d << "SmoothedAnimationJob(" << hex << (void *) this << dec << ")" << "duration:" << userDuration
+ d << "SmoothedAnimationJob(" << hex << (const void *) this << dec << ")" << "duration:" << userDuration
<< "velocity:" << velocity << "target:" << target.object() << "property:" << target.name()
<< "to:" << to << "current velocity:" << trackVelocity;
}
diff --git a/src/quick/util/qquickspringanimation.cpp b/src/quick/util/qquickspringanimation.cpp
index b68afbecdd..125d6f5ef6 100644
--- a/src/quick/util/qquickspringanimation.cpp
+++ b/src/quick/util/qquickspringanimation.cpp
@@ -313,7 +313,7 @@ void QSpringAnimation::updateState(QAbstractAnimationJob::State newState, QAbstr
void QSpringAnimation::debugAnimation(QDebug d) const
{
- d << "SpringAnimationJob(" << hex << (void *) this << dec << ")" << "velocity:" << maxVelocity
+ d << "SpringAnimationJob(" << hex << (const void *) this << dec << ")" << "velocity:" << maxVelocity
<< "spring:" << spring << "damping:" << damping << "epsilon:" << epsilon << "modulus:" << modulus
<< "mass:" << mass << "target:" << target.object() << "property:" << target.name()
<< "to:" << to << "current velocity:" << velocity;
diff --git a/src/quick/util/qquicktimeline.cpp b/src/quick/util/qquicktimeline.cpp
index c3ff630dd7..88fc03bba8 100644
--- a/src/quick/util/qquicktimeline.cpp
+++ b/src/quick/util/qquicktimeline.cpp
@@ -717,7 +717,7 @@ void QQuickTimeLine::updateCurrentTime(int v)
void QQuickTimeLine::debugAnimation(QDebug d) const
{
- d << "QuickTimeLine(" << hex << (void *) this << dec << ")";
+ d << "QuickTimeLine(" << hex << (const void *) this << dec << ")";
}
bool operator<(const QPair<int, Update> &lhs,
diff --git a/src/quick/util/qquickvaluetypes_p.h b/src/quick/util/qquickvaluetypes_p.h
index 75ed2bce01..f62306ed01 100644
--- a/src/quick/util/qquickvaluetypes_p.h
+++ b/src/quick/util/qquickvaluetypes_p.h
@@ -283,11 +283,15 @@ class QQuickFontValueType
Q_PROPERTY(qreal wordSpacing READ wordSpacing WRITE setWordSpacing FINAL)
public:
- enum FontWeight { Light = QFont::Light,
- Normal = QFont::Normal,
- DemiBold = QFont::DemiBold,
- Bold = QFont::Bold,
- Black = QFont::Black };
+ enum FontWeight { Thin = QFont::Thin,
+ ExtraLight = QFont::ExtraLight,
+ Light = QFont::Light,
+ Normal = QFont::Normal,
+ Medium = QFont::Medium,
+ DemiBold = QFont::DemiBold,
+ Bold = QFont::Bold,
+ ExtraBold = QFont::ExtraBold,
+ Black = QFont::Black };
enum Capitalization { MixedCase = QFont::MixedCase,
AllUppercase = QFont::AllUppercase,
AllLowercase = QFont::AllLowercase,
diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp
index 5dd439fdd0..1afea402fd 100644
--- a/src/quickwidgets/qquickwidget.cpp
+++ b/src/quickwidgets/qquickwidget.cpp
@@ -698,8 +698,10 @@ void QQuickWidgetPrivate::createContext()
context = new QOpenGLContext;
context->setFormat(offscreenWindow->requestedFormat());
- if (qt_gl_global_share_context())
+ if (qt_gl_global_share_context()) {
context->setShareContext(qt_gl_global_share_context());
+ context->setScreen(context->shareContext()->screen());
+ }
if (!context->create()) {
const bool isEs = context->isOpenGLES();
@@ -714,6 +716,7 @@ void QQuickWidgetPrivate::createContext()
// contains a QSurfaceFormat representing the _actual_ format of the underlying
// configuration. This is essential to get a surface that is compatible with the context.
offscreenSurface->setFormat(context->format());
+ offscreenSurface->setScreen(context->screen());
offscreenSurface->create();
}
@@ -749,7 +752,14 @@ void QQuickWidget::createFramebufferObject()
if (context->shareContext() != QWidgetPrivate::get(window())->shareContext()) {
context->setShareContext(QWidgetPrivate::get(window())->shareContext());
- context->create();
+ context->setScreen(context->shareContext()->screen());
+ if (!context->create())
+ qWarning("QQuickWidget: Failed to recreate context");
+ // The screen may be different so we must recreate the offscreen surface too.
+ // Unlike QOpenGLContext, QOffscreenSurface's create() does not recreate so have to destroy() first.
+ d->offscreenSurface->destroy();
+ d->offscreenSurface->setScreen(context->screen());
+ d->offscreenSurface->create();
}
context->makeCurrent(d->offscreenSurface);
@@ -1063,7 +1073,7 @@ void QQuickWidget::showEvent(QShowEvent *)
Q_D(QQuickWidget);
d->updatePending = false;
d->createContext();
- triggerUpdate();
+ d->render(true);
}
/*! \reimp */
diff --git a/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler.pro b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler.pro
index eb41f759c9..4bcbc2a97e 100644
--- a/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler.pro
+++ b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler.pro
@@ -1,13 +1,4 @@
-CONFIG += testcase
-TARGET = tst_qqmldebuggingenabler
-QT += qml testlib gui-private core-private
-osx:CONFIG -= app_bundle
+TEMPLATE = subdirs
+SUBDIRS = qqmldebuggingenabler qqmldebuggingenablerserver
-SOURCES += tst_qqmldebuggingenabler.cpp
-
-INCLUDEPATH += ../shared
-include(../../../shared/util.pri)
-include(../shared/debugutil.pri)
-
-OTHER_FILES += data/test.qml
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 QT_QML_DEBUG_NO_WARNING
+qqmldebuggingenabler.depends = qqmldebuggingenablerserver
diff --git a/tests/auto/qml/debugger/qqmldebuggingenabler/data/test.qml b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/data/test.qml
index 5a7fa718f2..5a7fa718f2 100644
--- a/tests/auto/qml/debugger/qqmldebuggingenabler/data/test.qml
+++ b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/data/test.qml
diff --git a/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/qqmldebuggingenabler.pro b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/qqmldebuggingenabler.pro
new file mode 100644
index 0000000000..f8014f04f4
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/qqmldebuggingenabler.pro
@@ -0,0 +1,13 @@
+CONFIG += testcase
+TARGET = tst_qqmldebuggingenabler
+QT += qml testlib gui-private core-private
+CONFIG -= debug_and_release_target
+osx:CONFIG -= app_bundle
+
+SOURCES += tst_qqmldebuggingenabler.cpp
+
+INCLUDEPATH += ../../shared
+include(../../../../shared/util.pri)
+include(../../shared/debugutil.pri)
+
+OTHER_FILES += data/test.qml
diff --git a/tests/auto/qml/debugger/qqmldebuggingenabler/tst_qqmldebuggingenabler.cpp b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/tst_qqmldebuggingenabler.cpp
index 73abc03e28..4ab1ac0a4c 100644
--- a/tests/auto/qml/debugger/qqmldebuggingenabler/tst_qqmldebuggingenabler.cpp
+++ b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/tst_qqmldebuggingenabler.cpp
@@ -92,7 +92,7 @@ bool tst_QQmlDebuggingEnabler::init(bool blockMode, bool qmlscene, int portFrom,
process = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene", this);
process->setMaximumBindErrors(1);
} else {
- process = new QQmlDebugProcess(QCoreApplication::applicationFilePath(), this);
+ process = new QQmlDebugProcess(QCoreApplication::applicationDirPath() + QLatin1String("/qqmldebuggingenablerserver"), this);
process->setMaximumBindErrors(portTo - portFrom);
}
@@ -103,7 +103,6 @@ bool tst_QQmlDebuggingEnabler::init(bool blockMode, bool qmlscene, int portFrom,
testFile(QLatin1String("test.qml")));
} else {
QStringList args;
- args << QLatin1String("-server");
if (blockMode)
args << QLatin1String("-block");
args << QString::number(portFrom) << QString::number(portTo);
@@ -163,27 +162,7 @@ void tst_QQmlDebuggingEnabler::customBlock()
QVERIFY(init(true, false, 5555, 5565));
}
-namespace QQmlDebuggingEnablerTest {
- QTEST_MAIN(tst_QQmlDebuggingEnabler)
-}
-
-int main(int argc, char *argv[])
-{
- if (argc > 1 && QLatin1String(argv[1]) == QLatin1String("-server")) {
- int one = 1;
- QCoreApplication app(one, argv);
- bool block = argc > 2 && QLatin1String(argv[2]) == QLatin1String("-block");
- int portFrom = QString(QLatin1String(argv[argc - 2])).toInt();
- int portTo = QString(QLatin1String(argv[argc - 1])).toInt();
- while (portFrom <= portTo)
- QQmlDebuggingEnabler::startTcpDebugServer(portFrom++, block);
- QQmlEngine engine;
- Q_UNUSED(engine);
- app.exec();
- } else {
- QQmlDebuggingEnablerTest::main(argc, argv);
- }
-}
+QTEST_MAIN(tst_QQmlDebuggingEnabler)
#include "tst_qqmldebuggingenabler.moc"
diff --git a/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenablerserver/qqmldebuggingenablerserver.cpp b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenablerserver/qqmldebuggingenablerserver.cpp
new file mode 100644
index 0000000000..68279413e0
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenablerserver/qqmldebuggingenablerserver.cpp
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "debugutil_p.h"
+#include <QtCore/QCoreApplication>
+
+int main(int argc, char *argv[])
+{
+ bool block = false;
+ int portFrom = 0;
+ int portTo = 0;
+
+ QCoreApplication app(argc, argv);
+ QStringList arguments = app.arguments();
+ arguments.removeFirst();
+
+ if (arguments.size() && arguments.first() == QLatin1String("-block")) {
+ block = true;
+ arguments.removeFirst();
+ }
+
+ if (arguments.size() >= 2) {
+ portFrom = arguments.takeFirst().toInt();
+ portTo = arguments.takeFirst().toInt();
+ }
+
+ if (!portFrom || !portTo)
+ qFatal("Port range has to be specified.");
+
+ while (portFrom <= portTo)
+ QQmlDebuggingEnabler::startTcpDebugServer(portFrom++, block);
+ QQmlEngine engine;
+ Q_UNUSED(engine);
+ return app.exec();
+}
+
diff --git a/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenablerserver/qqmldebuggingenablerserver.pro b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenablerserver/qqmldebuggingenablerserver.pro
new file mode 100644
index 0000000000..fdd9ce8f11
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenablerserver/qqmldebuggingenablerserver.pro
@@ -0,0 +1,11 @@
+QT += qml testlib
+osx:CONFIG -= app_bundle
+CONFIG -= debug_and_release_target
+INCLUDEPATH += ../../shared
+SOURCES += qqmldebuggingenablerserver.cpp
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 QT_QML_DEBUG_NO_WARNING
+
+DESTDIR = ../qqmldebuggingenabler
+
+target.path = $$[QT_INSTALL_TESTS]/tst_qqmldebuggingenabler
+INSTALLS += target
diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
index 61816b6cc0..5a9d6d20eb 100644
--- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp
+++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
@@ -178,6 +178,8 @@ private slots:
void intConversion_QTBUG43309();
void toFixed();
+ void argumentEvaluationOrder();
+
signals:
void testSignal();
};
@@ -3665,6 +3667,25 @@ void tst_QJSEngine::toFixed()
QCOMPARE(result.toString(), QStringLiteral("12.1"));
}
+void tst_QJSEngine::argumentEvaluationOrder()
+{
+ QJSEngine engine;
+ QJSValue ok = engine.evaluate(
+ "function record(arg1, arg2) {\n"
+ " parameters = [arg1, arg2]\n"
+ "}\n"
+ "function test() {\n"
+ " var i = 2;\n"
+ " record(i, i += 2);\n"
+ "}\n"
+ "test()\n"
+ "parameters[0] == 2 && parameters[1] == 4");
+ qDebug() << ok.toString();
+ QVERIFY(ok.isBool());
+ QVERIFY(ok.toBool());
+
+}
+
QTEST_MAIN(tst_QJSEngine)
#include "tst_qjsengine.moc"
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/statusText.qml b/tests/auto/qml/qqmlxmlhttprequest/data/statusText.qml
index bf59a1e9f9..b47a0f1af0 100644
--- a/tests/auto/qml/qqmlxmlhttprequest/data/statusText.qml
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/statusText.qml
@@ -48,7 +48,7 @@ QtObject {
if (x.statusText == expectedStatus)
done = true;
- dataOK = (x.responseText == "QML Rocks!\n");
+ dataOK = (x.responseText == "QML Rocks!\n") && (x.response == "QML Rocks!\n");
x.open("GET", url);
x.setRequestHeader("Accept-Language", "en-US");
diff --git a/tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp b/tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp
index ece439d01a..67ee1a3714 100644
--- a/tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp
+++ b/tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp
@@ -78,6 +78,7 @@ private slots:
// void drop_external();
void competingDrags();
void simultaneousDrags();
+ void dropStuff();
private:
QQmlEngine engine;
@@ -1157,6 +1158,34 @@ void tst_QQuickDropArea::simultaneousDrags()
QWindowSystemInterface::handleDrop(&alternateWindow, &data, QPoint(50, 50), Qt::CopyAction);
}
+void tst_QQuickDropArea::dropStuff()
+{
+ QQuickWindow window;
+ QQmlComponent component(&engine);
+ component.setData(
+ "import QtQuick 2.3\n"
+ "DropArea {\n"
+ "width: 100; height: 100\n"
+ "property var array\n"
+ "onDropped: { array = drop.getDataAsArrayBuffer('text/x-red'); }\n"
+ "}", QUrl());
+
+ QScopedPointer<QObject> object(component.create());
+ QQuickItem *dropArea = qobject_cast<QQuickItem *>(object.data());
+ QVERIFY(dropArea);
+ dropArea->setParentItem(window.contentItem());
+
+ QMimeData data;
+ data.setData("text/x-red", "red");
+
+ QCOMPARE(evaluate<QVariant>(dropArea, "array"), QVariant());
+
+ QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction);
+ QWindowSystemInterface::handleDrop(&window, &data, QPoint(50, 50), Qt::CopyAction);
+ QCOMPARE(evaluate<int>(dropArea, "array.byteLength"), 3);
+ QCOMPARE(evaluate<QByteArray>(dropArea, "array"), QByteArray("red"));
+}
+
QTEST_MAIN(tst_QQuickDropArea)
#include "tst_qquickdroparea.moc"
diff --git a/tests/auto/quick/qquicktext/data/implicitSizes.qml b/tests/auto/quick/qquicktext/data/implicitSizes.qml
new file mode 100644
index 0000000000..fae67c0273
--- /dev/null
+++ b/tests/auto/quick/qquicktext/data/implicitSizes.qml
@@ -0,0 +1,99 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 200
+ height: column.height
+
+ Column {
+ id: column
+ Text {
+ id: reference
+ objectName: "reference"
+
+ wrapMode: Text.Wrap
+ elide: Text.ElideRight
+
+ text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+Integer at ante dui Curabitur ante est, pulvinar quis adipiscing a, iaculis id ipsum. Nunc blandit
+condimentum odio vel egestas. in ipsum lacinia sit amet
+mattis orci interdum. Quisque vitae accumsan lectus. Ut nisi turpis,
+sollicitudin ut dignissim id, fermentum ac est. Maecenas nec libero leo. Sed ac
+mattis orci interdum. Quisque vitae accumsan lectus. Ut nisi turpis,
+sollicitudin ut dignissim id, fermentum ac est. Maecenas nec libero leo. Sed ac
+leo eget ipsum ultricies viverra sit amet eu orci. Praesent et tortor risus,
+viverra accumsan sapien. Sed faucibus eleifend lectus, sed euismod urna porta
+eu. Quisque vitae accumsan lectus."
+ }
+ Text {
+ id: fixedWidthAndHeight
+ objectName: "fixedWidthAndHeight"
+
+ width: 100
+ height: 100
+
+ wrapMode: Text.Wrap
+ elide: Text.ElideRight
+
+ text: reference.text
+ }
+
+ Text {
+ id: implicitWidthFixedHeight
+ objectName: "implicitWidthFixedHeight"
+
+ height: 100
+
+ wrapMode: Text.Wrap
+ elide: Text.ElideRight
+
+ text: reference.text
+ }
+ Text {
+ id: fixedWidthImplicitHeight
+ objectName: "fixedWidthImplicitHeight"
+
+ width: 100
+
+ wrapMode: Text.Wrap
+ elide: Text.ElideRight
+
+ text: reference.text
+ }
+ Text {
+ id: cappedWidthAndHeight
+ objectName: "cappedWidthAndHeight"
+
+ width: Math.min(100, implicitWidth)
+ height: Math.min(100, implicitHeight)
+
+ wrapMode: Text.Wrap
+ elide: Text.ElideRight
+
+ text: reference.text
+ }
+ Text {
+ id: cappedWidthFixedHeight
+ objectName: "cappedWidthFixedHeight"
+
+ width: Math.min(100, implicitWidth)
+ height: 100
+
+ wrapMode: Text.Wrap
+ elide: Text.ElideRight
+
+ text: reference.text
+ }
+ Text {
+ id: fixedWidthCappedHeight
+ objectName: "fixedWidthCappedHeight"
+
+ width: 100
+ height: Math.min(100, implicitHeight)
+
+ wrapMode: Text.Wrap
+ elide: Text.ElideRight
+
+ text: reference.text
+ }
+ }
+}
diff --git a/tests/auto/quick/qquicktext/tst_qquicktext.cpp b/tests/auto/quick/qquicktext/tst_qquicktext.cpp
index 00c3957bad..c1d454e5df 100644
--- a/tests/auto/quick/qquicktext/tst_qquicktext.cpp
+++ b/tests/auto/quick/qquicktext/tst_qquicktext.cpp
@@ -106,6 +106,7 @@ private slots:
void implicitSize_data();
void implicitSize();
+ void dependentImplicitSizes();
void contentSize();
void implicitSizeBinding_data();
void implicitSizeBinding();
@@ -2216,6 +2217,62 @@ void tst_qquicktext::implicitSize()
delete textObject;
}
+void tst_qquicktext::dependentImplicitSizes()
+{
+ QQmlComponent component(&engine, testFile("implicitSizes.qml"));
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(object.data());
+
+ QQuickText *reference = object->findChild<QQuickText *>("reference");
+ QQuickText *fixedWidthAndHeight = object->findChild<QQuickText *>("fixedWidthAndHeight");
+ QQuickText *implicitWidthFixedHeight = object->findChild<QQuickText *>("implicitWidthFixedHeight");
+ QQuickText *fixedWidthImplicitHeight = object->findChild<QQuickText *>("fixedWidthImplicitHeight");
+ QQuickText *cappedWidthAndHeight = object->findChild<QQuickText *>("cappedWidthAndHeight");
+ QQuickText *cappedWidthFixedHeight = object->findChild<QQuickText *>("cappedWidthFixedHeight");
+ QQuickText *fixedWidthCappedHeight = object->findChild<QQuickText *>("fixedWidthCappedHeight");
+
+ QVERIFY(reference);
+ QVERIFY(fixedWidthAndHeight);
+ QVERIFY(implicitWidthFixedHeight);
+ QVERIFY(fixedWidthImplicitHeight);
+ QVERIFY(cappedWidthAndHeight);
+ QVERIFY(cappedWidthFixedHeight);
+ QVERIFY(fixedWidthCappedHeight);
+
+ QCOMPARE(reference->width(), reference->implicitWidth());
+ QCOMPARE(reference->height(), reference->implicitHeight());
+
+ QVERIFY(fixedWidthAndHeight->width() < fixedWidthAndHeight->implicitWidth());
+ QVERIFY(fixedWidthAndHeight->height() < fixedWidthAndHeight->implicitHeight());
+ QCOMPARE(fixedWidthAndHeight->implicitWidth(), reference->implicitWidth());
+ QVERIFY(fixedWidthAndHeight->implicitHeight() > reference->implicitHeight());
+
+ QCOMPARE(implicitWidthFixedHeight->width(), implicitWidthFixedHeight->implicitWidth());
+ QVERIFY(implicitWidthFixedHeight->height() < implicitWidthFixedHeight->implicitHeight());
+ QCOMPARE(implicitWidthFixedHeight->implicitWidth(), reference->implicitWidth());
+ QCOMPARE(implicitWidthFixedHeight->implicitHeight(), reference->implicitHeight());
+
+ QVERIFY(fixedWidthImplicitHeight->width() < fixedWidthImplicitHeight->implicitWidth());
+ QCOMPARE(fixedWidthImplicitHeight->height(), fixedWidthImplicitHeight->implicitHeight());
+ QCOMPARE(fixedWidthImplicitHeight->implicitWidth(), reference->implicitWidth());
+ QCOMPARE(fixedWidthImplicitHeight->implicitHeight(), fixedWidthAndHeight->implicitHeight());
+
+ QVERIFY(cappedWidthAndHeight->width() < cappedWidthAndHeight->implicitWidth());
+ QVERIFY(cappedWidthAndHeight->height() < cappedWidthAndHeight->implicitHeight());
+ QCOMPARE(cappedWidthAndHeight->implicitWidth(), reference->implicitWidth());
+ QCOMPARE(cappedWidthAndHeight->implicitHeight(), fixedWidthAndHeight->implicitHeight());
+
+ QVERIFY(cappedWidthFixedHeight->width() < cappedWidthAndHeight->implicitWidth());
+ QVERIFY(cappedWidthFixedHeight->height() < cappedWidthFixedHeight->implicitHeight());
+ QCOMPARE(cappedWidthFixedHeight->implicitWidth(), reference->implicitWidth());
+ QCOMPARE(cappedWidthFixedHeight->implicitHeight(), fixedWidthAndHeight->implicitHeight());
+
+ QVERIFY(fixedWidthCappedHeight->width() < fixedWidthCappedHeight->implicitWidth());
+ QVERIFY(fixedWidthCappedHeight->height() < fixedWidthCappedHeight->implicitHeight());
+ QCOMPARE(fixedWidthCappedHeight->implicitWidth(), reference->implicitWidth());
+ QCOMPARE(fixedWidthCappedHeight->implicitHeight(), fixedWidthAndHeight->implicitHeight());
+}
+
void tst_qquicktext::contentSize()
{
QString componentStr = "import QtQuick 2.0\nText { width: 75; height: 16; font.pixelSize: 10 }";
diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
index bc5e6031cb..586a92f4dc 100644
--- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
+++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
@@ -3194,6 +3194,7 @@ void tst_qquicktextinput::readOnly()
QVERIFY(input != 0);
QTRY_VERIFY(input->hasActiveFocus() == true);
QVERIFY(input->isReadOnly() == true);
+ QVERIFY(input->isCursorVisible() == false);
QString initial = input->text();
for (int k=Qt::Key_0; k<=Qt::Key_Z; k++)
simulateKey(&window, k);
@@ -3206,6 +3207,7 @@ void tst_qquicktextinput::readOnly()
input->setReadOnly(false);
QCOMPARE(input->isReadOnly(), false);
QCOMPARE(input->cursorPosition(), input->text().length());
+ QVERIFY(input->isCursorVisible() == true);
}
void tst_qquicktextinput::echoMode()
diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
index 09c582ee91..7d7027dc0d 100644
--- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
+++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
@@ -290,6 +290,7 @@ private slots:
touchDeviceWithVelocity->setCapabilities(QTouchDevice::Position | QTouchDevice::Velocity);
QWindowSystemInterface::registerTouchDevice(touchDeviceWithVelocity);
}
+ void cleanup();
void openglContextCreatedSignal();
void aboutToStopSignal();
@@ -373,6 +374,11 @@ private:
Q_DECLARE_METATYPE(QOpenGLContext *);
+void tst_qquickwindow::cleanup()
+{
+ QVERIFY(QGuiApplication::topLevelWindows().isEmpty());
+}
+
void tst_qquickwindow::openglContextCreatedSignal()
{
qRegisterMetaType<QOpenGLContext *>();
@@ -380,6 +386,7 @@ void tst_qquickwindow::openglContextCreatedSignal()
QQuickWindow window;
QSignalSpy spy(&window, SIGNAL(openglContextCreated(QOpenGLContext*)));
+ window.setTitle(QTest::currentTestFunction());
window.show();
QTest::qWaitForWindowExposed(&window);
@@ -392,6 +399,7 @@ void tst_qquickwindow::openglContextCreatedSignal()
void tst_qquickwindow::aboutToStopSignal()
{
QQuickWindow window;
+ window.setTitle(QTest::currentTestFunction());
window.show();
QTest::qWaitForWindowExposed(&window);
@@ -408,6 +416,7 @@ void tst_qquickwindow::constantUpdates()
QQuickWindow window;
window.resize(250, 250);
ConstantUpdateItem item(window.contentItem());
+ window.setTitle(QTest::currentTestFunction());
window.show();
QSignalSpy beforeSpy(&window, SIGNAL(beforeSynchronizing()));
@@ -424,6 +433,7 @@ void tst_qquickwindow::constantUpdatesOnWindow_data()
QTest::addColumn<QByteArray>("signal");
QQuickWindow window;
+ window.setTitle(QTest::currentTestFunction());
window.setGeometry(100, 100, 300, 200);
window.show();
QTest::qWaitForWindowExposed(&window);
@@ -458,6 +468,7 @@ void tst_qquickwindow::constantUpdatesOnWindow()
QFETCH(QByteArray, signal);
QQuickWindow window;
+ window.setTitle(QTest::currentTestFunction());
window.setGeometry(100, 100, 300, 200);
bool ok = connect(&window, signal.constData(), &window, SLOT(update()), Qt::DirectConnection);
@@ -488,6 +499,7 @@ void tst_qquickwindow::touchEvent_basic()
QQuickWindow *window = new QQuickWindow;
QScopedPointer<QQuickWindow> cleanup(window);
+ window->setTitle(QTest::currentTestFunction());
window->resize(250, 250);
window->setPosition(100, 100);
@@ -621,6 +633,7 @@ void tst_qquickwindow::touchEvent_propagation()
window->resize(250, 250);
window->setPosition(100, 100);
+ window->setTitle(QTest::currentTestFunction());
window->show();
QVERIFY(QTest::qWaitForWindowActive(window));
@@ -754,6 +767,7 @@ void tst_qquickwindow::touchEvent_cancel()
window->resize(250, 250);
window->setPosition(100, 100);
+ window->setTitle(QTest::currentTestFunction());
window->show();
QVERIFY(QTest::qWaitForWindowActive(window));
@@ -787,6 +801,7 @@ void tst_qquickwindow::touchEvent_reentrant()
window->resize(250, 250);
window->setPosition(100, 100);
+ window->setTitle(QTest::currentTestFunction());
window->show();
QVERIFY(QTest::qWaitForWindowActive(window));
@@ -824,6 +839,7 @@ void tst_qquickwindow::touchEvent_velocity()
QScopedPointer<QQuickWindow> cleanup(window);
window->resize(250, 250);
window->setPosition(100, 100);
+ window->setTitle(QTest::currentTestFunction());
window->show();
QVERIFY(QTest::qWaitForWindowExposed(window));
QTest::qWait(10);
@@ -885,6 +901,7 @@ void tst_qquickwindow::mouseFromTouch_basic()
QScopedPointer<QQuickWindow> cleanup(window);
window->resize(250, 250);
window->setPosition(100, 100);
+ window->setTitle(QTest::currentTestFunction());
window->show();
QVERIFY(QTest::qWaitForWindowExposed(window));
QTest::qWait(10);
@@ -953,10 +970,11 @@ void tst_qquickwindow::mouseFromTouch_basic()
void tst_qquickwindow::clearWindow()
{
QQuickWindow *window = new QQuickWindow;
+ window->setTitle(QTest::currentTestFunction());
QQuickItem *item = new QQuickItem;
item->setParentItem(window->contentItem());
- QVERIFY(item->window() == window);
+ QCOMPARE(item->window(), window);
delete window;
@@ -973,6 +991,7 @@ void tst_qquickwindow::mouseFiltering()
QScopedPointer<QQuickWindow> cleanup(window);
window->resize(250, 250);
window->setPosition(100, 100);
+ window->setTitle(QTest::currentTestFunction());
window->show();
QVERIFY(QTest::qWaitForWindowActive(window));
@@ -1033,6 +1052,7 @@ void tst_qquickwindow::clearColor()
window->resize(250, 250);
window->setPosition(100, 100);
window->setColor(Qt::blue);
+ window->setTitle(QTest::currentTestFunction());
window->show();
QVERIFY(QTest::qWaitForWindowExposed(window));
QCOMPARE(window->color(), QColor(Qt::blue));
@@ -1049,6 +1069,7 @@ void tst_qquickwindow::defaultState()
QQuickWindow *qmlWindow = qobject_cast<QQuickWindow*>(created);
QVERIFY(qmlWindow);
+ qmlWindow->setTitle(QTest::currentTestFunction());
QQuickWindow cppWindow;
cppWindow.show();
@@ -1069,6 +1090,7 @@ void tst_qquickwindow::grab()
QFETCH(bool, visible);
QQuickWindow window;
+ window.setTitle(QLatin1String(QTest::currentTestFunction()) + QLatin1Char(' ') + QLatin1String(QTest::currentDataTag()));
window.setColor(Qt::red);
window.resize(250, 250);
@@ -1093,6 +1115,7 @@ void tst_qquickwindow::multipleWindows()
for (int i=0; i<6; ++i) {
QQuickWindow *c = new QQuickWindow();
+ c->setTitle(QLatin1String(QTest::currentTestFunction()) + QString::number(i));
c->setColor(Qt::GlobalColor(Qt::red + i));
c->resize(300, 200);
c->setPosition(100 + i * 30, 100 + i * 20);
@@ -1125,6 +1148,7 @@ void tst_qquickwindow::animationsWhileHidden()
QQuickWindow *window = qobject_cast<QQuickWindow*>(created);
QVERIFY(window);
+ window->setTitle(QTest::currentTestFunction());
QVERIFY(window->isVisible());
// Now hide the window and verify that it went off screen
@@ -1186,6 +1210,7 @@ void tst_qquickwindow::headless()
window->setPersistentOpenGLContext(false);
window->setPersistentSceneGraph(false);
QVERIFY(window);
+ window->setTitle(QTest::currentTestFunction());
window->show();
QVERIFY(QTest::qWaitForWindowExposed(window));
@@ -1235,6 +1260,7 @@ void tst_qquickwindow::headless()
void tst_qquickwindow::noUpdateWhenNothingChanges()
{
QQuickWindow window;
+ window.setTitle(QTest::currentTestFunction());
window.setGeometry(100, 100, 300, 200);
QQuickRectangle rect(window.contentItem());
@@ -1271,6 +1297,7 @@ void tst_qquickwindow::focusObject()
QQuickWindow *window = qobject_cast<QQuickWindow*>(created);
QVERIFY(window);
+ window->setTitle(QTest::currentTestFunction());
QSignalSpy focusObjectSpy(window, SIGNAL(focusObjectChanged(QObject*)));
@@ -1309,6 +1336,7 @@ void tst_qquickwindow::focusReason()
QScopedPointer<QQuickWindow> cleanup(window);
window->resize(200, 200);
window->show();
+ window->setTitle(QTest::currentTestFunction());
QVERIFY(QTest::qWaitForWindowExposed(window));
QQuickItem *firstItem = new QQuickItem;
@@ -1334,6 +1362,7 @@ void tst_qquickwindow::ignoreUnhandledMouseEvents()
{
QQuickWindow *window = new QQuickWindow;
QScopedPointer<QQuickWindow> cleanup(window);
+ window->setTitle(QTest::currentTestFunction());
window->resize(100, 100);
window->show();
QVERIFY(QTest::qWaitForWindowExposed(window));
@@ -1380,6 +1409,7 @@ void tst_qquickwindow::ownershipRootItem()
QQuickWindow *window = qobject_cast<QQuickWindow*>(created);
QVERIFY(window);
+ window->setTitle(QTest::currentTestFunction());
window->show();
QVERIFY(QTest::qWaitForWindowExposed(window));
@@ -1396,7 +1426,9 @@ void tst_qquickwindow::ownershipRootItem()
void tst_qquickwindow::cursor()
{
QQuickWindow window;
- window.resize(320, 240);
+ window.setTitle(QTest::currentTestFunction());
+ window.setFramePosition(QGuiApplication::primaryScreen()->availableGeometry().topLeft() + QPoint(50, 50));
+ window.resize(320, 290);
QQuickItem parentItem;
parentItem.setPosition(QPointF(0, 0));
@@ -1551,6 +1583,8 @@ void tst_qquickwindow::hideThenDelete()
{
QQuickWindow window;
+ window.setTitle(QLatin1String(QTest::currentTestFunction()) + QLatin1Char(' ')
+ + QLatin1String(QTest::currentDataTag()));
window.setColor(Qt::red);
window.setPersistentSceneGraph(persistentSG);
@@ -1577,8 +1611,8 @@ void tst_qquickwindow::hideThenDelete()
else
QVERIFY(openglDestroyed->size() == 0);
} else {
- QVERIFY(sgInvalidated->size() == 0);
- QVERIFY(openglDestroyed->size() == 0);
+ QCOMPARE(sgInvalidated->size(), 0);
+ QCOMPARE(openglDestroyed->size(), 0);
}
}
}
@@ -1613,6 +1647,7 @@ void tst_qquickwindow::showHideAnimate()
void tst_qquickwindow::testExpose()
{
QQuickWindow window;
+ window.setTitle(QTest::currentTestFunction());
window.setGeometry(100, 100, 300, 200);
window.show();
@@ -1637,11 +1672,12 @@ void tst_qquickwindow::requestActivate()
QQmlEngine engine;
QQmlComponent component(&engine);
component.loadUrl(testFileUrl("active.qml"));
- QQuickWindow *window1 = qobject_cast<QQuickWindow *>(component.create());
- QVERIFY(window1);
+ QScopedPointer<QQuickWindow> window1(qobject_cast<QQuickWindow *>(component.create()));
+ QVERIFY(!window1.isNull());
+ window1->setTitle(QTest::currentTestFunction());
QWindowList windows = QGuiApplication::topLevelWindows();
- QVERIFY(windows.size() == 2);
+ QCOMPARE(windows.size(), 2);
for (int i = 0; i < windows.size(); ++i) {
if (windows.at(i)->objectName() == window1->objectName()) {
@@ -1649,14 +1685,14 @@ void tst_qquickwindow::requestActivate()
break;
}
}
- QVERIFY(windows.size() == 1);
- QVERIFY(windows.at(0)->objectName() == "window2");
+ QCOMPARE(windows.size(), 1);
+ QCOMPARE(windows.at(0)->objectName(), QLatin1String("window2"));
window1->show();
QVERIFY(QTest::qWaitForWindowExposed(windows.at(0))); //We wait till window 2 comes up
window1->requestActivate(); // and then transfer the focus to window1
- QTRY_VERIFY(QGuiApplication::focusWindow() == window1);
+ QTRY_COMPARE(QGuiApplication::focusWindow(), window1.data());
QVERIFY(window1->isActive() == true);
QQuickItem *item = QQuickVisualTestUtil::findItem<QQuickItem>(window1->contentItem(), "item1");
@@ -1667,20 +1703,19 @@ void tst_qquickwindow::requestActivate()
QMouseEvent me(QEvent::MouseButtonPress, pos, window1->mapToGlobal(pos), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
QSpontaneKeyEvent::setSpontaneous(&me);
- if (!qApp->notify(window1, &me)) {
+ if (!qApp->notify(window1.data(), &me)) {
QString warning = QString::fromLatin1("Mouse event MousePress not accepted by receiving window");
QWARN(warning.toLatin1().data());
}
me = QMouseEvent(QEvent::MouseButtonPress, pos, window1->mapToGlobal(pos), Qt::LeftButton, 0, Qt::NoModifier);
QSpontaneKeyEvent::setSpontaneous(&me);
- if (!qApp->notify(window1, &me)) {
+ if (!qApp->notify(window1.data(), &me)) {
QString warning = QString::fromLatin1("Mouse event MouseRelease not accepted by receiving window");
QWARN(warning.toLatin1().data());
}
- QTRY_VERIFY(QGuiApplication::focusWindow() == windows.at(0));
+ QTRY_COMPARE(QGuiApplication::focusWindow(), windows.at(0));
QVERIFY(windows.at(0)->isActive());
- delete window1;
}
void tst_qquickwindow::testWindowVisibilityOrder()
@@ -1688,12 +1723,13 @@ void tst_qquickwindow::testWindowVisibilityOrder()
QQmlEngine engine;
QQmlComponent component(&engine);
component.loadUrl(testFileUrl("windoworder.qml"));
- QQuickWindow *window1 = qobject_cast<QQuickWindow *>(component.create());
+ QScopedPointer<QQuickWindow> window1(qobject_cast<QQuickWindow *>(component.create()));
+ QVERIFY(!window1.isNull());
+ window1->setTitle(QTest::currentTestFunction());
QQuickWindow *window2 = window1->property("win2").value<QQuickWindow*>();
QQuickWindow *window3 = window1->property("win3").value<QQuickWindow*>();
QQuickWindow *window4 = window1->property("win4").value<QQuickWindow*>();
QQuickWindow *window5 = window1->property("win5").value<QQuickWindow*>();
- QVERIFY(window1);
QVERIFY(window2);
QVERIFY(window3);
@@ -1702,7 +1738,7 @@ void tst_qquickwindow::testWindowVisibilityOrder()
QWindowList windows = QGuiApplication::topLevelWindows();
QTRY_COMPARE(windows.size(), 5);
- QVERIFY(window3 == QGuiApplication::focusWindow());
+ QCOMPARE(window3, QGuiApplication::focusWindow());
QVERIFY(window1->isActive());
QVERIFY(window2->isActive());
QVERIFY(window3->isActive());
@@ -1721,10 +1757,10 @@ void tst_qquickwindow::testWindowVisibilityOrder()
window5->hide();
window3->hide();
- QTRY_COMPARE(window2 == QGuiApplication::focusWindow(), true);
+ QTRY_COMPARE(window2, QGuiApplication::focusWindow());
window2->hide();
- QTRY_COMPARE(window1 == QGuiApplication::focusWindow(), true);
+ QTRY_COMPARE(window1.data(), QGuiApplication::focusWindow());
}
void tst_qquickwindow::blockClosing()
@@ -1732,17 +1768,18 @@ void tst_qquickwindow::blockClosing()
QQmlEngine engine;
QQmlComponent component(&engine);
component.loadUrl(testFileUrl("ucantclosethis.qml"));
- QQuickWindow *window = qobject_cast<QQuickWindow *>(component.create());
- QVERIFY(window);
+ QScopedPointer<QQuickWindow> window(qobject_cast<QQuickWindow *>(component.create()));
+ QVERIFY(!window.isNull());
+ window->setTitle(QTest::currentTestFunction());
window->show();
- QTest::qWaitForWindowExposed(window);
+ QTest::qWaitForWindowExposed(window.data());
QVERIFY(window->isVisible());
- QWindowSystemInterface::handleCloseEvent(window);
+ QWindowSystemInterface::handleCloseEvent(window.data());
QVERIFY(window->isVisible());
- QWindowSystemInterface::handleCloseEvent(window);
+ QWindowSystemInterface::handleCloseEvent(window.data());
QVERIFY(window->isVisible());
window->setProperty("canCloseThis", true);
- QWindowSystemInterface::handleCloseEvent(window);
+ QWindowSystemInterface::handleCloseEvent(window.data());
QTRY_VERIFY(!window->isVisible());
}
@@ -1751,17 +1788,18 @@ void tst_qquickwindow::blockCloseMethod()
QQmlEngine engine;
QQmlComponent component(&engine);
component.loadUrl(testFileUrl("ucantclosethis.qml"));
- QQuickWindow *window = qobject_cast<QQuickWindow *>(component.create());
- QVERIFY(window);
+ QScopedPointer<QQuickWindow> window(qobject_cast<QQuickWindow *>(component.create()));
+ QVERIFY(!window.isNull());
+ window->setTitle(QTest::currentTestFunction());
window->show();
- QTest::qWaitForWindowExposed(window);
+ QTest::qWaitForWindowExposed(window.data());
QVERIFY(window->isVisible());
- QVERIFY(QMetaObject::invokeMethod(window, "close", Qt::DirectConnection));
+ QVERIFY(QMetaObject::invokeMethod(window.data(), "close", Qt::DirectConnection));
QVERIFY(window->isVisible());
- QVERIFY(QMetaObject::invokeMethod(window, "close", Qt::DirectConnection));
+ QVERIFY(QMetaObject::invokeMethod(window.data(), "close", Qt::DirectConnection));
QVERIFY(window->isVisible());
window->setProperty("canCloseThis", true);
- QVERIFY(QMetaObject::invokeMethod(window, "close", Qt::DirectConnection));
+ QVERIFY(QMetaObject::invokeMethod(window.data(), "close", Qt::DirectConnection));
QTRY_VERIFY(!window->isVisible());
}
@@ -1771,15 +1809,16 @@ void tst_qquickwindow::crashWhenHoverItemDeleted()
QQmlEngine engine;
QQmlComponent component(&engine);
component.loadUrl(testFileUrl("hoverCrash.qml"));
- QQuickWindow *window = qobject_cast<QQuickWindow *>(component.create());
- QVERIFY(window);
+ QScopedPointer<QQuickWindow> window(qobject_cast<QQuickWindow *>(component.create()));
+ QVERIFY(!window.isNull());
+ window->setTitle(QTest::currentTestFunction());
window->show();
- QTest::qWaitForWindowActive(window);
+ QTest::qWaitForWindowActive(window.data());
// Simulate a move from the first rectangle to the second. Crash will happen in here
// Moving instantaneously from (0, 99) to (0, 102) does not cause the crash
for (int i = 99; i < 102; ++i) {
- QTest::mouseMove(window, QPoint(0, i));
+ QTest::mouseMove(window.data(), QPoint(0, i));
}
}
@@ -1789,10 +1828,11 @@ void tst_qquickwindow::unloadSubWindow()
QQmlEngine engine;
QQmlComponent component(&engine);
component.loadUrl(testFileUrl("unloadSubWindow.qml"));
- QQuickWindow *window = qobject_cast<QQuickWindow *>(component.create());
- QVERIFY(window);
+ QScopedPointer<QQuickWindow> window(qobject_cast<QQuickWindow *>(component.create()));
+ QVERIFY(!window.isNull());
+ window->setTitle(QTest::currentTestFunction());
window->show();
- QTest::qWaitForWindowExposed(window);
+ QTest::qWaitForWindowExposed(window.data());
QPointer<QQuickWindow> transient;
QTRY_VERIFY(transient = window->property("transientWindow").value<QQuickWindow*>());
QTest::qWaitForWindowExposed(transient);
@@ -1810,6 +1850,7 @@ void tst_qquickwindow::qobjectEventFilter_touch()
window.resize(250, 250);
window.setPosition(100, 100);
+ window.setTitle(QTest::currentTestFunction());
window.show();
QVERIFY(QTest::qWaitForWindowActive(&window));
@@ -1835,6 +1876,7 @@ void tst_qquickwindow::qobjectEventFilter_key()
window.resize(250, 250);
window.setPosition(100, 100);
+ window.setTitle(QTest::currentTestFunction());
window.show();
QVERIFY(QTest::qWaitForWindowExposed(&window));
@@ -1863,6 +1905,7 @@ void tst_qquickwindow::qobjectEventFilter_mouse()
window.resize(250, 250);
window.setPosition(100, 100);
+ window.setTitle(QTest::currentTestFunction());
window.show();
QVERIFY(QTest::qWaitForWindowActive(&window));
@@ -1884,6 +1927,7 @@ void tst_qquickwindow::qobjectEventFilter_mouse()
void tst_qquickwindow::animatingSignal()
{
QQuickWindow window;
+ window.setTitle(QTest::currentTestFunction());
window.setGeometry(100, 100, 300, 200);
QSignalSpy spy(&window, SIGNAL(afterAnimating()));
@@ -1898,6 +1942,7 @@ void tst_qquickwindow::animatingSignal()
void tst_qquickwindow::contentItemSize()
{
QQuickWindow window;
+ window.setTitle(QTest::currentTestFunction());
QQuickItem *contentItem = window.contentItem();
QVERIFY(contentItem);
QCOMPARE(QSize(contentItem->width(), contentItem->height()), window.size());
@@ -1951,6 +1996,7 @@ void tst_qquickwindow::defaultSurfaceFormat()
QSurfaceFormat::setDefaultFormat(format);
QQuickWindow window;
+ window.setTitle(QTest::currentTestFunction());
window.show();
QVERIFY(QTest::qWaitForWindowExposed(&window));
@@ -1974,6 +2020,7 @@ void tst_qquickwindow::defaultSurfaceFormat()
void tst_qquickwindow::attachedProperty()
{
QQuickView view(testFileUrl("windowattached.qml"));
+ view.setTitle(QTest::currentTestFunction());
view.show();
view.requestActivate();
QVERIFY(QTest::qWaitForWindowActive(&view));
@@ -2049,6 +2096,7 @@ void tst_qquickwindow::testRenderJob()
{
QQuickWindow window;
+ window.setTitle(QTest::currentTestFunction());
RenderJob::deleted = 0;
// Schedule the jobs
@@ -2165,6 +2213,7 @@ void tst_qquickwindow::testHoverChildMouseEventFilter()
window.resize(250, 250);
window.setPosition(100, 100);
+ window.setTitle(QTest::currentTestFunction());
window.show();
QVERIFY(QTest::qWaitForWindowActive(&window));
@@ -2190,15 +2239,15 @@ void tst_qquickwindow::testHoverChildMouseEventFilter()
QTest::mouseMove(&window, pos);
QTRY_VERIFY(bottomItem->eventCount(QEvent::HoverEnter) > 0);
- QVERIFY(bottomItem->childMouseEventFilterEventCount(QEvent::HoverEnter) == 0);
- QVERIFY(middleItem->eventCount(QEvent::HoverEnter) == 0);
- QVERIFY(topItem->eventCount(QEvent::HoverEnter) == 0);
+ QCOMPARE(bottomItem->childMouseEventFilterEventCount(QEvent::HoverEnter), 0);
+ QCOMPARE(middleItem->eventCount(QEvent::HoverEnter), 0);
+ QCOMPARE(topItem->eventCount(QEvent::HoverEnter), 0);
bottomItem->reset();
pos = QPoint(60, 60);
QTest::mouseMove(&window, pos);
QTRY_VERIFY(middleItem->eventCount(QEvent::HoverEnter) > 0);
- QVERIFY(bottomItem->childMouseEventFilterEventCount(QEvent::HoverEnter) == 0);
+ QCOMPARE(bottomItem->childMouseEventFilterEventCount(QEvent::HoverEnter), 0);
middleItem->reset();
pos = QPoint(70,70);
@@ -2206,7 +2255,7 @@ void tst_qquickwindow::testHoverChildMouseEventFilter()
QTest::mouseMove(&window, pos);
QTRY_VERIFY(middleItem->eventCount(QEvent::HoverMove) > 0);
QVERIFY(bottomItem->childMouseEventFilterEventCount(QEvent::HoverMove) > 0);
- QVERIFY(topItem->eventCount(QEvent::HoverEnter) == 0);
+ QCOMPARE(topItem->eventCount(QEvent::HoverEnter), 0);
bottomItem->reset();
middleItem->reset();
@@ -2214,8 +2263,8 @@ void tst_qquickwindow::testHoverChildMouseEventFilter()
bottomItem->addFilterEvent(QEvent::HoverEnter);
QTest::mouseMove(&window, pos);
QTRY_VERIFY(bottomItem->childMouseEventFilterEventCount(QEvent::HoverEnter) > 0);
- QVERIFY(topItem->eventCount(QEvent::HoverEnter) == 0);
- QVERIFY(middleItem->eventCount(QEvent::HoverEnter) == 0);
+ QCOMPARE(topItem->eventCount(QEvent::HoverEnter), 0);
+ QCOMPARE(middleItem->eventCount(QEvent::HoverEnter), 0);
}
QTEST_MAIN(tst_qquickwindow)
diff --git a/tests/auto/quick/shared/viewtestutil.cpp b/tests/auto/quick/shared/viewtestutil.cpp
index 24e565012e..5b9111d448 100644
--- a/tests/auto/quick/shared/viewtestutil.cpp
+++ b/tests/auto/quick/shared/viewtestutil.cpp
@@ -350,9 +350,7 @@ namespace QQuickTouchUtils {
QQuickWindowPrivate *wd = QQuickWindowPrivate::get(window);
if (!wd || !wd->delayedTouch)
return;
- wd->reallyDeliverTouchEvent(wd->delayedTouch);
- delete wd->delayedTouch;
- wd->delayedTouch = 0;
+ wd->deliverDelayedTouchEvent();
}
}
diff --git a/tests/manual/highdpi/BorderImage.png b/tests/manual/highdpi/BorderImage.png
new file mode 100644
index 0000000000..8fa6b40d78
--- /dev/null
+++ b/tests/manual/highdpi/BorderImage.png
Binary files differ
diff --git a/tests/manual/highdpi/BorderImage@2x.png b/tests/manual/highdpi/BorderImage@2x.png
new file mode 100644
index 0000000000..1bbc52781f
--- /dev/null
+++ b/tests/manual/highdpi/BorderImage@2x.png
Binary files differ
diff --git a/tests/manual/highdpi/TiledBorderImage.png b/tests/manual/highdpi/TiledBorderImage.png
new file mode 100644
index 0000000000..b17288ecdd
--- /dev/null
+++ b/tests/manual/highdpi/TiledBorderImage.png
Binary files differ
diff --git a/tests/manual/highdpi/TiledBorderImage@2x.png b/tests/manual/highdpi/TiledBorderImage@2x.png
new file mode 100644
index 0000000000..85c7c4b4e4
--- /dev/null
+++ b/tests/manual/highdpi/TiledBorderImage@2x.png
Binary files differ
diff --git a/tests/manual/highdpi/borderimage.qml b/tests/manual/highdpi/borderimage.qml
new file mode 100644
index 0000000000..902d4e5a47
--- /dev/null
+++ b/tests/manual/highdpi/borderimage.qml
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ width: 900
+ height: 400
+
+ readonly property real imageBorder: 32
+ readonly property real animDuration: 3000
+ readonly property real animMin: 2 * imageBorder
+ readonly property real animMax: 280
+
+ Text {
+ anchors.bottom: row.top
+ anchors.horizontalCenter: parent.horizontalCenter
+ text: "Green => standard DPI; purple => @2x"
+ }
+
+ Row {
+ id: row
+ anchors.centerIn: parent
+ spacing: 10
+ Repeater {
+ model: 3
+ delegate: Item {
+ width: animMax
+ height: animMax
+ BorderImage {
+ source : index === 0 ? "BorderImage.png" : "TiledBorderImage.png"
+ anchors.centerIn: parent
+
+ border {
+ left: imageBorder; right: imageBorder
+ top: imageBorder; bottom: imageBorder
+ }
+
+ horizontalTileMode: index === 0 ? BorderImage.Stretch :
+ index === 1 ? BorderImage.Repeat : BorderImage.Round
+ verticalTileMode: index === 0 ? BorderImage.Stretch :
+ index === 1 ? BorderImage.Repeat : BorderImage.Round
+
+ width: animMin
+ SequentialAnimation on width {
+ NumberAnimation { to: animMax; duration: animDuration }
+ NumberAnimation { to: animMin; duration: animDuration }
+ loops: Animation.Infinite
+ }
+
+ height: animMax
+ SequentialAnimation on height {
+ NumberAnimation { to: animMin; duration: animDuration }
+ NumberAnimation { to: animMax; duration: animDuration }
+ loops: Animation.Infinite
+ }
+ }
+
+ Text {
+ anchors.top: parent.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ font.pixelSize: 18
+ text: index === 0 ? "Stretch" :
+ index === 1 ? "Repeat" : "Round"
+ }
+ }
+ }
+ }
+}
diff --git a/tools/qmllint/main.cpp b/tools/qmllint/main.cpp
index 9fd6c36079..a1161c635a 100644
--- a/tools/qmllint/main.cpp
+++ b/tools/qmllint/main.cpp
@@ -41,7 +41,6 @@
#include <private/qqmljslexer_p.h>
#include <private/qqmljsparser_p.h>
#include <private/qqmljsengine_p.h>
-#include <private/qqmlirbuilder_p.h>
static bool lint_file(const QString &filename, bool silent)
{
@@ -59,10 +58,7 @@ static bool lint_file(const QString &filename, bool silent)
QFileInfo info(filename);
bool isJavaScript = info.suffix().toLower() == QLatin1String("js");
- if (isJavaScript)
- QmlIR::Document::removeScriptPragmas(/*by-ref*/code);
-
- lexer.setCode(code, /*line = */ 1, true);
+ lexer.setCode(code, /*line = */ 1, /*qmlMode=*/ !isJavaScript);
QQmlJS::Parser parser(&engine);
bool success = isJavaScript ? parser.parseProgram() : parser.parse();