aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Hartmann <thomas.hartmann@qt.io>2023-07-07 13:34:02 +0200
committerThomas Hartmann <thomas.hartmann@qt.io>2023-09-28 12:48:38 +0200
commitd4a58382b0df38f93c23fe81f6b27633563a2295 (patch)
treeeac82db0be1d612bc50b879509e7816147435183
parent499fc5cb216856ada518dd1f103d5b3e391399a2 (diff)
Fix warnings on Studio components
Fixing nearly all qmllint related issues. Adding type annotations, fixing unqualified access where possible and various other small fixes. Some compiler issues could not be resolved. For some legacy modules we simply turn of chachegen Task-number: QDS-9812 Task-number: QDS-9814 Task-number: QDS-10225 Task-number: QDS-9813 Task-number: QDS-9810 Change-Id: I110b34982f5855660db5ab0d51116bf6446ae467 Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
-rw-r--r--src/imports/components/ArcItem.qml24
-rw-r--r--src/imports/components/BorderItem.qml4
-rw-r--r--src/imports/components/CMakeLists.txt1
-rw-r--r--src/imports/components/FlipableItem.qml6
-rw-r--r--src/imports/components/IsoItem.qml10
-rw-r--r--src/imports/components/PieItem.qml12
-rw-r--r--src/imports/components/RegularPolygonItem.qml13
-rw-r--r--src/imports/components/TriangleItem.qml33
-rw-r--r--src/imports/effects_qt6/CMakeLists.txt2
-rw-r--r--src/imports/flowview/CMakeLists.txt2
-rw-r--r--src/imports/flowview/FlowEffect.qml6
-rw-r--r--src/imports/flowview/FlowTransition.qml2
-rw-r--r--src/imports/flowview/SwipeInteraction.qml34
-rw-r--r--src/imports/logichelper/BidirectionalBinding.qml24
-rw-r--r--src/imports/multitext/CMakeLists.txt2
-rw-r--r--src/imports/tools/eventsimulator/CMakeLists.txt2
-rw-r--r--src/imports/tools/eventsimulator/EventSimulator.qml4
-rw-r--r--src/imports/tools/eventsimulator/EventSimulatorDelegate.qml5
-rw-r--r--src/imports/tools/eventsystem/CMakeLists.txt2
-rw-r--r--src/imports/tools/eventsystem/EventSystem.qml17
20 files changed, 127 insertions, 78 deletions
diff --git a/src/imports/components/ArcItem.qml b/src/imports/components/ArcItem.qml
index a1c8f2e..473a2f8 100644
--- a/src/imports/components/ArcItem.qml
+++ b/src/imports/components/ArcItem.qml
@@ -313,39 +313,41 @@ Shape {
*/
property bool roundBegin: root.round
- function clamp(num, min, max) {
+ function clamp(num: double, min: double, max: double): double {
return Math.max(min, Math.min(num, max))
}
- function toRadians(degrees) {
+// qmllint disable compiler
+ function toRadians(degrees: double): double {
return degrees * (Math.PI / 180.0)
}
+// qmllint enable compiler
- function myCos(angleInDegrees) {
+ function myCos(angleInDegrees: double): double {
return Math.cos(root.toRadians(angleInDegrees))
}
- function mySin(angleInDegrees) {
+ function mySin(angleInDegrees: double): double {
return Math.sin(root.toRadians(angleInDegrees))
}
- function polarToCartesianX(centerX, centerY, radius, angleInDegrees) {
+ function polarToCartesianX(centerX: double, centerY: double, radius: double, angleInDegrees: double): double {
return centerX + radius * Math.cos(root.toRadians(angleInDegrees))
}
- function polarToCartesianY(centerX, centerY, radius, angleInDegrees) {
+ function polarToCartesianY(centerX: double, centerY: double, radius: double, angleInDegrees: double): double {
return centerY + radius * Math.sin(root.toRadians(angleInDegrees))
}
- function sortedBegin() {
+ function sortedBegin(): double {
return Math.min(root.begin, root.end)
}
- function sortedEnd() {
+ function sortedEnd(): double {
return Math.min(Math.max(root.begin, root.end), root.sortedBegin() + 359.9)
}
- function isArcFull() {
+ function isArcFull(): bool {
return root.alpha > 359.5
}
@@ -383,6 +385,7 @@ Shape {
startY: root.polarToCartesianY(path.__xCenter, path.__yCenter, path.__yRadius, root.sortedBegin() - 90)
}
+// qmllint disable compiler
function constructArcItem() {
root.clearPathElements()
@@ -479,13 +482,16 @@ Shape {
path.pathElements.push(pathMove)
}
}
+ // qmllint enable compiler
+ // qmllint disable compiler
function clearPathElements() {
for (var i = 0; i !== path.pathElements.length; ++i)
path.pathElements[i].destroy()
path.pathElements = []
}
+ // qmllint enable compiler
Component.onCompleted: {
root.__wasFull = root.isArcFull()
diff --git a/src/imports/components/BorderItem.qml b/src/imports/components/BorderItem.qml
index 5644bbf..64c36cb 100644
--- a/src/imports/components/BorderItem.qml
+++ b/src/imports/components/BorderItem.qml
@@ -403,6 +403,7 @@ Shape {
onDrawBottomChanged: root.constructBorderItem()
onDrawLeftChanged: root.constructBorderItem()
+// qmllint disable compiler
function constructBorderItem() {
root.clearPathElements()
@@ -494,13 +495,16 @@ Shape {
path.pathElements.push(pathArc)
}
}
+// qmllint enable compiler
+// qmllint disable compiler
function clearPathElements() {
for (var i = 0; i !== path.pathElements.length; ++i)
path.pathElements[i].destroy()
path.pathElements = []
}
+// qmllint enable compiler
Component.onCompleted: root.constructBorderItem()
}
diff --git a/src/imports/components/CMakeLists.txt b/src/imports/components/CMakeLists.txt
index ad6df51..581269c 100644
--- a/src/imports/components/CMakeLists.txt
+++ b/src/imports/components/CMakeLists.txt
@@ -4,6 +4,7 @@ qt6_add_qml_module(QuickStudioComponents
VERSION "${PROJECT_VERSION}"
RESOURCE_PREFIX "/qt-project.org/imports"
DESIGNER_SUPPORTED
+ CLASS_NAME Std_Cmpt
PAST_MAJOR_VERSIONS 1
QML_FILES
ArcItem.qml
diff --git a/src/imports/components/FlipableItem.qml b/src/imports/components/FlipableItem.qml
index b731fe0..0af774f 100644
--- a/src/imports/components/FlipableItem.qml
+++ b/src/imports/components/FlipableItem.qml
@@ -115,19 +115,21 @@ Flipable {
*/
property int rotationalAxis: 1 // 0: x-axis, 1: y-axis
+ // qmllint disable compiler
Binding {
target: flipable.front
- value: opacityFront
+ value: flipable.opacityFront
property: "opacity"
when: flipable.front !== undefined
}
Binding {
target: flipable.back
- value: opacityBack
+ value: flipable.opacityBack
property: "opacity"
when: flipable.back !== undefined
}
+// qmllint enable compiler
/*!
Whether the type has been flipped.
diff --git a/src/imports/components/IsoItem.qml b/src/imports/components/IsoItem.qml
index c217ba3..1b7eb8e 100644
--- a/src/imports/components/IsoItem.qml
+++ b/src/imports/components/IsoItem.qml
@@ -27,9 +27,9 @@
**
****************************************************************************/
+// qmllint disable import
import QtQuick 2.0
import QtQuick 2.9
-import QtQuick.Extras 1.4
/*!
\qmltype IsoItem
@@ -53,7 +53,7 @@ import QtQuick.Extras 1.4
The QML code looks as follows:
\code
- IsoItem {
+ Item {
id: arrowIsoIcon
color: "#808080"
anchors.fill: parent
@@ -62,6 +62,10 @@ import QtQuick.Extras 1.4
\endcode
*/
-Picture {
+Item {
+ property color color: "#808080"
+ property url source: "./iso-icons/iso_grs_7000_4_0251.dat"
}
+
+// qmllint enable import
diff --git a/src/imports/components/PieItem.qml b/src/imports/components/PieItem.qml
index 1dc0cdd..a9190bb 100644
--- a/src/imports/components/PieItem.qml
+++ b/src/imports/components/PieItem.qml
@@ -248,7 +248,7 @@ Shape {
layer.smooth: root.antialiasing
layer.samples: root.antialiasing ? 4 : 0
- function clamp(num, min, max) {
+ function clamp(num: double, min: double, max: double): double {
return Math.max(min, Math.min(num, max))
}
@@ -263,15 +263,17 @@ Shape {
return false
}
- function toRadians(degrees) {
- return degrees * (Math.PI / 180.0)
+ // qmllint disable compiler
+ function toRadians(degrees: double): double {
+ return degrees * (Math.PI / 180.0) //Math.PI creates warning
}
+ // qmllint enable compiler
- function polarToCartesianX(centerX, centerY, radius, angleInDegrees) {
+ function polarToCartesianX(centerX: double, centerY: double, radius: double, angleInDegrees: double): double {
return centerX + radius * Math.cos(root.toRadians(angleInDegrees))
}
- function polarToCartesianY(centerX, centerY, radius, angleInDegrees) {
+ function polarToCartesianY(centerX: double, centerY: double, radius: double, angleInDegrees: double): double {
return centerY + radius * Math.sin(root.toRadians(angleInDegrees))
}
diff --git a/src/imports/components/RegularPolygonItem.qml b/src/imports/components/RegularPolygonItem.qml
index 555d73f..29849f1 100644
--- a/src/imports/components/RegularPolygonItem.qml
+++ b/src/imports/components/RegularPolygonItem.qml
@@ -212,10 +212,14 @@ Shape {
root.constructRoundedPolygonPath()
}
- function toRadians(degrees) {
+// qmllint disable compiler
+ function toRadians(degrees: double): double {
return degrees * (Math.PI / 180.0)
}
+// qmllint enable compiler
+
+// qmllint disable compiler
function constructNonRoundedPolygonPath() {
for (var cornerNumber = 0; cornerNumber < root.sideCount; cornerNumber++) {
let angleToCorner = root.toRadians(cornerNumber * (360.0 / root.sideCount))
@@ -245,13 +249,15 @@ Shape {
pathLineClose.y = Qt.binding(function() { return path.startY } )
path.pathElements.push(pathLineClose)
}
+// qmllint enable compiler
property real __halfInteriorCornerAngle: 90 - (180.0 / root.sideCount)
property real __halfCornerArcSweepAngle: 90 - root.__halfInteriorCornerAngle
property real __distanceToCornerArcCenter: root.__radius - root.__actualRadius /
Math.sin(root.toRadians(root.__halfInteriorCornerAngle))
- function constructRoundedPolygonPath() {
+ function constructRoundedPolygonPath(): double {
+ // qmllint disable compiler
for (var cornerNumber = 0; cornerNumber < root.sideCount; cornerNumber++) {
let angleToCorner = cornerNumber * (360.0 / root.sideCount)
@@ -300,6 +306,7 @@ Shape {
}
path.pathElements.push(pathArc)
+ // qmllint enable compiler
}
// Close the polygon
@@ -309,10 +316,12 @@ Shape {
path.pathElements.push(pathLineClose)
}
+// qmllint disable compiler
function clearPathElements() {
for (var i = 0; i !== path.pathElements.length; ++i)
path.pathElements[i].destroy()
path.pathElements = []
}
+// qmllint enable compiler
}
diff --git a/src/imports/components/TriangleItem.qml b/src/imports/components/TriangleItem.qml
index 8dc57a1..9fae541 100644
--- a/src/imports/components/TriangleItem.qml
+++ b/src/imports/components/TriangleItem.qml
@@ -387,46 +387,39 @@ Shape {
Component.onCompleted: root.calc()
- function length(x, y) {
+ function length(x: double, y: double): double {
return Math.sqrt(x * x + y * y)
}
- function normalize(x, y) {
+ function normalize(x: double, y: double) : vector2d {
var l = length(x, y)
- return {
- x: x / l,
- y: y / l
- }
+ return Qt.vector2d(x / l, y / l)
}
- function dotProduct(x1, y1, x2, y2) {
+ function dotProduct(x1: double, y1: double, x2: double, y2: double): double {
return x1 * x2 + y1 * y2;
}
- function project(x1, y1, x2, y2) {
+ function project(x1: double, y1: double, x2: double, y2: double) : vector2d {
var normalized = normalize(x1, y1)
var dot = dotProduct(normalized.x, normalized.y, x2, y2)
- return {
- x: normalized.x * dot,
- y: normalized.y * dot
- }
+ return Qt.vector2d(normalized.x * dot, normalized.y * dot)
}
- function intersect(x1, y1, x2, y2, x3, y3, x4, y4) {
+ function intersect(x1: double, y1: double, x2: double, y2: double, x3: double, y3: double, x4: double, y4: double) : vector2d {
var denom = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1)
var ua = ((x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3)) / denom
var ub = ((x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3)) / denom
- return {
- x: x1 + ua * (x2 - x1),
- y: y1 + ua * (y2 - y1)
- };
+
+ return Qt.vector2d(x1 + ua * (x2 - x1), y1 + ua * (y2 - y1))
}
- function moveLine(startX, startY, endX, endY) {
+ // qmllint disable compiler
+ function moveLine(startX: double, startY: double, endX: double, endY: double) : var {
var angle = Math.atan2(endY - startY, endX - startX)
var xOffset = Math.sin(angle) * Math.min(root.radius, root.maxRadius)
var yOffset = -Math.cos(angle) * Math.min(root.radius, root.maxRadius)
@@ -438,18 +431,22 @@ Shape {
endY: endY + yOffset
};
}
+ // qmllint enable compiler
function calc() {
var movedLine1 = moveLine(path.__width / 2, 0, 0, path.__height)
var movedLine2 = moveLine(path.__width, path.__height, path.__width / 2, 0)
var movedLine3 = moveLine(0, path.__height, path.__width, path.__height)
+ // qmllint disable compiler
+
var lengthLine1 = Math.floor(root.length(movedLine1.endX - movedLine1.startX,
movedLine1.endY - movedLine1.startY))
var lengthLine2 = Math.floor(root.length(movedLine2.endX - movedLine2.startX,
movedLine2.endY - movedLine2.startY))
var lengthLine3 = Math.floor(root.length(movedLine3.endX - movedLine3.startX,
movedLine3.endY - movedLine3.startY))
+ // qmllint enable compiler
var perimeter = lengthLine1 + lengthLine2 + lengthLine3
var area = (path.__height) * (path.__width) * 0.5
diff --git a/src/imports/effects_qt6/CMakeLists.txt b/src/imports/effects_qt6/CMakeLists.txt
index 86366a2..27a4067 100644
--- a/src/imports/effects_qt6/CMakeLists.txt
+++ b/src/imports/effects_qt6/CMakeLists.txt
@@ -5,6 +5,8 @@ qt6_add_qml_module(QuickStudioEffects
RESOURCE_PREFIX "/qt-project.org/imports"
DESIGNER_SUPPORTED
PAST_MAJOR_VERSIONS 1
+ NO_LINT
+ NO_CACHEGEN
QML_FILES
FastBlurItem.qml
GlowItem.qml
diff --git a/src/imports/flowview/CMakeLists.txt b/src/imports/flowview/CMakeLists.txt
index 9c3aad5..dea4052 100644
--- a/src/imports/flowview/CMakeLists.txt
+++ b/src/imports/flowview/CMakeLists.txt
@@ -10,6 +10,8 @@ qt6_add_qml_module(FlowView
DESIGNER_SUPPORTED
PAST_MAJOR_VERSIONS 1
NO_GENERATE_QMLDIR
+ NO_LINT
+ NO_CACHEGEN
QML_FILES
DefaultFlowEffect.qml
SwipeInteraction.qml
diff --git a/src/imports/flowview/FlowEffect.qml b/src/imports/flowview/FlowEffect.qml
index 08bafc0..12367d2 100644
--- a/src/imports/flowview/FlowEffect.qml
+++ b/src/imports/flowview/FlowEffect.qml
@@ -57,7 +57,7 @@ QtObject {
property bool __aborted: false
function enable() {
- timeline.enabled = true
+ root.timeline.enabled = true
root.started()
}
@@ -104,7 +104,7 @@ QtObject {
property bool backwards: false
property Binding timelineBinding: Binding {
- target: timeline
+ target: root.timeline
property: "currentFrame"
value: root.progress * 10
}
@@ -130,7 +130,7 @@ QtObject {
target: root
property: "progress"
onStopped: {
- timeline.enabled = false
+ root.timeline.enabled = false
/* reset all typical properties */
resetProperties()
diff --git a/src/imports/flowview/FlowTransition.qml b/src/imports/flowview/FlowTransition.qml
index 5ff1d27..9dab0de 100644
--- a/src/imports/flowview/FlowTransition.qml
+++ b/src/imports/flowview/FlowTransition.qml
@@ -98,7 +98,7 @@ QtObject {
property EventListener eventListener: EventListener {
id: eventListener
- onTriggered: root.__receiveEvent(parameters)
+ onTriggered: root.__receiveEvent(eventListener.parameters)
}
function trigger() {
diff --git a/src/imports/flowview/SwipeInteraction.qml b/src/imports/flowview/SwipeInteraction.qml
index 7c7472e..0cbf0c5 100644
--- a/src/imports/flowview/SwipeInteraction.qml
+++ b/src/imports/flowview/SwipeInteraction.qml
@@ -37,7 +37,7 @@ Item {
id: root
property var transitionView
property var list
- parent: transitionView
+ parent: root.transitionView
anchors.fill: parent
z: -1
@@ -55,13 +55,13 @@ Item {
}
Connections {
- target: transitionView
+ target: root.transitionView
function onTransitionFinished() {
if (!root.__reactToTransition)
return
/* This is a tricky one. We have to also update the list.
The connection could be also done the other way around */
- list.currentItem = root.__activeItem
+ root.list.currentItem = root.__activeItem
root.__reactToTransition = false
}
}
@@ -75,29 +75,29 @@ Item {
function distance() {
if (root.horizontal)
- return (centroid.position.x - centroid.pressPosition.x) / transitionView.width
- return -(centroid.position.y - centroid.pressPosition.y) / transitionView.height
+ return (centroid.position.x - centroid.pressPosition.x) / root.transitionView.width
+ return -(centroid.position.y - centroid.pressPosition.y) / root.transitionView.height
}
onActiveChanged: {
if (handler.active) {
if (distance() < 0)
- transitionView.nextItem = list.nextItem
+ root.transitionView.nextItem = root.list.nextItem
else
- transitionView.nextItem = list.prevItem
+ root.transitionView.nextItem = root.list.prevItem
- transitionView.scheduleTransition()
- if (transitionView.currentTransition)
- transitionView.currentTransition.effect.enable()
+ root.transitionView.scheduleTransition()
+ if (root.transitionView.currentTransition)
+ root.transitionView.currentTransition.effect.enable()
} else {
var p = Math.abs(distance()) * 100
- if (transitionView.currentTransition && transitionView.currentTransition.effect.progress > root.threshold) {
- root.__activeItem = transitionView.nextItem
+ if (root.transitionView.currentTransition && root.transitionView.currentTransition.effect.progress > root.threshold) {
+ root.__activeItem = root.transitionView.nextItem
root.__reactToTransition = true
- transitionView.currentTransition.__start()
+ root.transitionView.currentTransition.__start()
} else { /* Drag was released, but threshold was not passed */
- if (transitionView.currentTransition)
- transitionView.currentTransition.effect.abort()
+ if (root.transitionView.currentTransition)
+ root.transitionView.currentTransition.effect.abort()
}
/* Block for 100ms */
handler.enabled = false
@@ -111,8 +111,8 @@ Item {
var p = Math.abs(distance()) * 100
- if (transitionView.currentTransition)
- transitionView.currentTransition.effect.progress = p * 2
+ if (root.transitionView.currentTransition)
+ root.transitionView.currentTransition.effect.progress = p * 2
}
}
}
diff --git a/src/imports/logichelper/BidirectionalBinding.qml b/src/imports/logichelper/BidirectionalBinding.qml
index f025b29..9d8986f 100644
--- a/src/imports/logichelper/BidirectionalBinding.qml
+++ b/src/imports/logichelper/BidirectionalBinding.qml
@@ -110,40 +110,40 @@ QtObject {
property bool block: false
onValue01Changed: {
- if (__internal.block)
+ if (object.__internal.block)
return;
- __internal.block = true;
+ object.__internal.block = true;
try {
- object.target02[property02] = __internal.value01
+ object.target02[property02] = object.__internal.value01
} catch(error) {
}
- __internal.block = false;
+ object.__internal.block = false;
}
onValue02Changed: {
- if (__internal.block)
+ if (object.__internal.block)
return;
- __internal.block = true;
+ object.__internal.block = true;
try {
- object.target01[property01] = __internal.value02
+ object.target01[property01] = object.__internal.value02
} catch(error) {
}
- __internal.block = false;
+ object.__internal.block = false;
}
}
property Binding __b01: Binding {
- target: __internal
+ target: object.__internal
property: "value01"
- value: target01[property01]
+ value: object.target01[object.property01]
}
property Binding __b02: Binding {
- target: __internal
+ target: object.__internal
property: "value02"
- value: target02[property02]
+ value: object.target02[object.property02]
}
diff --git a/src/imports/multitext/CMakeLists.txt b/src/imports/multitext/CMakeLists.txt
index 5028bac..2c65e3d 100644
--- a/src/imports/multitext/CMakeLists.txt
+++ b/src/imports/multitext/CMakeLists.txt
@@ -5,6 +5,8 @@ qt6_add_qml_module(QuickStudioMultiText
RESOURCE_PREFIX "/qt-project.org/imports"
DESIGNER_SUPPORTED
PAST_MAJOR_VERSIONS 1
+ NO_LINT
+ NO_CACHEGEN
QML_FILES
MultiTextElement.qml
MultiTextItem.qml
diff --git a/src/imports/tools/eventsimulator/CMakeLists.txt b/src/imports/tools/eventsimulator/CMakeLists.txt
index a9b0c70..cad720a 100644
--- a/src/imports/tools/eventsimulator/CMakeLists.txt
+++ b/src/imports/tools/eventsimulator/CMakeLists.txt
@@ -9,6 +9,8 @@ qt6_add_qml_module(QuickStudioEventSimulator
RESOURCE_PREFIX "/qt-project.org/imports"
DESIGNER_SUPPORTED
PAST_MAJOR_VERSIONS 1
+ NO_LINT
+ NO_CACHEGEN
QML_FILES
EventSimulator.qml
EventSimulatorDelegate.qml
diff --git a/src/imports/tools/eventsimulator/EventSimulator.qml b/src/imports/tools/eventsimulator/EventSimulator.qml
index c9a1638..627db02 100644
--- a/src/imports/tools/eventsimulator/EventSimulator.qml
+++ b/src/imports/tools/eventsimulator/EventSimulator.qml
@@ -35,6 +35,8 @@ import QtQuick.Studio.EventSystem 1.0
QtObject {
id: root
+// qmllint disable compiler
+
property ListModel __filteredModel: ListModel{}
property font font: {
family: "Verdana"
@@ -162,4 +164,6 @@ QtObject {
}
}
+
+// qmllint enable compiler
}
diff --git a/src/imports/tools/eventsimulator/EventSimulatorDelegate.qml b/src/imports/tools/eventsimulator/EventSimulatorDelegate.qml
index e592cbd..ed24704 100644
--- a/src/imports/tools/eventsimulator/EventSimulatorDelegate.qml
+++ b/src/imports/tools/eventsimulator/EventSimulatorDelegate.qml
@@ -31,6 +31,9 @@ import QtQuick 2.10
import QtQuick.Studio.EventSystem 1.0
Rectangle {
+ // qmllint disable unqualified
+ // qmllint disable compiler
+
id: delegateItem
width: 190
height: 60
@@ -76,4 +79,6 @@ Rectangle {
EventSystem.triggerEvent(eventId)
}
}
+ // qmllint enable unqualified
+ // qmllint enable compiler
}
diff --git a/src/imports/tools/eventsystem/CMakeLists.txt b/src/imports/tools/eventsystem/CMakeLists.txt
index e363b25..ad5e1ae 100644
--- a/src/imports/tools/eventsystem/CMakeLists.txt
+++ b/src/imports/tools/eventsystem/CMakeLists.txt
@@ -10,6 +10,8 @@ qt6_add_qml_module(QuickStudioEventSystem
RESOURCE_PREFIX "/qt-project.org/imports"
DESIGNER_SUPPORTED
PAST_MAJOR_VERSIONS 1
+ NO_LINT
+ NO_CACHEGEN
QML_FILES
EventSystem.qml
EventListener.qml
diff --git a/src/imports/tools/eventsystem/EventSystem.qml b/src/imports/tools/eventsystem/EventSystem.qml
index d2e3d83..c9ef90a 100644
--- a/src/imports/tools/eventsystem/EventSystem.qml
+++ b/src/imports/tools/eventsystem/EventSystem.qml
@@ -31,27 +31,32 @@ import QtQuick 2.10
import QtQuick.Window 2.2
Item {
+ id: root
signal eventTriggered(string eventID, string parameters)
property ListModel model
+// qmllint disable compiler
+
function __modelLoaded()
{
model = eventListLoader.item
}
- function init(modelURI) {
- eventListLoader.loaded.connect(__modelLoaded)
+ function init(modelURI: string) {
+ eventListLoader.loaded.connect(root.__modelLoaded)
eventListLoader.source = modelURI
}
- function triggerEvent(eventId) {
- for (var i = 0; i < model.count; i++) {
- if (model.get(i).eventId === eventId) {
- eventTriggered(eventId, model.get(i).parameters)
+ function triggerEvent(eventId :int) {
+ for (var i = 0; i < root.model.count; i++) {
+ if (root.model.get(i).eventId === eventId) {
+ root.eventTriggered(eventId, root.model.get(i).parameters)
}
}
}
+// qmllint enable compiler
+
Loader {
id: eventListLoader
}