Skip to content
This repository was archived by the owner on Oct 15, 2024. It is now read-only.

Commit eed3cb9

Browse files
committed
Fix comment highlighting after signal or import.
- Fix #114. - Add test assets.
1 parent 1ec6ddb commit eed3cb9

26 files changed

+1437
-1
lines changed

src/test/assets/pylupdate.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from PyQt5.QtCore import QObject
2+
3+
class A(QObject):
4+
def hello(self):
5+
return self.tr("Hello")
6+
7+
class B(A):
8+
pass
9+
10+
a = A()
11+
a.hello()
12+
13+
b = B()
14+
b.hello()

src/test/assets/qml/comment.qml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import QtQuick 2.15 // comment
2+
import QtQuick.Controls 1.4 // comment
3+
import "myJs.js" as MyJs // comment
4+
import T2 // comment
5+
6+
Rectangle {
7+
// comment
8+
Item {
9+
signal clicked // comment
10+
signal hovered() // comment
11+
signal actionPerformed(string action, var actionResult) // comment
12+
}
13+
}

src/test/assets/qml/required.qml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Button {
2+
required property string description
3+
Accessible.description: description
4+
}

src/test/assets/qml/simple.qml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import QtQuick 2.3
2+
import QtQuick.Controls 1.4
3+
4+
ApplicationWindow {
5+
visible: true
6+
Rectangle {
7+
property real someNumber: .5
8+
width: 200
9+
height: 100
10+
color: "red"
11+
Text {
12+
anchors.centerIn: parent
13+
text: parent.someNumber
14+
}
15+
}
16+
}
17+
18+

src/test/assets/qml/syntax (1).qml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//Style.qml with custom singleton type definition
2+
pragma Singleton
3+
import QtQuick 2.0
4+
5+
QtObject {
6+
property int textSize: 20
7+
property color textColor: "green"
8+
}
9+
10+
// singleton type in use
11+
import QtQuick 2.0
12+
import CustomStyles 1.0
13+
14+
Text {
15+
font.pixelSize: Style.textSize
16+
color: Style.textColor
17+
text: "Hello World"
18+
}

src/test/assets/qml/syntax (2).qml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Text {
2+
text: "Hello world!" //a basic greeting
3+
/*
4+
We want this text to stand out from the rest so
5+
we give it a large size and different font.
6+
*/
7+
font.family: "Helvetica"
8+
font.pointSize: 24
9+
}

src/test/assets/qml/syntax (3).qml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import QtQuick 2.0
2+
3+
Rectangle {
4+
width: 100
5+
height: 100
6+
7+
gradient: Gradient {
8+
GradientStop { position: 0.0; color: "yellow" }
9+
GradientStop { position: 1.0; color: "green" }
10+
}
11+
12+
gradient {value: 50; editable: true; Layout.fillWidth: tr
13+
gradient {value: 50; editable: Layou
14+
}

src/test/assets/qml/syntax (4).qml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import QtQuick 2.121
2+
3+
Rectangle {
4+
id: colorbutton
5+
width: 200; height: 80;
6+
7+
/* TODO: this is a todo.
8+
XXX: something
9+
FIXME: fixme!
10+
DEBUG: debug here!
11+
*/
12+
13+
// BUG: bug here!
14+
// FIXME: fixme!
15+
// XXX: xxXXX
16+
color: "red"
17+
18+
TapHandler {
19+
id: inputHandler
20+
}
21+
22+
Component.onCompleted: {
23+
color = Qt.binding(
24+
function() {
25+
return inputHandler.pressed ? "steelblue" : "lightsteelblue"
26+
}
27+
);
28+
}
29+
}

src/test/assets/qml/syntax (5).qml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import QtQuick 2.1
2+
3+
Item {
4+
function fibonacci(n){
5+
var arr = [0, 1];
6+
for (var i = 2; i < n + 1; i++)
7+
arr.push(arr[i - 2] + arr[i -1]);
8+
9+
return arr;
10+
}
11+
12+
TapHandler {
13+
onTapped: console.log(fibonacci(10))
14+
}
15+
Rectangle {
16+
property color previousColor
17+
property color nextColor
18+
onNextColorChanged: console.log("The next color will be: " + nextColor.toString())
19+
}
20+
}

src/test/assets/qml/syntax (6).qml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import QtQuick 2.3
2+
import QtQuick.Controls 1.4
3+
import "myJs.js" as MyJs
4+
import T2
5+
6+
ApplicationWindow {
7+
visible: true
8+
Rectangle {
9+
property real someNumber: .5
10+
width: 200
11+
height: 100
12+
color: "red"
13+
14+
Text {
15+
anchors.centerIn: parent
16+
text: parent.someNumber
17+
}
18+
shouldBeBlue: 101.2
19+
shouldBeBlue2: Text {
20+
// contents
21+
}
22+
}
23+
}

0 commit comments

Comments
 (0)