1
- import { QmlElement } from './qmlTypes' ;
2
-
3
1
export type AnchorLineProp =
4
2
| 'left'
5
3
| 'top'
@@ -49,9 +47,9 @@ export type AnchorPrimitiveKey =
49
47
| 'alignWhenCentered' ;
50
48
51
49
type AnchorSubscription = {
52
- source : QmlElement ;
50
+ source : Qml . QmlElement ;
53
51
sourceProp : AnchorRefProp ;
54
- target ?: QmlElement ;
52
+ target ?: Qml . QmlElement ;
55
53
targetProp ?: AnchorRefProp ;
56
54
onTargetChanged ?: ( ) => void ;
57
55
} ;
@@ -60,15 +58,15 @@ export interface AnchorRef {
60
58
value ( ) : any ;
61
59
isReady ( ) : boolean ;
62
60
type ( ) : string ;
63
- addSubscription ( source : QmlElement , sourceProp : AnchorRefProp ) : void ;
64
- removeSubscription ( source : QmlElement , sourceProp : AnchorRefProp ) : void ;
61
+ addSubscription ( source : Qml . QmlElement , sourceProp : AnchorRefProp ) : void ;
62
+ removeSubscription ( source : Qml . QmlElement , sourceProp : AnchorRefProp ) : void ;
65
63
}
66
64
67
65
abstract class AbstractAnchorRef implements AnchorRef {
68
- protected qmlElement : QmlElement | null ;
66
+ protected qmlElement : Qml . QmlElement | null ;
69
67
protected subscriptions : Array < AnchorSubscription > = [ ] ;
70
68
71
- constructor ( qmlElement : QmlElement | null = null ) {
69
+ constructor ( qmlElement : Qml . QmlElement | null = null ) {
72
70
this . qmlElement = qmlElement ;
73
71
}
74
72
@@ -85,7 +83,7 @@ abstract class AbstractAnchorRef implements AnchorRef {
85
83
} ) ;
86
84
}
87
85
88
- setQmlElement ( qmlElement : QmlElement ) : void {
86
+ setQmlElement ( qmlElement : Qml . QmlElement ) : void {
89
87
if ( this . qmlElement != null ) {
90
88
throw new Error ( 'Anchor ref cannot be used twice' ) ;
91
89
}
@@ -97,14 +95,14 @@ abstract class AbstractAnchorRef implements AnchorRef {
97
95
return this . qmlElement != null ;
98
96
}
99
97
100
- addSubscription ( source : QmlElement , sourceProp : AnchorRefProp ) : void {
98
+ addSubscription ( source : Qml . QmlElement , sourceProp : AnchorRefProp ) : void {
101
99
this . subscriptions . push ( { source, sourceProp } ) ;
102
100
if ( this . qmlElement ) {
103
101
source . anchors [ sourceProp ] = this . value ( ) ;
104
102
}
105
103
}
106
104
107
- removeSubscription ( source : QmlElement , sourceProp : AnchorRefProp ) : void {
105
+ removeSubscription ( source : Qml . QmlElement , sourceProp : AnchorRefProp ) : void {
108
106
for ( let index = 0 ; index < this . subscriptions . length ; index ++ ) {
109
107
const subscription = this . subscriptions [ index ] ;
110
108
if (
@@ -124,7 +122,7 @@ abstract class AbstractAnchorRef implements AnchorRef {
124
122
export class AnchorLineRef extends AbstractAnchorRef {
125
123
private line : AnchorLineProp ;
126
124
127
- constructor ( line : AnchorLineProp , qmlElement : QmlElement | null = null ) {
125
+ constructor ( line : AnchorLineProp , qmlElement : Qml . QmlElement | null = null ) {
128
126
super ( qmlElement ) ;
129
127
this . line = line ;
130
128
}
@@ -166,7 +164,7 @@ export class Anchor extends AbstractAnchorRef {
166
164
this . bottom = new AnchorLineRef ( 'bottom' ) ;
167
165
}
168
166
169
- setQmlElement ( qmlElement : QmlElement ) : void {
167
+ setQmlElement ( qmlElement : Qml . QmlElement ) : void {
170
168
super . setQmlElement ( qmlElement ) ;
171
169
172
170
this . left . setQmlElement ( qmlElement ) ;
@@ -198,7 +196,7 @@ export class ParentAnchor {
198
196
private static parentAnchorSubscriptions : Array < AnchorSubscription > = [ ] ;
199
197
200
198
private static updateAnchors = (
201
- childElement : QmlElement ,
199
+ childElement : Qml . QmlElement ,
202
200
childPropName : AnchorRefProp ,
203
201
parentPropName ?: AnchorRefProp
204
202
) => {
@@ -218,7 +216,7 @@ export class ParentAnchor {
218
216
} ;
219
217
220
218
static addSubscription (
221
- childElement : QmlElement ,
219
+ childElement : Qml . QmlElement ,
222
220
childPropName : AnchorRefProp ,
223
221
parentAnchorRef ?: string
224
222
) : void {
@@ -256,7 +254,7 @@ export class ParentAnchor {
256
254
}
257
255
258
256
static removeSubscription (
259
- childElement : QmlElement ,
257
+ childElement : Qml . QmlElement ,
260
258
childPropName : AnchorRefProp
261
259
) : void {
262
260
for (
0 commit comments