Skip to content

Commit d20c032

Browse files
authored
Merge pull request #39 from neochapay/5.2
Add scaling
2 parents 921bbd9 + e96571c commit d20c032

21 files changed

+273
-94
lines changed

examples/touch/content/TabBarPage.qml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,23 +74,23 @@ Page {
7474
frame: Item { }
7575
tab: Item {
7676
implicitWidth: control.width/control.count
77-
implicitHeight: 50
77+
implicitHeight: size.dp(50)
7878
BorderImage {
7979
anchors.fill: parent
80-
border.bottom: 8
81-
border.top: 8
80+
border.bottom: size.dp(8)
81+
border.top: size.dp(8)
8282
source: styleData.selected ? "../images/tab_selected.png":"../images/tabs_standard.png"
8383
Text {
8484
anchors.centerIn: parent
8585
color: "white"
8686
text: styleData.title.toUpperCase()
87-
font.pixelSize: 16
87+
font.pixelSize: size.dp(16)
8888
}
8989
Rectangle {
9090
visible: index > 0
9191
anchors.top: parent.top
9292
anchors.bottom: parent.bottom
93-
anchors.margins: 10
93+
anchors.margins: size.dp(10)
9494
width:1
9595
color: "#3a3a3a"
9696
}

examples/touch/content/TextInputPage.qml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,36 +65,36 @@ Page {
6565
headerTools: HeaderToolsLayout { showBackButton: true; title: "Text input" }
6666

6767
Column {
68-
spacing: 40
68+
spacing: size.dp(40)
6969
anchors.centerIn: parent
7070

7171
TextField {
72-
anchors.margins: 20
72+
anchors.margins: size.dp(20)
7373
text: "Text input"
7474
//style: touchStyle
7575
}
7676

7777
TextField {
78-
anchors.margins: 20
78+
anchors.margins: size.dp(20)
7979
text: "Readonly Text input"
8080
//style: touchStyle
8181
readOnly: true
8282
}
8383

8484
TextField {
85-
anchors.margins: 20
85+
anchors.margins: size.dp(20)
8686
text: "Disabled textfield"
8787
enabled: false
8888
}
8989

9090
TextField {
91-
anchors.margins: 20
91+
anchors.margins: size.dp(20)
9292
text: "Text input"
9393
style: touchStyle
9494
}
9595

9696
TextField {
97-
anchors.margins: 20
97+
anchors.margins: size.dp(20)
9898
text: "Readonly Text input"
9999
style: touchStyle
100100
readOnly: true
@@ -107,14 +107,14 @@ Page {
107107

108108
TextFieldStyle {
109109
textColor: "white"
110-
font.pixelSize: 28
110+
font.pixelSize: size.dp(28)
111111
background: Item {
112-
implicitHeight: 50
113-
implicitWidth: 320
112+
implicitHeight: size.dp(50)
113+
implicitWidth: size.dp(320)
114114
BorderImage {
115115
source: "../images/textinput.png"
116-
border.left: 8
117-
border.right: 8
116+
border.left: size.dp(8)
117+
border.right: size.dp(8)
118118
anchors.bottom: parent.bottom
119119
anchors.left: parent.left
120120
anchors.right: parent.right

rpm/qtquickcontrols-nemo.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Name: qt5-qtquickcontrols-nemo
22
Summary: Nemomobile Qt Quick Controls
3-
Version: 5.1.3
3+
Version: 5.2.0
44
Release: nemo1
55
Group: Qt/Qt
66
License: LGPLv2.1 with exception or GPLv3

src/controls/ButtonRow.qml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Rectangle {
3636
id: main
3737
width: childrenRect.width
3838
color: "#313131"
39-
height: 40
39+
height: size.dp(40)
4040
property ListModel model: ListModel {}
4141
property bool enabled: true
4242
property int currentIndex: -1
@@ -51,10 +51,10 @@ Rectangle {
5151
Rectangle{
5252
id: selecter
5353
x: rowElement.children[main.currentIndex].x || 0
54-
y: -5
54+
y: size.dp(-5)
5555

5656
width: rowElement.children[main.currentIndex].width || 0
57-
height: 50
57+
height: size.dp(50)
5858
color: "#0091e5"
5959

6060
visible: main.currentIndex > -1
@@ -74,11 +74,9 @@ Rectangle {
7474
model: main.model
7575
delegate: Rectangle {
7676
id: rowItem
77-
height: 50
77+
height: size.dp(40)
7878
width: text.width+(text.width/name.length*2)
7979

80-
y: -5
81-
8280
color: "transparent"
8381
MouseArea {
8482
width: parent.width
@@ -93,6 +91,7 @@ Rectangle {
9391
Label {
9492
id: text
9593
text: name
94+
height: parent.heigh
9695

9796
anchors.horizontalCenter: parent.horizontalCenter
9897

src/controls/GlacierRoller.qml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Item {
2121
id: label
2222
visible: label.text != ""
2323
font.capitalization: Font.AllUppercase
24-
font.pixelSize: 14
24+
font.pixelSize: size.dp(14)
2525
color: "white"
2626

2727
anchors{
@@ -51,19 +51,19 @@ Item {
5151

5252
PathView{
5353
id: view
54-
property int itemHeight: 40
54+
property int itemHeight: size.dp(40)
5555
property bool showRow: false
5656

5757
interactive: activated
58-
width: parent.width-60
59-
height: 40
58+
width: parent.width-size.dp(60)
59+
height: size.dp(40)
6060
clip: true
6161

6262
anchors{
6363
top: label.top
64-
topMargin: 20
64+
topMargin: size.dp(20)
6565
left: label.left
66-
leftMargin: 30
66+
leftMargin: size.dp(30)
6767
}
6868

6969
pathItemCount: height/itemHeight

src/controls/Header.qml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Item {
6262
PropertyChanges {
6363
target: toolBarRect
6464
width: parent.width
65-
height: 75
65+
height: size.dp(75)
6666
}
6767
},
6868
State {
@@ -91,7 +91,7 @@ Item {
9191
}
9292
PropertyChanges {
9393
target: toolBarRect
94-
width: 75
94+
width: size.dp(75)
9595
height: parent.height
9696
}
9797
}

src/controls/HeaderToolsLayout.qml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ Item {
2525

2626
Rectangle {
2727
id: backButton
28-
width: opacity ? 60 : 0
29-
anchors.leftMargin: 20
28+
width: opacity ? size.dp(60) : 0
29+
anchors.leftMargin: size.dp(20)
3030
//check if Stack.view has already been initialized as well
3131
anchors.verticalCenter: parent.verticalCenter
3232
antialiasing: true
3333
height: width
34-
radius: 4
34+
radius: size.dp(4)
3535
color: backmouse.pressed ? "#222" : "transparent"
3636

3737
rotation: isUiPortrait ? 0 : 90
@@ -46,7 +46,7 @@ Item {
4646
MouseArea {
4747
id: backmouse
4848
anchors.fill: parent
49-
anchors.margins: -10
49+
anchors.margins: size.dp(-10)
5050
onClicked: header && header.stackView && header.stackView.pop()
5151
}
5252
}
@@ -56,16 +56,16 @@ Item {
5656
anchors.right: toolButtonsContainer.left
5757
anchors.left: backButton.visible ? backButton.right : parent.left
5858
anchors.verticalCenter: parent.verticalCenter
59-
anchors.leftMargin: 20
60-
anchors.rightMargin: 20
59+
anchors.leftMargin: size.dp(20)
60+
anchors.rightMargin: size.dp(20)
6161
clip: true
6262
font.family: Theme.fontFamily
6363
color: Theme.label.color
64-
font.pointSize: 24
64+
font.pointSize: size.dp(24)
6565
font.weight: Font.Bold
6666
LinearGradient {
6767
anchors.right: parent.right
68-
width: 50
68+
width: size.dp(50)
6969
height: parent.paintedHeight
7070
visible: titleTxt.paintedWidth > titleTxt.width
7171
start: Qt.point(0,0)
@@ -79,9 +79,9 @@ Item {
7979
Item {
8080
id: toolButtonsContainer
8181
anchors.right: dots.visible ? dots.left : parent.right
82-
anchors.rightMargin: 20
82+
anchors.rightMargin: size.dp(20)
8383
anchors.verticalCenter: parent.verticalCenter
84-
width: tools ? (50 * Math.min(maxNumberOfToolButtons, tools.length)) : 0
84+
width: tools ? (size.dp(50) * Math.min(maxNumberOfToolButtons, tools.length)) : 0
8585

8686
property int maxNumberOfToolButtons: 3
8787

@@ -107,7 +107,7 @@ Item {
107107
Image {
108108
id: dots
109109
anchors.right: parent.right
110-
anchors.rightMargin: 20
110+
anchors.rightMargin: size.dp(20)
111111
anchors.verticalCenter: parent.verticalCenter
112112
visible: drawerLevels && drawerLevels.length > 1
113113
source: "../Styles/Nemo/images/dots-vertical.png"

src/controls/Label.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@ Text {
3535
renderType: Text.NativeRendering
3636
font.family: Theme.fontFamily
3737
color: Theme.label.color
38-
font.pointSize: Theme.label.pointSize
38+
font.pointSize: size.dp(Theme.label.pointSize)
3939
}

src/controls/ListView.qml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ ListView {
1515
id: sectionHeading
1616
Rectangle {
1717
width: listView.width
18-
height: 44
18+
height: size.dp(44)
1919
color: "black"
2020

2121
Text {
2222
id: sectionText
2323
text: section
2424
font.capitalization: Font.AllUppercase
25-
font.pixelSize: 20
25+
font.pixelSize: size.dp(20)
2626
color: "white"
2727
anchors{
2828
left: parent.left
29-
leftMargin: 10
29+
leftMargin: size.dp(10)
3030
verticalCenter: parent.verticalCenter
3131
}
3232
}
@@ -35,10 +35,10 @@ ListView {
3535
id: line
3636
height: 1
3737
color: "white"
38-
width: listView.width-sectionText.width-30
38+
width: listView.width-sectionText.width-size.dp(30)
3939
anchors{
4040
left: sectionText.right
41-
leftMargin: 10
41+
leftMargin: size.dp(10)
4242
verticalCenter: sectionText.verticalCenter
4343
}
4444
}
@@ -48,15 +48,15 @@ ListView {
4848
Item{
4949
id: bottom
5050
width: parent.width
51-
height: 30
51+
height: size.dp(30)
5252
anchors.bottom: parent.bottom
5353

5454
visible: listView.contentHeight > listView.height
5555

5656
LinearGradient{
5757
anchors.fill: parent
5858
start: Qt.point(0, 0)
59-
end: Qt.point(0, 30)
59+
end: Qt.point(0, size.dp(30))
6060
gradient: Gradient {
6161
GradientStop { position: 0.0; color: "transparent" }
6262
GradientStop { position: 1.0; color: "black" }
@@ -70,13 +70,13 @@ ListView {
7070
visible: (listView.showDecorator && listView.contentHeight > listView.height)
7171
color: "#0091e5"
7272

73-
width: 5
73+
width: size.dp(5)
7474
height: listView.height*listView.height/listView.contentHeight
7575
y: (listView.height)/listView.contentHeight*listView.contentY
7676

7777
anchors{
7878
right: listView.right
79-
rightMargin: 4
79+
rightMargin: size.dp(4)
8080
}
8181
}
8282
}

0 commit comments

Comments
 (0)