1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
|
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:GPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 or (at your option) any later version
** approved by the KDE Free Qt Foundation. The licenses are as published by
** the Free Software Foundation and appearing in the file LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
import QtQuick 2.7
import QtQuick.VirtualKeyboard 2.1
import QtQuick.VirtualKeyboard.Styles 2.1
KeyboardStyle {
id: currentStyle
readonly property bool compactSelectionList: [InputEngine.Pinyin, InputEngine.Cangjie, InputEngine.Zhuyin].indexOf(InputContext.inputEngine.inputMode) !== -1
readonly property string fontFamily: "Sans"
readonly property real keyBackgroundMargin: Math.round(13 * scaleHint)
readonly property real keyContentMargin: Math.round(45 * scaleHint)
readonly property real keyIconScale: scaleHint * 0.6
readonly property string resourcePrefix: "qrc:/QtQuick/VirtualKeyboard/content/styles/default/"
readonly property string inputLocale: InputContext.locale
property color inputLocaleIndicatorColor: "white"
property Timer inputLocaleIndicatorHighlightTimer: Timer {
interval: 1000
onTriggered: inputLocaleIndicatorColor = "gray"
}
onInputLocaleChanged: {
inputLocaleIndicatorColor = "white"
inputLocaleIndicatorHighlightTimer.restart()
}
keyboardDesignWidth: 2560
keyboardDesignHeight: 800
keyboardRelativeLeftMargin: 114 / keyboardDesignWidth
keyboardRelativeRightMargin: 114 / keyboardDesignWidth
keyboardRelativeTopMargin: 13 / keyboardDesignHeight
keyboardRelativeBottomMargin: 86 / keyboardDesignHeight
keyboardBackground: Rectangle {
color: "black"
}
keyPanel: KeyPanel {
id: keyPanel
Rectangle {
id: keyBackground
radius: 5
color: "#383533"
anchors.fill: keyPanel
anchors.margins: keyBackgroundMargin
Text {
id: keySmallText
text: control.smallText
visible: control.smallTextVisible
color: "gray"
anchors.right: parent.right
anchors.top: parent.top
anchors.margins: keyContentMargin / 3
font {
family: fontFamily
weight: Font.Normal
pixelSize: 38 * scaleHint
capitalization: control.uppercased ? Font.AllUppercase : Font.MixedCase
}
}
Text {
id: keyText
text: control.displayText
color: "white"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
anchors.fill: parent
anchors.leftMargin: keyContentMargin
anchors.topMargin: keyContentMargin
anchors.rightMargin: keyContentMargin
anchors.bottomMargin: keyContentMargin
font {
family: fontFamily
weight: Font.Normal
pixelSize: 52 * scaleHint
capitalization: control.uppercased ? Font.AllUppercase : Font.MixedCase
}
}
}
states: [
State {
name: "pressed"
when: control.pressed
PropertyChanges {
target: keyBackground
opacity: 0.75
}
PropertyChanges {
target: keyText
opacity: 0.5
}
},
State {
name: "disabled"
when: !control.enabled
PropertyChanges {
target: keyBackground
opacity: 0.75
}
PropertyChanges {
target: keyText
opacity: 0.05
}
}
]
}
backspaceKeyPanel: KeyPanel {
id: backspaceKeyPanel
Rectangle {
id: backspaceKeyBackground
radius: 5
color: "#23211E"
anchors.fill: backspaceKeyPanel
anchors.margins: keyBackgroundMargin
Image {
id: backspaceKeyIcon
anchors.centerIn: parent
sourceSize.width: 159 * keyIconScale
sourceSize.height: 88 * keyIconScale
smooth: false
source: resourcePrefix + "images/backspace-868482.svg"
}
}
states: [
State {
name: "pressed"
when: control.pressed
PropertyChanges {
target: backspaceKeyBackground
opacity: 0.80
}
PropertyChanges {
target: backspaceKeyIcon
opacity: 0.6
}
},
State {
name: "disabled"
when: !control.enabled
PropertyChanges {
target: backspaceKeyBackground
opacity: 0.8
}
PropertyChanges {
target: backspaceKeyIcon
opacity: 0.2
}
}
]
}
languageKeyPanel: KeyPanel {
id: languageKeyPanel
Rectangle {
id: languageKeyBackground
radius: 5
color: "#35322f"
anchors.fill: languageKeyPanel
anchors.margins: keyBackgroundMargin
Image {
id: languageKeyIcon
anchors.centerIn: parent
sourceSize.width: 144 * keyIconScale
sourceSize.height: 144 * keyIconScale
smooth: false
source: resourcePrefix + "images/globe-868482.svg"
}
}
states: [
State {
name: "pressed"
when: control.pressed
PropertyChanges {
target: languageKeyBackground
opacity: 0.80
}
PropertyChanges {
target: languageKeyIcon
opacity: 0.75
}
},
State {
name: "disabled"
when: !control.enabled
PropertyChanges {
target: languageKeyBackground
opacity: 0.8
}
PropertyChanges {
target: languageKeyIcon
opacity: 0.2
}
}
]
}
enterKeyPanel: KeyPanel {
id: enterKeyPanel
Rectangle {
id: enterKeyBackground
radius: 5
color: "#1e1b18"
anchors.fill: enterKeyPanel
anchors.margins: keyBackgroundMargin
Image {
id: enterKeyIcon
visible: enterKeyText.text.length === 0
anchors.centerIn: parent
readonly property size enterKeyIconSize: {
switch (control.actionId) {
case EnterKeyAction.Go:
case EnterKeyAction.Send:
case EnterKeyAction.Next:
case EnterKeyAction.Done:
return Qt.size(170, 119)
case EnterKeyAction.Search:
return Qt.size(148, 148)
default:
return Qt.size(211, 80)
}
}
sourceSize.width: enterKeyIconSize.width * keyIconScale
sourceSize.height: enterKeyIconSize.height * keyIconScale
smooth: false
source: {
switch (control.actionId) {
case EnterKeyAction.Go:
case EnterKeyAction.Send:
case EnterKeyAction.Next:
case EnterKeyAction.Done:
return resourcePrefix + "images/check-868482.svg"
case EnterKeyAction.Search:
return resourcePrefix + "images/search-868482.svg"
default:
return resourcePrefix + "images/enter-868482.svg"
}
}
}
Text {
id: enterKeyText
visible: text.length !== 0
text: control.actionId !== EnterKeyAction.None ? control.displayText : ""
clip: true
fontSizeMode: Text.HorizontalFit
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
color: "#80c342"
font {
family: fontFamily
weight: Font.Normal
pixelSize: 44 * scaleHint
capitalization: Font.AllUppercase
}
anchors.fill: parent
anchors.margins: Math.round(42 * scaleHint)
}
}
states: [
State {
name: "pressed"
when: control.pressed
PropertyChanges {
target: enterKeyBackground
opacity: 0.80
}
PropertyChanges {
target: enterKeyIcon
opacity: 0.6
}
PropertyChanges {
target: enterKeyText
opacity: 0.6
}
},
State {
name: "disabled"
when: !control.enabled
PropertyChanges {
target: enterKeyBackground
opacity: 0.8
}
PropertyChanges {
target: enterKeyIcon
opacity: 0.2
}
PropertyChanges {
target: enterKeyText
opacity: 0.2
}
}
]
}
hideKeyPanel: KeyPanel {
id: hideKeyPanel
Rectangle {
id: hideKeyBackground
radius: 5
color: "#1e1b18"
anchors.fill: hideKeyPanel
anchors.margins: keyBackgroundMargin
Image {
id: hideKeyIcon
anchors.centerIn: parent
sourceSize.width: 144 * keyIconScale
sourceSize.height: 127 * keyIconScale
smooth: false
source: resourcePrefix + "images/hidekeyboard-868482.svg"
}
}
states: [
State {
name: "pressed"
when: control.pressed
PropertyChanges {
target: hideKeyBackground
opacity: 0.80
}
PropertyChanges {
target: hideKeyIcon
opacity: 0.6
}
},
State {
name: "disabled"
when: !control.enabled
PropertyChanges {
target: hideKeyBackground
opacity: 0.8
}
PropertyChanges {
target: hideKeyIcon
opacity: 0.2
}
}
]
}
shiftKeyPanel: KeyPanel {
id: shiftKeyPanel
Rectangle {
id: shiftKeyBackground
radius: 5
color: "#1e1b18"
anchors.fill: shiftKeyPanel
anchors.margins: keyBackgroundMargin
Image {
id: shiftKeyIcon
anchors.centerIn: parent
sourceSize.width: 144 * keyIconScale
sourceSize.height: 134 * keyIconScale
smooth: false
source: resourcePrefix + "images/shift-868482.svg"
}
states: [
State {
name: "capslock"
when: InputContext.capsLock
PropertyChanges {
target: shiftKeyBackground
color: "#5a892e"
}
PropertyChanges {
target: shiftKeyIcon
source: resourcePrefix + "images/shift-c5d6b6.svg"
}
},
State {
name: "shift"
when: InputContext.shift
PropertyChanges {
target: shiftKeyIcon
source: resourcePrefix + "images/shift-80c342.svg"
}
}
]
}
states: [
State {
name: "pressed"
when: control.pressed
PropertyChanges {
target: shiftKeyBackground
opacity: 0.80
}
PropertyChanges {
target: shiftKeyIcon
opacity: 0.6
}
},
State {
name: "disabled"
when: !control.enabled
PropertyChanges {
target: shiftKeyBackground
opacity: 0.8
}
PropertyChanges {
target: shiftKeyIcon
opacity: 0.2
}
}
]
}
spaceKeyPanel: KeyPanel {
id: spaceKeyPanel
Rectangle {
id: spaceKeyBackground
radius: 5
color: "#35322f"
anchors.fill: spaceKeyPanel
anchors.margins: keyBackgroundMargin
Text {
id: spaceKeyText
text: Qt.locale(InputContext.locale).nativeLanguageName
color: currentStyle.inputLocaleIndicatorColor
Behavior on color { PropertyAnimation { duration: 250 } }
anchors.centerIn: parent
font {
family: fontFamily
weight: Font.Normal
pixelSize: 48 * scaleHint
}
}
}
states: [
State {
name: "pressed"
when: control.pressed
PropertyChanges {
target: spaceKeyBackground
opacity: 0.80
}
},
State {
name: "disabled"
when: !control.enabled
PropertyChanges {
target: spaceKeyBackground
opacity: 0.8
}
}
]
}
symbolKeyPanel: KeyPanel {
id: symbolKeyPanel
Rectangle {
id: symbolKeyBackground
radius: 5
color: "#1e1b18"
anchors.fill: symbolKeyPanel
anchors.margins: keyBackgroundMargin
Text {
id: symbolKeyText
text: control.displayText
color: "white"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
anchors.fill: parent
anchors.margins: keyContentMargin
font {
family: fontFamily
weight: Font.Normal
pixelSize: 44 * scaleHint
capitalization: Font.AllUppercase
}
}
}
states: [
State {
name: "pressed"
when: control.pressed
PropertyChanges {
target: symbolKeyBackground
opacity: 0.80
}
PropertyChanges {
target: symbolKeyText
opacity: 0.6
}
},
State {
name: "disabled"
when: !control.enabled
PropertyChanges {
target: symbolKeyBackground
opacity: 0.8
}
PropertyChanges {
target: symbolKeyText
opacity: 0.2
}
}
]
}
modeKeyPanel: KeyPanel {
id: modeKeyPanel
Rectangle {
id: modeKeyBackground
radius: 5
color: "#1e1b18"
anchors.fill: modeKeyPanel
anchors.margins: keyBackgroundMargin
Text {
id: modeKeyText
text: control.displayText
color: "white"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
anchors.fill: parent
anchors.margins: keyContentMargin
font {
family: fontFamily
weight: Font.Normal
pixelSize: 44 * scaleHint
capitalization: Font.AllUppercase
}
}
Rectangle {
id: modeKeyIndicator
implicitHeight: parent.height * 0.1
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.leftMargin: parent.width * 0.4
anchors.rightMargin: parent.width * 0.4
anchors.bottomMargin: parent.height * 0.12
color: "#80c342"
radius: 3
visible: control.mode
}
}
states: [
State {
name: "pressed"
when: control.pressed
PropertyChanges {
target: modeKeyBackground
opacity: 0.80
}
PropertyChanges {
target: modeKeyText
opacity: 0.6
}
},
State {
name: "disabled"
when: !control.enabled
PropertyChanges {
target: modeKeyBackground
opacity: 0.8
}
PropertyChanges {
target: modeKeyText
opacity: 0.2
}
}
]
}
handwritingKeyPanel: KeyPanel {
id: handwritingKeyPanel
Rectangle {
id: hwrKeyBackground
radius: 5
color: "#35322f"
anchors.fill: handwritingKeyPanel
anchors.margins: keyBackgroundMargin
Image {
id: hwrKeyIcon
anchors.centerIn: parent
readonly property size hwrKeyIconSize: keyboard.handwritingMode ? Qt.size(124, 96) : Qt.size(156, 104)
sourceSize.width: hwrKeyIconSize.width * keyIconScale
sourceSize.height: hwrKeyIconSize.height * keyIconScale
smooth: false
source: resourcePrefix + (keyboard.handwritingMode ? "images/textmode-868482.svg" : "images/handwriting-868482.svg")
}
}
states: [
State {
name: "pressed"
when: control.pressed
PropertyChanges {
target: hwrKeyBackground
opacity: 0.80
}
PropertyChanges {
target: hwrKeyIcon
opacity: 0.6
}
},
State {
name: "disabled"
when: !control.enabled
PropertyChanges {
target: hwrKeyBackground
opacity: 0.8
}
PropertyChanges {
target: hwrKeyIcon
opacity: 0.2
}
}
]
}
characterPreviewMargin: 0
characterPreviewDelegate: Item {
property string text
id: characterPreview
Rectangle {
id: characterPreviewBackground
anchors.fill: parent
color: "#5d5b59"
radius: 5
Text {
id: characterPreviewText
color: "white"
text: characterPreview.text
fontSizeMode: Text.HorizontalFit
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
anchors.fill: parent
anchors.margins: Math.round(48 * scaleHint)
font {
family: fontFamily
weight: Font.Normal
pixelSize: 82 * scaleHint
}
}
}
}
alternateKeysListItemWidth: 99 * scaleHint
alternateKeysListItemHeight: 150 * scaleHint
alternateKeysListDelegate: Item {
id: alternateKeysListItem
width: alternateKeysListItemWidth
height: alternateKeysListItemHeight
Text {
id: listItemText
text: model.text
color: "#868482"
font {
family: fontFamily
weight: Font.Normal
pixelSize: 52 * scaleHint
}
anchors.centerIn: parent
}
states: State {
name: "current"
when: alternateKeysListItem.ListView.isCurrentItem
PropertyChanges {
target: listItemText
color: "white"
}
}
}
alternateKeysListHighlight: Rectangle {
color: "#5d5b59"
radius: 5
}
alternateKeysListBackground: Rectangle {
color: "#1e1b18"
radius: 5
}
selectionListHeight: 85 * scaleHint
selectionListDelegate: SelectionListItem {
id: selectionListItem
width: Math.round(selectionListLabel.width + selectionListLabel.anchors.leftMargin * 2)
Text {
id: selectionListLabel
anchors.left: parent.left
anchors.leftMargin: Math.round((compactSelectionList ? 50 : 140) * scaleHint)
anchors.verticalCenter: parent.verticalCenter
text: decorateText(display, wordCompletionLength)
color: "#80c342"
font {
family: fontFamily
weight: Font.Normal
pixelSize: 44 * scaleHint
}
function decorateText(text, wordCompletionLength) {
if (wordCompletionLength > 0) {
return text.slice(0, -wordCompletionLength) + '<u>' + text.slice(-wordCompletionLength) + '</u>'
}
return text
}
}
Rectangle {
id: selectionListSeparator
width: 4 * scaleHint
height: 36 * scaleHint
radius: 2
color: "#35322f"
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.left
}
states: State {
name: "current"
when: selectionListItem.ListView.isCurrentItem
PropertyChanges {
target: selectionListLabel
color: "white"
}
}
}
selectionListBackground: Rectangle {
color: "#1e1b18"
}
selectionListAdd: Transition {
NumberAnimation { property: "y"; from: wordCandidateView.height; duration: 200 }
NumberAnimation { property: "opacity"; from: 0; to: 1; duration: 200 }
}
selectionListRemove: Transition {
NumberAnimation { property: "y"; to: -wordCandidateView.height; duration: 200 }
NumberAnimation { property: "opacity"; to: 0; duration: 200 }
}
navigationHighlight: Rectangle {
color: "transparent"
border.color: "yellow"
border.width: 5
}
traceInputKeyPanelDelegate: TraceInputKeyPanel {
id: traceInputKeyPanel
traceMargins: keyBackgroundMargin
Rectangle {
id: traceInputKeyPanelBackground
radius: 5
color: "#35322f"
anchors.fill: traceInputKeyPanel
anchors.margins: keyBackgroundMargin
Text {
id: hwrInputModeIndicator
visible: control.patternRecognitionMode === InputEngine.HandwritingRecoginition
text: {
switch (InputContext.inputEngine.inputMode) {
case InputEngine.Numeric:
if (["ar", "fa"].indexOf(InputContext.locale.substring(0, 2)) !== -1)
return "\u0660\u0661\u0662"
// Fallthrough
case InputEngine.Dialable:
return "123"
case InputEngine.Greek:
return "ΑΒΓ"
case InputEngine.Cyrillic:
return "АБВ"
case InputEngine.Arabic:
if (InputContext.locale.substring(0, 2) === "fa")
return "\u0627\u200C\u0628\u200C\u067E"
return "\u0623\u200C\u0628\u200C\u062C"
case InputEngine.Hebrew:
return "\u05D0\u05D1\u05D2"
case InputEngine.ChineseHandwriting:
return "中文"
case InputEngine.JapaneseHandwriting:
return "日本語"
case InputEngine.KoreanHandwriting:
return "한국어"
default:
return "Abc"
}
}
color: "white"
anchors.left: parent.left
anchors.top: parent.top
anchors.margins: keyContentMargin
font {
family: fontFamily
weight: Font.Normal
pixelSize: 44 * scaleHint
capitalization: {
if (InputContext.capsLock)
return Font.AllUppercase
if (InputContext.shift)
return Font.MixedCase
return Font.AllLowercase
}
}
}
}
Canvas {
id: traceInputKeyGuideLines
anchors.fill: traceInputKeyPanelBackground
opacity: 0.1
onPaint: {
var ctx = getContext("2d")
ctx.lineWidth = 1
ctx.strokeStyle = Qt.rgba(0xFF, 0xFF, 0xFF)
ctx.clearRect(0, 0, width, height)
var i
var margin = Math.round(30 * scaleHint)
if (control.horizontalRulers) {
for (i = 0; i < control.horizontalRulers.length; i++) {
ctx.beginPath()
var y = Math.round(control.horizontalRulers[i])
var rightMargin = Math.round(width - margin)
if (i + 1 === control.horizontalRulers.length) {
ctx.moveTo(margin, y)
ctx.lineTo(rightMargin, y)
} else {
var dashLen = Math.round(20 * scaleHint)
for (var dash = margin, dashCount = 0;
dash < rightMargin; dash += dashLen, dashCount++) {
if ((dashCount & 1) === 0) {
ctx.moveTo(dash, y)
ctx.lineTo(Math.min(dash + dashLen, rightMargin), y)
}
}
}
ctx.stroke()
}
}
if (control.verticalRulers) {
for (i = 0; i < control.verticalRulers.length; i++) {
ctx.beginPath()
ctx.moveTo(control.verticalRulers[i], margin)
ctx.lineTo(control.verticalRulers[i], Math.round(height - margin))
ctx.stroke()
}
}
}
Connections {
target: control
onHorizontalRulersChanged: traceInputKeyGuideLines.requestPaint()
onVerticalRulersChanged: traceInputKeyGuideLines.requestPaint()
}
}
}
traceCanvasDelegate: TraceCanvas {
id: traceCanvas
onAvailableChanged: {
if (!available)
return
var ctx = getContext("2d")
if (parent.canvasType === "fullscreen") {
ctx.lineWidth = 10
ctx.strokeStyle = Qt.rgba(0, 0, 0)
} else {
ctx.lineWidth = 10 * scaleHint
ctx.strokeStyle = Qt.rgba(0xFF, 0xFF, 0xFF)
}
ctx.lineCap = "round"
ctx.fillStyle = ctx.strokeStyle
}
autoDestroyDelay: 800
onTraceChanged: if (trace === null) opacity = 0
Behavior on opacity { PropertyAnimation { easing.type: Easing.OutCubic; duration: 150 } }
}
popupListDelegate: SelectionListItem {
property real cursorAnchor: popupListLabel.x + popupListLabel.width
id: popupListItem
width: popupListLabel.width + popupListLabel.anchors.leftMargin * 2
height: popupListLabel.height + popupListLabel.anchors.topMargin * 2
Text {
id: popupListLabel
anchors.left: parent.left
anchors.top: parent.top
anchors.leftMargin: popupListLabel.height / 2
anchors.topMargin: popupListLabel.height / 3
text: decorateText(display, wordCompletionLength)
color: "#5CAA15"
font {
family: fontFamily
weight: Font.Normal
pixelSize: Qt.inputMethod.cursorRectangle.height * 0.8
}
function decorateText(text, wordCompletionLength) {
if (wordCompletionLength > 0) {
return text.slice(0, -wordCompletionLength) + '<u>' + text.slice(-wordCompletionLength) + '</u>'
}
return text
}
}
states: State {
name: "current"
when: popupListItem.ListView.isCurrentItem
PropertyChanges {
target: popupListLabel
color: "black"
}
}
}
popupListBackground: Item {
Rectangle {
width: parent.width
height: parent.height
color: "white"
border {
width: 1
color: "#929495"
}
}
}
popupListAdd: Transition {
NumberAnimation { property: "opacity"; from: 0; to: 1.0; duration: 200 }
}
popupListRemove: Transition {
NumberAnimation { property: "opacity"; to: 0; duration: 200 }
}
languagePopupListEnabled: true
languageListDelegate: SelectionListItem {
id: languageListItem
width: languageNameTextMetrics.width * 17
height: languageNameTextMetrics.height + languageListLabel.anchors.topMargin + languageListLabel.anchors.bottomMargin
Text {
id: languageListLabel
anchors.left: parent.left
anchors.top: parent.top
anchors.leftMargin: languageNameTextMetrics.height / 2
anchors.rightMargin: anchors.leftMargin
anchors.topMargin: languageNameTextMetrics.height / 3
anchors.bottomMargin: anchors.topMargin
text: languageNameFormatter.elidedText
color: "#5CAA15"
font {
family: fontFamily
weight: Font.Normal
pixelSize: 44 * scaleHint
}
}
TextMetrics {
id: languageNameTextMetrics
font {
family: fontFamily
weight: Font.Normal
pixelSize: 44 * scaleHint
}
text: "X"
}
TextMetrics {
id: languageNameFormatter
font {
family: fontFamily
weight: Font.Normal
pixelSize: 44 * scaleHint
}
elide: Text.ElideRight
elideWidth: languageListItem.width - languageListLabel.anchors.leftMargin - languageListLabel.anchors.rightMargin
text: displayName
}
states: State {
name: "current"
when: languageListItem.ListView.isCurrentItem
PropertyChanges {
target: languageListLabel
color: "black"
}
}
}
languageListBackground: Rectangle {
color: "white"
border {
width: 1
color: "#929495"
}
}
languageListAdd: Transition {
NumberAnimation { property: "opacity"; from: 0; to: 1.0; duration: 200 }
}
languageListRemove: Transition {
NumberAnimation { property: "opacity"; to: 0; duration: 200 }
}
selectionHandle: Image {
sourceSize.width: 20
source: resourcePrefix + "images/selectionhandle-bottom.svg"
}
fullScreenInputContainerBackground: Rectangle {
color: "#FFF"
}
fullScreenInputBackground: Rectangle {
color: "#FFF"
}
fullScreenInputMargins: Math.round(15 * scaleHint)
fullScreenInputPadding: Math.round(30 * scaleHint)
fullScreenInputCursor: Rectangle {
width: 1
color: "#000"
visible: parent.blinkStatus
}
fullScreenInputFont.pixelSize: 58 * scaleHint
}
|