aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-10-27 09:54:43 +0200
committerLiang Qi <liang.qi@qt.io>2016-10-27 09:56:20 +0200
commit6b58ce5251045fb751eb511b2cb3571bcd113f28 (patch)
tree7d3b63836c7ec0cce618ce4180c9f5ed63900a6a
parent93d7c26653757755ae65f14d06d6df6f9ec2fc07 (diff)
parentc849f3a7eff55d60c4010831ec67336c5c0f2a27 (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts: src/quick/items/qquickwindow.cpp tests/auto/quick/qquicktext/BLACKLIST tests/auto/quick/qquicktextedit/BLACKLIST Change-Id: I8bd68b0b5e853b7908791d2cbddd18dd527c76ae
-rw-r--r--examples/quick/demos/tweetsearch/content/LineInput.qml2
-rw-r--r--src/qml/doc/src/cppintegration/data.qdoc4
-rw-r--r--src/qml/jit/qv4isel_masm.cpp6
-rw-r--r--src/qml/jsruntime/qv4arraydata.cpp29
-rw-r--r--src/qml/jsruntime/qv4persistent.cpp2
-rw-r--r--src/qml/jsruntime/qv4value_p.h24
-rw-r--r--src/qml/memory/qv4mm.cpp2
-rw-r--r--src/quick/accessible/qaccessiblequickitem.cpp4
-rw-r--r--src/quick/items/qquickdrag.cpp2
-rw-r--r--src/quick/items/qquicktextinput.cpp4
-rw-r--r--src/quick/items/qquickwindow.cpp1
-rw-r--r--src/quick/scenegraph/qsgdefaultglyphnode_p.cpp3
-rw-r--r--tests/auto/quick/qquickitem/tst_qquickitem.cpp7
-rw-r--r--tests/auto/quick/qquicktext/BLACKLIST2
-rw-r--r--tests/auto/quick/qquicktextedit/BLACKLIST2
-rw-r--r--tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp16
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_bitmapfont.qml18
17 files changed, 82 insertions, 46 deletions
diff --git a/examples/quick/demos/tweetsearch/content/LineInput.qml b/examples/quick/demos/tweetsearch/content/LineInput.qml
index 7e4ffda92b..46bc73f3af 100644
--- a/examples/quick/demos/tweetsearch/content/LineInput.qml
+++ b/examples/quick/demos/tweetsearch/content/LineInput.qml
@@ -62,7 +62,7 @@ FocusScope {
text: "Enter word"
font.pixelSize: 18
color: "#707070"
- opacity: input.length ? 0 : 1
+ opacity: input.displayText.length ? 0 : 1
}
Text {
diff --git a/src/qml/doc/src/cppintegration/data.qdoc b/src/qml/doc/src/cppintegration/data.qdoc
index 7bb4d701e2..42236524a9 100644
--- a/src/qml/doc/src/cppintegration/data.qdoc
+++ b/src/qml/doc/src/cppintegration/data.qdoc
@@ -52,8 +52,8 @@ remain with C++ by invoking QQmlEngine::setObjectOwnership() with
QQmlEngine::CppOwnership specified.
Additionally, the QML engine respects the normal QObject parent ownership
-semantics of Qt C++ objects, and will not ever take ownership of a QObject
-instance which already has a parent.
+semantics of Qt C++ objects, and will never delete a QObject instance which
+has a parent.
\section1 Basic Qt Data Types
diff --git a/src/qml/jit/qv4isel_masm.cpp b/src/qml/jit/qv4isel_masm.cpp
index 1bb62f40b6..859ecfbe64 100644
--- a/src/qml/jit/qv4isel_masm.cpp
+++ b/src/qml/jit/qv4isel_masm.cpp
@@ -971,7 +971,7 @@ void InstructionSelection::swapValues(IR::Expr *source, IR::Expr *target)
tag = QV4::Value::Integer_Type_Internal;
break;
default:
- tag = QV4::Value::Undefined_Type;
+ tag = 31337; // bogus value
Q_UNREACHABLE();
}
_as->store32(Assembler::TrustedImm32(tag), addr);
@@ -1418,7 +1418,7 @@ void InstructionSelection::visitCJump(IR::CJump *s)
Address temp = _as->loadAddress(Assembler::ScratchRegister, s->cond);
Address tag = temp;
tag.offset += QV4::Value::tagOffset();
- Assembler::Jump booleanConversion = _as->branch32(Assembler::NotEqual, tag, Assembler::TrustedImm32(QV4::Value::Boolean_Type));
+ Assembler::Jump booleanConversion = _as->branch32(Assembler::NotEqual, tag, Assembler::TrustedImm32(QV4::Value::Boolean_Type_Internal));
Address data = temp;
data.offset += QV4::Value::valueOffset();
@@ -1582,7 +1582,7 @@ void InstructionSelection::visitRet(IR::Ret *s)
tag = QV4::Value::Boolean_Type_Internal;
break;
default:
- tag = QV4::Value::Undefined_Type;
+ tag = 31337; // bogus value
Q_UNREACHABLE();
}
_as->or64(Assembler::TrustedImm64(tag << 32),
diff --git a/src/qml/jsruntime/qv4arraydata.cpp b/src/qml/jsruntime/qv4arraydata.cpp
index 03ae23175b..aa64ae1411 100644
--- a/src/qml/jsruntime/qv4arraydata.cpp
+++ b/src/qml/jsruntime/qv4arraydata.cpp
@@ -104,7 +104,7 @@ Q_STATIC_ASSERT(sizeof(Heap::ArrayData) == sizeof(Heap::SparseArrayData));
static Q_ALWAYS_INLINE void storeValue(ReturnedValue *target, uint value)
{
Value v;
- v.setTagValue(Value::fromReturnedValue(*target).tag(), value);
+ v.setEmpty(value);
*target = v.asReturnedValue();
}
@@ -193,6 +193,7 @@ void ArrayData::realloc(Object *o, Type newType, uint requested, bool enforceAtt
} else {
sparse->sparse = new SparseArray;
lastFree = &sparse->freeList;
+ storeValue(lastFree, 0);
for (uint i = 0; i < toCopy; ++i) {
if (!sparse->arrayData[i].isEmpty()) {
SparseArrayNode *n = sparse->sparse->insert(i);
@@ -213,6 +214,8 @@ void ArrayData::realloc(Object *o, Type newType, uint requested, bool enforceAtt
}
storeValue(lastFree, UINT_MAX);
}
+
+ Q_ASSERT(Value::fromReturnedValue(sparse->freeList).isEmpty());
// ### Could explicitly free the old data
}
@@ -361,12 +364,12 @@ void SparseArrayData::free(Heap::ArrayData *d, uint idx)
Value *v = d->arrayData + idx;
if (d->attrs && d->attrs[idx].isAccessor()) {
// double slot, free both. Order is important, so we have a double slot for allocation again afterwards.
- v[1].setTagValue(Value::Empty_Type, Value::fromReturnedValue(d->freeList).value());
- v[0].setTagValue(Value::Empty_Type, idx + 1);
+ v[1].setEmpty(Value::fromReturnedValue(d->freeList).emptyValue());
+ v[0].setEmpty(idx + 1);
} else {
- v->setTagValue(Value::Empty_Type, Value::fromReturnedValue(d->freeList).value());
+ v->setEmpty(Value::fromReturnedValue(d->freeList).emptyValue());
}
- d->freeList = idx;
+ d->freeList = Primitive::emptyValue(idx).asReturnedValue();
if (d->attrs)
d->attrs[idx].clear();
}
@@ -404,9 +407,9 @@ uint SparseArrayData::allocate(Object *o, bool doubleSlot)
Q_ASSERT(dd->arrayData[Value::fromReturnedValue(*last).value()].value() != Value::fromReturnedValue(*last).value());
if (dd->arrayData[Value::fromReturnedValue(*last).value()].value() == (Value::fromReturnedValue(*last).value() + 1)) {
// found two slots in a row
- uint idx = Value::fromReturnedValue(*last).uint_32();
+ uint idx = Value::fromReturnedValue(*last).emptyValue();
Value lastV = Value::fromReturnedValue(*last);
- lastV.setTagValue(lastV.tag(), dd->arrayData[lastV.value() + 1].value());
+ lastV.setEmpty(dd->arrayData[lastV.emptyValue() + 1].value());
*last = lastV.rawValue();
dd->attrs[idx] = Attr_Accessor;
return idx;
@@ -420,7 +423,8 @@ uint SparseArrayData::allocate(Object *o, bool doubleSlot)
}
uint idx = Value::fromReturnedValue(dd->freeList).value();
Q_ASSERT(idx != UINT_MAX);
- dd->freeList = dd->arrayData[idx].uint_32();
+ dd->freeList = dd->arrayData[idx].asReturnedValue();
+ Q_ASSERT(Value::fromReturnedValue(dd->freeList).isEmpty());
if (dd->attrs)
dd->attrs[idx] = Attr_Data;
return idx;
@@ -475,13 +479,14 @@ bool SparseArrayData::del(Object *o, uint index)
if (isAccessor) {
// free up both indices
- dd->arrayData[pidx + 1].setTagValue(Value::Empty_Type, Value::fromReturnedValue(dd->freeList).value());
- dd->arrayData[pidx].setTagValue(Value::Undefined_Type, pidx + 1);
+ dd->arrayData[pidx + 1].setEmpty(Value::fromReturnedValue(dd->freeList).emptyValue());
+ dd->arrayData[pidx].setEmpty(pidx + 1);
} else {
- dd->arrayData[pidx].setTagValue(Value::Empty_Type, Value::fromReturnedValue(dd->freeList).value());
+ Q_ASSERT(dd->type == Heap::ArrayData::Sparse);
+ dd->arrayData[pidx].setEmpty(Value::fromReturnedValue(dd->freeList).emptyValue());
}
- dd->freeList = pidx;
+ dd->freeList = Primitive::emptyValue(pidx).asReturnedValue();
dd->sparse->erase(n);
return true;
}
diff --git a/src/qml/jsruntime/qv4persistent.cpp b/src/qml/jsruntime/qv4persistent.cpp
index 7ca0692804..a892194df3 100644
--- a/src/qml/jsruntime/qv4persistent.cpp
+++ b/src/qml/jsruntime/qv4persistent.cpp
@@ -139,7 +139,7 @@ PersistentValueStorage::Iterator &PersistentValueStorage::Iterator::operator++()
while (p) {
while (index < kEntriesPerPage - 1) {
++index;
- if (static_cast<Page *>(p)->values[index].tag() != QV4::Value::Empty_Type)
+ if (!static_cast<Page *>(p)->values[index].isEmpty())
return *this;
}
index = -1;
diff --git a/src/qml/jsruntime/qv4value_p.h b/src/qml/jsruntime/qv4value_p.h
index d588553778..9eee34aff2 100644
--- a/src/qml/jsruntime/qv4value_p.h
+++ b/src/qml/jsruntime/qv4value_p.h
@@ -175,10 +175,7 @@ public:
Q_ALWAYS_INLINE quint32 value() const { return _val & quint64(~quint32(0)); }
Q_ALWAYS_INLINE quint32 tag() const { return _val >> 32; }
-#if defined(V4_BOOTSTRAP)
- Q_ALWAYS_INLINE Heap::Base *m() const { Q_UNREACHABLE(); return Q_NULLPTR; }
- Q_ALWAYS_INLINE void setM(Heap::Base *b) { Q_UNUSED(b); Q_UNREACHABLE(); }
-#elif defined(QV4_USE_64_BIT_VALUE_ENCODING)
+#if defined(QV4_USE_64_BIT_VALUE_ENCODING)
Q_ALWAYS_INLINE Heap::Base *m() const
{
Heap::Base *b;
@@ -226,6 +223,17 @@ public:
setTagValue(Empty_Type_Internal, quint32(i));
}
+ Q_ALWAYS_INLINE void setEmpty(quint32 i)
+ {
+ setTagValue(Empty_Type_Internal, i);
+ }
+
+ Q_ALWAYS_INLINE quint32 emptyValue()
+ {
+ Q_ASSERT(isEmpty());
+ return quint32(value());
+ }
+
enum Type {
Undefined_Type,
Managed_Type,
@@ -530,6 +538,7 @@ ReturnedValue Heap::Base::asReturnedValue() const
struct Q_QML_PRIVATE_EXPORT Primitive : public Value
{
inline static Primitive emptyValue();
+ inline static Primitive emptyValue(uint v);
static inline Primitive fromBoolean(bool b);
static inline Primitive fromInt32(int i);
inline static Primitive undefinedValue();
@@ -559,6 +568,13 @@ inline Primitive Primitive::emptyValue()
return v;
}
+inline Primitive Primitive::emptyValue(uint e)
+{
+ Primitive v;
+ v.setEmpty(e);
+ return v;
+}
+
inline Primitive Primitive::nullValue()
{
Primitive v;
diff --git a/src/qml/memory/qv4mm.cpp b/src/qml/memory/qv4mm.cpp
index 990f6477d7..9924d37fdc 100644
--- a/src/qml/memory/qv4mm.cpp
+++ b/src/qml/memory/qv4mm.cpp
@@ -460,7 +460,7 @@ void MemoryManager::sweep(bool lastSweep)
remainingWeakQObjectWrappers.reserve(pendingCount);
for (int i = 0; i < pendingCount; ++i) {
Value *v = m_pendingFreedObjectWrapperValue.at(i);
- if (v->tag() == Value::Undefined_Type)
+ if (v->isUndefined() || v->isEmpty())
PersistentValueStorage::free(v);
else
remainingWeakQObjectWrappers.append(v);
diff --git a/src/quick/accessible/qaccessiblequickitem.cpp b/src/quick/accessible/qaccessiblequickitem.cpp
index a56d098717..49cbc15829 100644
--- a/src/quick/accessible/qaccessiblequickitem.cpp
+++ b/src/quick/accessible/qaccessiblequickitem.cpp
@@ -67,10 +67,6 @@ int QAccessibleQuickItem::childCount() const
QRect QAccessibleQuickItem::rect() const
{
const QRect r = itemScreenRect(item());
-
- if (!r.isValid()) {
- qWarning() << item()->metaObject()->className() << item()->property("accessibleText") << r;
- }
return r;
}
diff --git a/src/quick/items/qquickdrag.cpp b/src/quick/items/qquickdrag.cpp
index 558f52a1af..c81cb0c5fc 100644
--- a/src/quick/items/qquickdrag.cpp
+++ b/src/quick/items/qquickdrag.cpp
@@ -708,7 +708,7 @@ void QQuickDragAttached::cancel()
*/
/*!
- \qmlattachedsignal QtQuick::Drag::dragFinished(DropAction action)
+ \qmlattachedsignal QtQuick::Drag::dragFinished(DropAction dropAction)
This signal is emitted when a drag finishes and the drag was started with the
\l startDrag() method or started automatically using the \l dragType property.
diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp
index 168fd0d9b6..3d708c8eeb 100644
--- a/src/quick/items/qquicktextinput.cpp
+++ b/src/quick/items/qquicktextinput.cpp
@@ -2264,8 +2264,8 @@ QString QQuickTextInput::preeditText() const
If true, the user can use the mouse to select text in some
platform-specific way. Note that for some platforms this may
- not be an appropriate interaction (eg. may conflict with how
- the text needs to behave inside a Flickable.
+ not be an appropriate interaction (it may conflict with how
+ the text needs to behave inside a \l Flickable, for example).
*/
bool QQuickTextInput::selectByMouse() const
{
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index 10e439182d..83aa58091a 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -1884,6 +1884,7 @@ bool QQuickWindowPrivate::deliverWheelEvent(QQuickItem *item, QWheelEvent *event
if (item->contains(p)) {
QWheelEvent wheel(p, p, event->pixelDelta(), event->angleDelta(), event->delta(),
event->orientation(), event->buttons(), event->modifiers(), event->phase(), event->source(), event->inverted());
+ wheel.setTimestamp(event->timestamp());
wheel.accept();
q->sendEvent(item, &wheel);
if (wheel.isAccepted()) {
diff --git a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
index d6128b339c..161373306a 100644
--- a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
+++ b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
@@ -239,7 +239,8 @@ bool QSG24BitTextMaskShader::useSRGB() const
// m_useSRGB is true, but if some QOGLFBO was bound check it's texture format:
QOpenGLContext *ctx = QOpenGLContext::currentContext();
QOpenGLFramebufferObject *qfbo = QOpenGLContextPrivate::get(ctx)->qgl_current_fbo;
- return !qfbo || qfbo->format().internalTextureFormat() == GL_SRGB8_ALPHA8_EXT;
+ bool fboInvalid = QOpenGLContextPrivate::get(ctx)->qgl_current_fbo_invalid;
+ return !qfbo || fboInvalid || qfbo->format().internalTextureFormat() == GL_SRGB8_ALPHA8_EXT;
#else
return m_useSRGB;
#endif
diff --git a/tests/auto/quick/qquickitem/tst_qquickitem.cpp b/tests/auto/quick/qquickitem/tst_qquickitem.cpp
index 536bb40dcc..d0139b6cdf 100644
--- a/tests/auto/quick/qquickitem/tst_qquickitem.cpp
+++ b/tests/auto/quick/qquickitem/tst_qquickitem.cpp
@@ -48,7 +48,7 @@ public:
TestItem(QQuickItem *parent = 0)
: QQuickItem(parent), focused(false), pressCount(0), releaseCount(0)
, wheelCount(0), acceptIncomingTouchEvents(true)
- , touchEventReached(false) {}
+ , touchEventReached(false), timestamp(0) {}
bool focused;
int pressCount;
@@ -56,6 +56,7 @@ public:
int wheelCount;
bool acceptIncomingTouchEvents;
bool touchEventReached;
+ ulong timestamp;
protected:
virtual void focusInEvent(QFocusEvent *) { Q_ASSERT(!focused); focused = true; }
virtual void focusOutEvent(QFocusEvent *) { Q_ASSERT(focused); focused = false; }
@@ -65,7 +66,7 @@ protected:
touchEventReached = true;
event->setAccepted(acceptIncomingTouchEvents);
}
- virtual void wheelEvent(QWheelEvent *event) { event->accept(); ++wheelCount; }
+ virtual void wheelEvent(QWheelEvent *event) { event->accept(); ++wheelCount; timestamp = event->timestamp(); }
};
class TestWindow: public QQuickWindow
@@ -1432,12 +1433,14 @@ void tst_qquickitem::wheelEvent()
item->setVisible(visible);
QWheelEvent event(QPoint(100, 50), -120, Qt::NoButton, Qt::NoModifier, Qt::Vertical);
+ event.setTimestamp(123456UL);
event.setAccepted(false);
QGuiApplication::sendEvent(&window, &event);
if (shouldReceiveWheelEvents) {
QVERIFY(event.isAccepted());
QCOMPARE(item->wheelCount, 1);
+ QCOMPARE(item->timestamp, 123456UL);
} else {
QVERIFY(!event.isAccepted());
QCOMPARE(item->wheelCount, 0);
diff --git a/tests/auto/quick/qquicktext/BLACKLIST b/tests/auto/quick/qquicktext/BLACKLIST
index 223d8feb67..c2e7ef03c0 100644
--- a/tests/auto/quick/qquicktext/BLACKLIST
+++ b/tests/auto/quick/qquicktext/BLACKLIST
@@ -1,6 +1,4 @@
[dependentImplicitSizes]
*
-[mouseSelection]
-*
[lineLaidOutRelayout]
msvc-2015
diff --git a/tests/auto/quick/qquicktextedit/BLACKLIST b/tests/auto/quick/qquicktextedit/BLACKLIST
index 297146195b..5f3208f848 100644
--- a/tests/auto/quick/qquicktextedit/BLACKLIST
+++ b/tests/auto/quick/qquicktextedit/BLACKLIST
@@ -1,5 +1,3 @@
-[mouseSelection]
-*
[undo]
*
[undo_keypressevents]
diff --git a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp
index b7bfc357f3..cb2a7bfd83 100644
--- a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp
+++ b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp
@@ -2003,12 +2003,18 @@ void tst_qquicktextedit::mouseSelection()
else if (clicks == 3)
QTest::mouseDClick(&window, Qt::LeftButton, Qt::NoModifier, p1);
QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, p1);
+ if (clicks == 2) {
+ // QTBUG-50022: Since qtbase commit beef975, QTestLib avoids generating
+ // double click events by adding 500ms delta to release event timestamps.
+ // Send a double click event by hand to ensure the correct sequence:
+ // press, release, press, _dbl click_, move, release.
+ QMouseEvent dblClickEvent(QEvent::MouseButtonDblClick, p1, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
+ QGuiApplication::sendEvent(textEditObject, &dblClickEvent);
+ }
QTest::mouseMove(&window, p2);
QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, p2);
QTRY_COMPARE(textEditObject->selectedText(), selectedText);
- QTest::qWait(QGuiApplication::styleHints()->mouseDoubleClickInterval() + 10);
-
// Clicking and shift to clicking between the same points should select the same text.
textEditObject->setCursorPosition(0);
if (clicks > 1)
@@ -2017,9 +2023,6 @@ void tst_qquicktextedit::mouseSelection()
QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, p1);
QTest::mouseClick(&window, Qt::LeftButton, Qt::ShiftModifier, p2);
QTRY_COMPARE(textEditObject->selectedText(), selectedText);
-
- // ### This is to prevent double click detection from carrying over to the next test.
- QTest::qWait(QGuiApplication::styleHints()->mouseDoubleClickInterval() + 10);
}
void tst_qquicktextedit::dragMouseSelection()
@@ -2960,9 +2963,6 @@ void tst_qquicktextedit::middleClickPaste()
// Middle click pastes the selected text, assuming the platform supports it.
QTest::mouseClick(&window, Qt::MiddleButton, Qt::NoModifier, p3);
- // ### This is to prevent double click detection from carrying over to the next test.
- QTest::qWait(QGuiApplication::styleHints()->mouseDoubleClickInterval() + 10);
-
if (QGuiApplication::clipboard()->supportsSelection())
QCOMPARE(textEditObject->text().mid(1, selectedText.length()), selectedText);
else
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_bitmapfont.qml b/tests/manual/scenegraph_lancelot/data/text/text_bitmapfont.qml
new file mode 100644
index 0000000000..d1a289e24f
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_bitmapfont.qml
@@ -0,0 +1,18 @@
+// test use of Fixedsys font on Windows
+
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.fill: parent
+ wrapMode: Text.Wrap
+ font.family: "Fixedsys"
+ font.pixelSize: 20
+ text: "Foobar"
+ }
+}
+
+