Skip to content

Commit 5bea47c

Browse files
authored
Merge pull request #84 from ratijas/cosmit
Cosmit
2 parents 7597ddc + a3ec872 commit 5bea47c

File tree

11 files changed

+173
-132
lines changed

11 files changed

+173
-132
lines changed

examples/graph/src/main.qml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
****************************************************************************/
5050

5151
import QtQuick 2.0
52-
5352
import Graph 1.0
5453

5554
Item {
@@ -70,7 +69,7 @@ Item {
7069
appendSample(newSample(i));
7170
}
7271

73-
property int offset: 100;
72+
property int offset: 100
7473
}
7574

7675
Timer {
@@ -82,7 +81,6 @@ Item {
8281
graph.removeFirstSample();
8382
graph.appendSample(graph.newSample(++graph.offset));
8483
}
85-
8684
}
8785

8886
Rectangle {
@@ -91,5 +89,4 @@ Item {
9189
border.color: "black"
9290
border.width: 2
9391
}
94-
9592
}

examples/qmlextensionplugins/README

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
This example is showing that you can use plugins with qml builder.
2-
It is base on the `qmlextensionplugins` example found in the qtdeclarative
1+
This example shows how you can use plugins with qml builder.
2+
It is based on the `qmlextensionplugins` example found in the qtdeclarative
33
source code. It needs the QML files from that example in the Qt source tree.
44

55
Build with:

examples/qmlextensionplugins/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ impl TimeModel {
4646
if *lock {
4747
break;
4848
}
49-
// We just wait on the condition variable for 1 second to similate a one second timer
49+
// We just wait on the condition variable for 1 second to simulate a one second timer
5050
let lock = arc2
5151
.abort_condvar
5252
.wait_timeout(lock, std::time::Duration::from_millis(1000))

examples/todos/README

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,3 @@ This example is based on a rust-qt-binding-generator example from Jos van den Oe
22
https://github.com/KDE/rust-qt-binding-generator/tree/9822dcef071f8c6d6ec2f6b39bab436613493221/examples/todos
33
The file main.qml is imported unmodified, and the file implementation.rs was used and adapted to
44
the qmetaobject crate
5-
6-

examples/todos/main.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import QtQuick 2.9
2323
import QtQuick.Controls 2.2
2424
import QtQuick.Layouts 1.3
25-
import RustCode 1.0;
25+
import RustCode 1.0
2626

2727
ApplicationWindow {
2828
visible: true

examples/todos/src/main.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ mod implementation;
77

88
qrc!(my_resource,
99
"todos/qml" {
10-
// "../main.qml" as "main.qml",
1110
"main.qml",
1211
},
1312
);

qmetaobject/src/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,6 @@ pub use lazy_static::*;
168168
#[macro_export]
169169
macro_rules! qmetaobject_lazy_static { ($($t:tt)*) => { lazy_static!($($t)*) } }
170170

171-
//#[macro_use]
172-
//extern crate bitflags;
173-
174171
use std::cell::RefCell;
175172
use std::os::raw::{c_char, c_void};
176173

qmetaobject/tests/models.rs

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,25 @@ fn simple_model() {
3232
pub a: QString,
3333
pub b: u32,
3434
}
35-
// FIXME! why vec! here?
3635
let model: qmetaobject::listmodel::SimpleListModel<TM> =
37-
(vec![TM { a: "hello".into(), b: 1 }]).into_iter().collect();
36+
std::iter::once(TM { a: "hello".into(), b: 42 }).collect();
3837
assert!(do_test(
3938
model,
40-
"Item {
41-
Repeater{
39+
"
40+
Item {
41+
Repeater {
4242
id: rep;
43-
model:_obj;
43+
model: _obj
4444
Text {
45-
text: a + b;
45+
text: a + b
4646
}
4747
}
4848
function doTest() {
4949
console.log('simple_model:', rep.count, rep.itemAt(0).text);
50-
return rep.count === 1 && rep.itemAt(0).text === 'hello1';
51-
}}"
50+
return rep.count === 1 && rep.itemAt(0).text === 'hello42';
51+
}
52+
}
53+
"
5254
));
5355
}
5456

@@ -86,19 +88,25 @@ fn simple_model_remove() {
8688

8789
assert!(do_test(
8890
obj,
89-
"Item {
91+
"
92+
Item {
9093
Repeater{
91-
id: rep;
92-
model:_obj.list;
94+
id: rep
95+
model: _obj.list
9396
Text {
94-
text: val;
97+
text: val
9598
}
9699
}
97100
function doTest() {
98101
_obj.remove(1);
99102
console.log('simple_model_remove', rep.count, rep.itemAt(0).text, rep.itemAt(1).text, rep.itemAt(2).text);
100-
return rep.count === 3 && rep.itemAt(0).text === '10' && rep.itemAt(1).text === '12' && rep.itemAt(2).text === '13';
101-
}}"
103+
return rep.count === 3
104+
&& rep.itemAt(0).text === '10'
105+
&& rep.itemAt(1).text === '12'
106+
&& rep.itemAt(2).text === '13';
107+
}
108+
}
109+
"
102110
));
103111
}
104112

0 commit comments

Comments
 (0)