Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts: src/qml/qmldirparser/qqmldirparser.cpp src/qml/qmldirparser/qqmldirparser_p.h Change-Id: Ia68a8d4f345e6e456eebc3f215fc90d3819ddd70
This commit is contained in:
commit
e80067f265
|
@ -1417,12 +1417,12 @@ Item {
|
|||
// Divide dx and dy to have intermediate mouseMove while dragging
|
||||
// Fractions of dx/dy need be superior to the dragThreshold
|
||||
// to make the drag works though
|
||||
var ddx = Math.round(dx/3)
|
||||
if (ddx < (util.dragThreshold + 1))
|
||||
ddx = 0
|
||||
var ddy = Math.round(dy/3)
|
||||
if (ddy < (util.dragThreshold + 1))
|
||||
ddy = 0
|
||||
var intermediateDx = Math.round(dx/3)
|
||||
if (Math.abs(intermediateDx) < (util.dragThreshold + 1))
|
||||
intermediateDx = 0
|
||||
var intermediateDy = Math.round(dy/3)
|
||||
if (Math.abs(intermediateDy) < (util.dragThreshold + 1))
|
||||
intermediateDy = 0
|
||||
|
||||
mousePress(item, x, y, button, modifiers, delay)
|
||||
|
||||
|
@ -1431,9 +1431,9 @@ Item {
|
|||
var dragTriggerXDistance = dx > 0 ? (util.dragThreshold + 1) : 0
|
||||
var dragTriggerYDistance = dy > 0 ? (util.dragThreshold + 1) : 0
|
||||
mouseMove(item, x + dragTriggerXDistance, y + dragTriggerYDistance, moveDelay, button)
|
||||
if (ddx > 0 || ddy > 0) {
|
||||
mouseMove(item, x + ddx, y + ddy, moveDelay, button)
|
||||
mouseMove(item, x + 2*ddx, y + 2*ddy, moveDelay, button)
|
||||
if (intermediateDx !== 0 || intermediateDy !== 0) {
|
||||
mouseMove(item, x + intermediateDx, y + intermediateDy, moveDelay, button)
|
||||
mouseMove(item, x + 2*intermediateDx, y + 2*intermediateDy, moveDelay, button)
|
||||
}
|
||||
mouseMove(item, x + dx, y + dy, moveDelay, button)
|
||||
mouseRelease(item, x + dx, y + dy, button, modifiers, delay)
|
||||
|
|
|
@ -1129,7 +1129,8 @@ void QQmlTypeLoader::setQmldirContent(const QString &url, const QString &content
|
|||
m_importQmlDirCache.insert(url, qmldir);
|
||||
}
|
||||
|
||||
qmldir->setContent(url, content);
|
||||
if (!qmldir->hasContent())
|
||||
qmldir->setContent(url, content);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
@ -74,6 +74,7 @@ QString QQmlTypeLoaderQmldirContent::typeNamespace() const
|
|||
|
||||
void QQmlTypeLoaderQmldirContent::setContent(const QString &location, const QString &content)
|
||||
{
|
||||
Q_ASSERT(!m_hasContent);
|
||||
m_hasContent = true;
|
||||
m_location = location;
|
||||
m_parser.parse(content);
|
||||
|
|
|
@ -73,6 +73,20 @@ static bool parseVersion(const QString &str, int *major, int *minor)
|
|||
return false;
|
||||
}
|
||||
|
||||
void QQmlDirParser::clear()
|
||||
{
|
||||
_errors.clear();
|
||||
_typeNamespace.clear();
|
||||
_components.clear();
|
||||
_dependencies.clear();
|
||||
_imports.clear();
|
||||
_scripts.clear();
|
||||
_plugins.clear();
|
||||
_designerSupported = false;
|
||||
_typeInfos.clear();
|
||||
_className.clear();
|
||||
}
|
||||
|
||||
inline static void scanSpace(const QChar *&ch) {
|
||||
while (ch->isSpace() && !ch->isNull() && *ch != QLatin1Char('\n'))
|
||||
++ch;
|
||||
|
@ -93,13 +107,6 @@ inline static void scanWord(const QChar *&ch) {
|
|||
*/
|
||||
bool QQmlDirParser::parse(const QString &source)
|
||||
{
|
||||
_errors.clear();
|
||||
_plugins.clear();
|
||||
_components.clear();
|
||||
_scripts.clear();
|
||||
_designerSupported = false;
|
||||
_className.clear();
|
||||
|
||||
quint16 lineNumber = 0;
|
||||
bool firstLine = true;
|
||||
|
||||
|
|
|
@ -64,6 +64,7 @@ class QQmlEngine;
|
|||
class Q_QMLCOMPILER_PRIVATE_EXPORT QQmlDirParser
|
||||
{
|
||||
public:
|
||||
void clear();
|
||||
bool parse(const QString &source);
|
||||
|
||||
bool hasError() const;
|
||||
|
|
|
@ -1150,7 +1150,7 @@ QObject *QQmlDelegateModelPrivate::object(Compositor::Group group, int index, QQ
|
|||
if (m_delegateChooser) {
|
||||
QQmlAbstractDelegateComponent *chooser = m_delegateChooser;
|
||||
do {
|
||||
delegate = chooser->delegate(&m_adaptorModel, index);
|
||||
delegate = chooser->delegate(&m_adaptorModel, cacheItem->index);
|
||||
chooser = qobject_cast<QQmlAbstractDelegateComponent *>(delegate);
|
||||
} while (chooser);
|
||||
if (!delegate)
|
||||
|
|
|
@ -28,5 +28,6 @@ void main()
|
|||
sCoordDown = (tCoord - vec2(0.0, 1.0)) * ubuf.textureScale;
|
||||
sCoordLeft = (tCoord - vec2(-1.0, 0.0)) * ubuf.textureScale;
|
||||
sCoordRight = (tCoord - vec2(1.0, 0.0)) * ubuf.textureScale;
|
||||
gl_Position = ubuf.matrix * vCoord;
|
||||
vec3 dprSnapPos = floor(vCoord.xyz * ubuf.dpr + 0.5) / ubuf.dpr;
|
||||
gl_Position = ubuf.matrix * vec4(dprSnapPos, vCoord.w);
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -22,5 +22,6 @@ void main()
|
|||
{
|
||||
sampleCoord = tCoord * ubuf.textureScale;
|
||||
shiftedSampleCoord = (tCoord - ubuf.shift) * ubuf.textureScale;
|
||||
gl_Position = ubuf.matrix * floor((vCoord * ubuf.dpr) + 0.5) / ubuf.dpr;
|
||||
vec3 dprSnapPos = floor(vCoord.xyz * ubuf.dpr + 0.5) / ubuf.dpr;
|
||||
gl_Position = ubuf.matrix * vec4(dprSnapPos, vCoord.w);
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -17,5 +17,6 @@ out gl_PerVertex { vec4 gl_Position; };
|
|||
void main()
|
||||
{
|
||||
sampleCoord = tCoord * ubuf.textureScale;
|
||||
gl_Position = ubuf.matrix * floor((vCoord * ubuf.dpr) + 0.5) / ubuf.dpr;
|
||||
vec3 dprSnapPos = floor(vCoord.xyz * ubuf.dpr + 0.5) / ubuf.dpr;
|
||||
gl_Position = ubuf.matrix * vec4(dprSnapPos, vCoord.w);
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -375,6 +375,9 @@ void tst_qqmldirparser::parse()
|
|||
QCOMPARE(toStringList(p.dependencies()), dependencies);
|
||||
|
||||
QCOMPARE(p.designerSupported(), designerSupported);
|
||||
|
||||
p.clear();
|
||||
QVERIFY(p.typeNamespace().isEmpty());
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_qqmldirparser)
|
||||
|
|
|
@ -150,6 +150,15 @@ Rectangle{
|
|||
SignalSpy {}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: mouseAreaComponent
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
}
|
||||
}
|
||||
|
||||
TestCase {
|
||||
name:"mouserelease"
|
||||
when:windowShown
|
||||
|
@ -295,5 +304,26 @@ Rectangle{
|
|||
else
|
||||
verify(contentYSpy.count > 0)
|
||||
}
|
||||
|
||||
function test_negativeDragDistance_data() {
|
||||
return [
|
||||
{ tag: "horizontal", startX: 100, startY: 100, xDistance: -90, yDistance: 0 },
|
||||
{ tag: "vertical", startX: 100, startY: 100, xDistance: 0, yDistance: -90 }
|
||||
]
|
||||
}
|
||||
|
||||
// Tests that dragging to the left or top actually results in intermediate mouse moves.
|
||||
function test_negativeDragDistance(data) {
|
||||
let mouseArea = createTemporaryObject(mouseAreaComponent, root)
|
||||
verify(mouseArea)
|
||||
|
||||
let positionSpy = signalSpyComponent.createObject(mouseArea,
|
||||
{ target: mouseArea, signalName: "positionChanged" })
|
||||
verify(positionSpy)
|
||||
verify(positionSpy.valid)
|
||||
|
||||
mouseDrag(mouseArea, data.startX, data.startY, data.xDistance, data.yDistance)
|
||||
verify(positionSpy.count > 2, "Expected more than 2 mouse position changes, but only got " + positionSpy.count)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
import QtQml.Models 2.12
|
||||
import Qt.labs.qmlmodels 1.0
|
||||
import QtQuick 2.12
|
||||
|
||||
Item {
|
||||
id: root
|
||||
width: 200
|
||||
height: 320
|
||||
|
||||
property int numChanges: 0
|
||||
property bool ok: true
|
||||
|
||||
DelegateModel {
|
||||
id: theModel
|
||||
|
||||
model: ListModel {
|
||||
ListElement { role: "section" }
|
||||
ListElement { role: "item" }
|
||||
ListElement { role: "section" }
|
||||
ListElement { role: "item" }
|
||||
ListElement { role: "section" }
|
||||
ListElement { role: "item" }
|
||||
ListElement { role: "item" }
|
||||
ListElement { role: "item" }
|
||||
}
|
||||
|
||||
filterOnGroup: "expanded"
|
||||
groups: DelegateModelGroup {
|
||||
name: "expanded"
|
||||
}
|
||||
|
||||
delegate: DelegateChooser {
|
||||
role: "role"
|
||||
|
||||
DelegateChoice {
|
||||
roleValue: "section"
|
||||
Text {
|
||||
text: "+ Section " + index
|
||||
|
||||
Timer {
|
||||
interval: (index + 10)
|
||||
repeat: true
|
||||
running: true
|
||||
onTriggered: {
|
||||
++ root.numChanges;
|
||||
if (model.role !== "section") {
|
||||
root.ok = false;
|
||||
console.warn("wrong!", root.numChanges);
|
||||
}
|
||||
let i = parent.DelegateModel.itemsIndex + 1;
|
||||
for (; i < theModel.items.count; ++i) {
|
||||
let item = theModel.items.get(i);
|
||||
if (item.model.role === "section")
|
||||
break;
|
||||
item.inExpanded = !item.inExpanded;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DelegateChoice {
|
||||
roleValue: "item"
|
||||
Text {
|
||||
text: "Item " + index
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: items.addGroups(0, items.count, ["expanded"])
|
||||
}
|
||||
|
||||
ListView {
|
||||
anchors.fill: parent
|
||||
model: theModel
|
||||
}
|
||||
}
|
|
@ -433,6 +433,7 @@ private slots:
|
|||
void invalidContext();
|
||||
void externalManagedModel();
|
||||
void delegateModelChangeDelegate();
|
||||
void checkFilterGroupForDelegate();
|
||||
|
||||
private:
|
||||
template <int N> void groups_verify(
|
||||
|
@ -4342,6 +4343,19 @@ void tst_qquickvisualdatamodel::delegateModelChangeDelegate()
|
|||
QCOMPARE(visualModel->count(), 3);
|
||||
}
|
||||
|
||||
void tst_qquickvisualdatamodel::checkFilterGroupForDelegate()
|
||||
{
|
||||
QQuickView view;
|
||||
view.setSource(testFileUrl("filterGroupForDelegate.qml"));
|
||||
view.show();
|
||||
|
||||
QQuickItem *obj = view.rootObject();
|
||||
QVERIFY(obj);
|
||||
|
||||
QTRY_VERIFY(obj->property("numChanges").toInt() > 100);
|
||||
QVERIFY(obj->property("ok").toBool());
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_qquickvisualdatamodel)
|
||||
|
||||
#include "tst_qquickvisualdatamodel.moc"
|
||||
|
|
Loading…
Reference in New Issue