Commit d20c0321 authored by Aleksi Suomalainen's avatar Aleksi Suomalainen Committed by GitHub

Merge pull request #39 from neochapay/5.2

Add scaling
parents 921bbd90 e96571cf
...@@ -74,23 +74,23 @@ Page { ...@@ -74,23 +74,23 @@ Page {
frame: Item { } frame: Item { }
tab: Item { tab: Item {
implicitWidth: control.width/control.count implicitWidth: control.width/control.count
implicitHeight: 50 implicitHeight: size.dp(50)
BorderImage { BorderImage {
anchors.fill: parent anchors.fill: parent
border.bottom: 8 border.bottom: size.dp(8)
border.top: 8 border.top: size.dp(8)
source: styleData.selected ? "../images/tab_selected.png":"../images/tabs_standard.png" source: styleData.selected ? "../images/tab_selected.png":"../images/tabs_standard.png"
Text { Text {
anchors.centerIn: parent anchors.centerIn: parent
color: "white" color: "white"
text: styleData.title.toUpperCase() text: styleData.title.toUpperCase()
font.pixelSize: 16 font.pixelSize: size.dp(16)
} }
Rectangle { Rectangle {
visible: index > 0 visible: index > 0
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.margins: 10 anchors.margins: size.dp(10)
width:1 width:1
color: "#3a3a3a" color: "#3a3a3a"
} }
......
...@@ -65,36 +65,36 @@ Page { ...@@ -65,36 +65,36 @@ Page {
headerTools: HeaderToolsLayout { showBackButton: true; title: "Text input" } headerTools: HeaderToolsLayout { showBackButton: true; title: "Text input" }
Column { Column {
spacing: 40 spacing: size.dp(40)
anchors.centerIn: parent anchors.centerIn: parent
TextField { TextField {
anchors.margins: 20 anchors.margins: size.dp(20)
text: "Text input" text: "Text input"
//style: touchStyle //style: touchStyle
} }
TextField { TextField {
anchors.margins: 20 anchors.margins: size.dp(20)
text: "Readonly Text input" text: "Readonly Text input"
//style: touchStyle //style: touchStyle
readOnly: true readOnly: true
} }
TextField { TextField {
anchors.margins: 20 anchors.margins: size.dp(20)
text: "Disabled textfield" text: "Disabled textfield"
enabled: false enabled: false
} }
TextField { TextField {
anchors.margins: 20 anchors.margins: size.dp(20)
text: "Text input" text: "Text input"
style: touchStyle style: touchStyle
} }
TextField { TextField {
anchors.margins: 20 anchors.margins: size.dp(20)
text: "Readonly Text input" text: "Readonly Text input"
style: touchStyle style: touchStyle
readOnly: true readOnly: true
...@@ -107,14 +107,14 @@ Page { ...@@ -107,14 +107,14 @@ Page {
TextFieldStyle { TextFieldStyle {
textColor: "white" textColor: "white"
font.pixelSize: 28 font.pixelSize: size.dp(28)
background: Item { background: Item {
implicitHeight: 50 implicitHeight: size.dp(50)
implicitWidth: 320 implicitWidth: size.dp(320)
BorderImage { BorderImage {
source: "../images/textinput.png" source: "../images/textinput.png"
border.left: 8 border.left: size.dp(8)
border.right: 8 border.right: size.dp(8)
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
......
Name: qt5-qtquickcontrols-nemo Name: qt5-qtquickcontrols-nemo
Summary: Nemomobile Qt Quick Controls Summary: Nemomobile Qt Quick Controls
Version: 5.1.3 Version: 5.2.0
Release: nemo1 Release: nemo1
Group: Qt/Qt Group: Qt/Qt
License: LGPLv2.1 with exception or GPLv3 License: LGPLv2.1 with exception or GPLv3
......
...@@ -36,7 +36,7 @@ Rectangle { ...@@ -36,7 +36,7 @@ Rectangle {
id: main id: main
width: childrenRect.width width: childrenRect.width
color: "#313131" color: "#313131"
height: 40 height: size.dp(40)
property ListModel model: ListModel {} property ListModel model: ListModel {}
property bool enabled: true property bool enabled: true
property int currentIndex: -1 property int currentIndex: -1
...@@ -51,10 +51,10 @@ Rectangle { ...@@ -51,10 +51,10 @@ Rectangle {
Rectangle{ Rectangle{
id: selecter id: selecter
x: rowElement.children[main.currentIndex].x || 0 x: rowElement.children[main.currentIndex].x || 0
y: -5 y: size.dp(-5)
width: rowElement.children[main.currentIndex].width || 0 width: rowElement.children[main.currentIndex].width || 0
height: 50 height: size.dp(50)
color: "#0091e5" color: "#0091e5"
visible: main.currentIndex > -1 visible: main.currentIndex > -1
...@@ -74,11 +74,9 @@ Rectangle { ...@@ -74,11 +74,9 @@ Rectangle {
model: main.model model: main.model
delegate: Rectangle { delegate: Rectangle {
id: rowItem id: rowItem
height: 50 height: size.dp(40)
width: text.width+(text.width/name.length*2) width: text.width+(text.width/name.length*2)
y: -5
color: "transparent" color: "transparent"
MouseArea { MouseArea {
width: parent.width width: parent.width
...@@ -93,6 +91,7 @@ Rectangle { ...@@ -93,6 +91,7 @@ Rectangle {
Label { Label {
id: text id: text
text: name text: name
height: parent.heigh
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
......
...@@ -21,7 +21,7 @@ Item { ...@@ -21,7 +21,7 @@ Item {
id: label id: label
visible: label.text != "" visible: label.text != ""
font.capitalization: Font.AllUppercase font.capitalization: Font.AllUppercase
font.pixelSize: 14 font.pixelSize: size.dp(14)
color: "white" color: "white"
anchors{ anchors{
...@@ -51,19 +51,19 @@ Item { ...@@ -51,19 +51,19 @@ Item {
PathView{ PathView{
id: view id: view
property int itemHeight: 40 property int itemHeight: size.dp(40)
property bool showRow: false property bool showRow: false
interactive: activated interactive: activated
width: parent.width-60 width: parent.width-size.dp(60)
height: 40 height: size.dp(40)
clip: true clip: true
anchors{ anchors{
top: label.top top: label.top
topMargin: 20 topMargin: size.dp(20)
left: label.left left: label.left
leftMargin: 30 leftMargin: size.dp(30)
} }
pathItemCount: height/itemHeight pathItemCount: height/itemHeight
......
...@@ -62,7 +62,7 @@ Item { ...@@ -62,7 +62,7 @@ Item {
PropertyChanges { PropertyChanges {
target: toolBarRect target: toolBarRect
width: parent.width width: parent.width
height: 75 height: size.dp(75)
} }
}, },
State { State {
...@@ -91,7 +91,7 @@ Item { ...@@ -91,7 +91,7 @@ Item {
} }
PropertyChanges { PropertyChanges {
target: toolBarRect target: toolBarRect
width: 75 width: size.dp(75)
height: parent.height height: parent.height
} }
} }
......
...@@ -25,13 +25,13 @@ Item { ...@@ -25,13 +25,13 @@ Item {
Rectangle { Rectangle {
id: backButton id: backButton
width: opacity ? 60 : 0 width: opacity ? size.dp(60) : 0
anchors.leftMargin: 20 anchors.leftMargin: size.dp(20)
//check if Stack.view has already been initialized as well //check if Stack.view has already been initialized as well
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
antialiasing: true antialiasing: true
height: width height: width
radius: 4 radius: size.dp(4)
color: backmouse.pressed ? "#222" : "transparent" color: backmouse.pressed ? "#222" : "transparent"
rotation: isUiPortrait ? 0 : 90 rotation: isUiPortrait ? 0 : 90
...@@ -46,7 +46,7 @@ Item { ...@@ -46,7 +46,7 @@ Item {
MouseArea { MouseArea {
id: backmouse id: backmouse
anchors.fill: parent anchors.fill: parent
anchors.margins: -10 anchors.margins: size.dp(-10)
onClicked: header && header.stackView && header.stackView.pop() onClicked: header && header.stackView && header.stackView.pop()
} }
} }
...@@ -56,16 +56,16 @@ Item { ...@@ -56,16 +56,16 @@ Item {
anchors.right: toolButtonsContainer.left anchors.right: toolButtonsContainer.left
anchors.left: backButton.visible ? backButton.right : parent.left anchors.left: backButton.visible ? backButton.right : parent.left
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: 20 anchors.leftMargin: size.dp(20)
anchors.rightMargin: 20 anchors.rightMargin: size.dp(20)
clip: true clip: true
font.family: Theme.fontFamily font.family: Theme.fontFamily
color: Theme.label.color color: Theme.label.color
font.pointSize: 24 font.pointSize: size.dp(24)
font.weight: Font.Bold font.weight: Font.Bold
LinearGradient { LinearGradient {
anchors.right: parent.right anchors.right: parent.right
width: 50 width: size.dp(50)
height: parent.paintedHeight height: parent.paintedHeight
visible: titleTxt.paintedWidth > titleTxt.width visible: titleTxt.paintedWidth > titleTxt.width
start: Qt.point(0,0) start: Qt.point(0,0)
...@@ -79,9 +79,9 @@ Item { ...@@ -79,9 +79,9 @@ Item {
Item { Item {
id: toolButtonsContainer id: toolButtonsContainer
anchors.right: dots.visible ? dots.left : parent.right anchors.right: dots.visible ? dots.left : parent.right
anchors.rightMargin: 20 anchors.rightMargin: size.dp(20)
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
width: tools ? (50 * Math.min(maxNumberOfToolButtons, tools.length)) : 0 width: tools ? (size.dp(50) * Math.min(maxNumberOfToolButtons, tools.length)) : 0
property int maxNumberOfToolButtons: 3 property int maxNumberOfToolButtons: 3
...@@ -107,7 +107,7 @@ Item { ...@@ -107,7 +107,7 @@ Item {
Image { Image {
id: dots id: dots
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: 20 anchors.rightMargin: size.dp(20)
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
visible: drawerLevels && drawerLevels.length > 1 visible: drawerLevels && drawerLevels.length > 1
source: "../Styles/Nemo/images/dots-vertical.png" source: "../Styles/Nemo/images/dots-vertical.png"
......
...@@ -35,5 +35,5 @@ Text { ...@@ -35,5 +35,5 @@ Text {
renderType: Text.NativeRendering renderType: Text.NativeRendering
font.family: Theme.fontFamily font.family: Theme.fontFamily
color: Theme.label.color color: Theme.label.color
font.pointSize: Theme.label.pointSize font.pointSize: size.dp(Theme.label.pointSize)
} }
...@@ -15,18 +15,18 @@ ListView { ...@@ -15,18 +15,18 @@ ListView {
id: sectionHeading id: sectionHeading
Rectangle { Rectangle {
width: listView.width width: listView.width
height: 44 height: size.dp(44)
color: "black" color: "black"
Text { Text {
id: sectionText id: sectionText
text: section text: section
font.capitalization: Font.AllUppercase font.capitalization: Font.AllUppercase
font.pixelSize: 20 font.pixelSize: size.dp(20)
color: "white" color: "white"
anchors{ anchors{
left: parent.left left: parent.left
leftMargin: 10 leftMargin: size.dp(10)
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
} }
} }
...@@ -35,10 +35,10 @@ ListView { ...@@ -35,10 +35,10 @@ ListView {
id: line id: line
height: 1 height: 1
color: "white" color: "white"
width: listView.width-sectionText.width-30 width: listView.width-sectionText.width-size.dp(30)
anchors{ anchors{
left: sectionText.right left: sectionText.right
leftMargin: 10 leftMargin: size.dp(10)
verticalCenter: sectionText.verticalCenter verticalCenter: sectionText.verticalCenter
} }
} }
...@@ -48,7 +48,7 @@ ListView { ...@@ -48,7 +48,7 @@ ListView {
Item{ Item{
id: bottom id: bottom
width: parent.width width: parent.width
height: 30 height: size.dp(30)
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
visible: listView.contentHeight > listView.height visible: listView.contentHeight > listView.height
...@@ -56,7 +56,7 @@ ListView { ...@@ -56,7 +56,7 @@ ListView {
LinearGradient{ LinearGradient{
anchors.fill: parent anchors.fill: parent
start: Qt.point(0, 0) start: Qt.point(0, 0)
end: Qt.point(0, 30) end: Qt.point(0, size.dp(30))
gradient: Gradient { gradient: Gradient {
GradientStop { position: 0.0; color: "transparent" } GradientStop { position: 0.0; color: "transparent" }
GradientStop { position: 1.0; color: "black" } GradientStop { position: 1.0; color: "black" }
...@@ -70,13 +70,13 @@ ListView { ...@@ -70,13 +70,13 @@ ListView {
visible: (listView.showDecorator && listView.contentHeight > listView.height) visible: (listView.showDecorator && listView.contentHeight > listView.height)
color: "#0091e5" color: "#0091e5"
width: 5 width: size.dp(5)
height: listView.height*listView.height/listView.contentHeight height: listView.height*listView.height/listView.contentHeight
y: (listView.height)/listView.contentHeight*listView.contentY y: (listView.height)/listView.contentHeight*listView.contentY
anchors{ anchors{
right: listView.right right: listView.right
rightMargin: 4 rightMargin: size.dp(4)
} }
} }
} }
......
...@@ -66,13 +66,13 @@ Item { ...@@ -66,13 +66,13 @@ Item {
Image{ Image{
id: itemIcon id: itemIcon
height: parent.height-10 height: parent.height-size.dp(10)
width: height width: height
anchors{ anchors{
left: parent.left left: parent.left
leftMargin: 20 leftMargin: size.dp(20)
top: parent.top top: parent.top
topMargin: 5 topMargin: size.dp(5)
} }
sourceSize.width: width sourceSize.width: width
...@@ -84,13 +84,13 @@ Item { ...@@ -84,13 +84,13 @@ Item {
Rectangle{ Rectangle{
id: dataArea id: dataArea
width: parent.width-itemIcon.width-arrowItem.width-60 width: parent.width-itemIcon.width-arrowItem.width-size.dp(60)
height: labelItem.height+(description != "" ? descriptionItem.height : 0)+(subdescription != "" ? subDescriptionItem.height : 0) height: labelItem.height+(description != "" ? descriptionItem.height : 0)+(subdescription != "" ? subDescriptionItem.height : 0)
clip: true clip: true
anchors{ anchors{
left:itemIcon.right left:itemIcon.right
leftMargin: 20 leftMargin: size.dp(20)
verticalCenter: itemIcon.verticalCenter verticalCenter: itemIcon.verticalCenter
} }
color: "transparent" color: "transparent"
...@@ -103,7 +103,7 @@ Item { ...@@ -103,7 +103,7 @@ Item {
left: parent.left left: parent.left
right: parent.right right: parent.right
} }
font.pixelSize: 30 font.pixelSize: size.dp(30)
clip: true clip: true
} }
...@@ -116,7 +116,7 @@ Item { ...@@ -116,7 +116,7 @@ Item {
right: parent.right right: parent.right
top: labelItem.bottom top: labelItem.bottom
} }
font.pixelSize: 18 font.pixelSize: size.dp(18)
clip: true clip: true
visible: description != "" visible: description != ""
} }
...@@ -130,13 +130,13 @@ Item { ...@@ -130,13 +130,13 @@ Item {
right: parent.right right: parent.right
top: descriptionItem.bottom top: descriptionItem.bottom
} }
font.pixelSize: 18 font.pixelSize: size.dp(18)
clip: true clip: true
visible: subdescription != "" visible: subdescription != ""
} }
Item{ Item{
width: 15 width: size.dp(15)
height: parent.height height: parent.height
anchors{ anchors{
top: parent.top top: parent.top
...@@ -146,7 +146,7 @@ Item { ...@@ -146,7 +146,7 @@ Item {
LinearGradient{ LinearGradient{
anchors.fill: parent anchors.fill: parent
start: Qt.point(0, 0) start: Qt.point(0, 0)
end: Qt.point(15, 0) end: Qt.point(size.dp(15), 0)
gradient: Gradient { gradient: Gradient {
GradientStop { position: 0.0; color: "transparent" } GradientStop { position: 0.0; color: "transparent" }
GradientStop { position: 1.0; color: "black" } GradientStop { position: 1.0; color: "black" }
...@@ -157,12 +157,12 @@ Item { ...@@ -157,12 +157,12 @@ Item {
Image { Image {
id: arrowItem id: arrowItem
height: parent.height-10 height: parent.height-size.dp(10)
width: height width: height
anchors{ anchors{
right: parent.right right: parent.right
rightMargin: 20 rightMargin: size.dp(20)
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
} }
......
...@@ -34,7 +34,8 @@ HEADERS += \ ...@@ -34,7 +34,8 @@ HEADERS += \
qquickfilteringmousearea.h \ qquickfilteringmousearea.h \
nemoimageprovider.h \ nemoimageprovider.h \
themedaemon/mlocalthemedaemonclient.h \ themedaemon/mlocalthemedaemonclient.h \
themedaemon/mabstractthemedaemonclient.h themedaemon/mabstractthemedaemonclient.h \
sizing.h
SOURCES += \ SOURCES += \
qquicknemocontrolsextensionplugin.cpp \ qquicknemocontrolsextensionplugin.cpp \
...@@ -44,7 +45,8 @@ SOURCES += \ ...@@ -44,7 +45,8 @@ SOURCES += \
qquickfilteringmousearea.cpp \ qquickfilteringmousearea.cpp \
nemoimageprovider.cpp \ nemoimageprovider.cpp \
themedaemon/mlocalthemedaemonclient.cpp \ themedaemon/mlocalthemedaemonclient.cpp \
themedaemon/mabstractthemedaemonclient.cpp themedaemon/mabstractthemedaemonclient.cpp \
sizing.cpp
target.path = $$[QT_INSTALL_QML]/$$PLUGIN_IMPORT_PATH target.path = $$[QT_INSTALL_QML]/$$PLUGIN_IMPORT_PATH
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "nemopage.h" #include "nemopage.h"
#include "qquickfilteringmousearea.h" #include "qquickfilteringmousearea.h"
#include "nemoimageprovider.h" #include "nemoimageprovider.h"
#include "sizing.h"
QQuickNemoControlsExtensionPlugin::QQuickNemoControlsExtensionPlugin(QObject *parent) : QQuickNemoControlsExtensionPlugin::QQuickNemoControlsExtensionPlugin(QObject *parent) :
QQmlExtensionPlugin(parent) QQmlExtensionPlugin(parent)
...@@ -48,7 +49,12 @@ void QQuickNemoControlsExtensionPlugin::registerTypes(const char *uri) ...@@ -48,7 +49,12 @@ void QQuickNemoControlsExtensionPlugin::registerTypes(const char *uri)
void QQuickNemoControlsExtensionPlugin::initializeEngine(QQmlEngine *engine, const char *uri) void QQuickNemoControlsExtensionPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
{ {
Sizing *sizing = new Sizing();
QQmlExtensionPlugin::initializeEngine(engine,uri); QQmlExtensionPlugin::initializeEngine(engine,uri);
QQmlContext* context = engine->rootContext();
context->setContextProperty("size",sizing);
engine->addImageProvider(QLatin1String("theme"), new NemoImageProvider); engine->addImageProvider(QLatin1String("theme"), new NemoImageProvider);
} }
#include "sizing.h"
#include <QScreen>
#include <QDebug>
#include <QGuiApplication>
Sizing::Sizing(QObject *parent) : QObject(parent)
{
m_valid = false;
m_mm_factor = 10;
m_dp_factor = 1;
m_densitie = mdpi;
m_p_height = qgetenv("QT_QPA_EGLFS_PHYSICAL_HEIGHT").toInt();
m_p_width = qgetenv("QT_QPA_EGLFS_PHYSICAL_WIDTH").toInt();
QScreen *screen = QGuiApplication::primaryScreen();
m_height = screen->size().height();
m_width = screen->size().width();
m_dpi = screen->physicalDotsPerInch();
qDebug() << "DPI is " << m_dpi;
if(m_dpi < 140){
m_densitie = ldpi;
}else if(m_dpi >= 140 && m_dpi < 200){
//~160dpi
m_densitie = mdpi;
}else if(m_dpi >= 200 && m_dpi < 280){
//~240dpi
m_densitie = hdpi;
}else if(m_dpi >= 280 && m_dpi < 400){
//~320dpi
m_densitie = xhdpi;
}else if(m_dpi >= 400 && m_dpi < 560){
//~480dpi
m_densitie = xxhdpi;
}else{
m_densitie = xxxhdpi;
}
if(m_p_height > 0 && m_p_width >0){
m_valid = true;
setMmScaleFactor();
setDpScaleFactor();
}else{
if(m_p_height == 0){
qWarning("QT_QPA_EGLFS_PHYSICAL_HEIGHT is not set!");
}
if(m_p_width == 0){
qWarning("QT_QPA_EGLFS_PHYSICAL_WIDTH is not set!");
}
qWarning("Device mm sizing don`t work");
}
}
void Sizing::setMmScaleFactor()
{
if(m_p_width != 0){
m_mm_factor = m_width/m_p_width;
}
qDebug() << "MM scale factor is " << m_mm_factor;
}
void Sizing::setDpScaleFactor()
{
switch (m_densitie) {
case ldpi:
m_dp_factor = 0.5;
break;
case mdpi:
m_dp_factor = 0.6;
break;
case hdpi:
m_dp_factor = 1;
break;
case xhdpi:
m_dp_factor = 1.3;
break;
case xxhdpi:
m_dp_factor = 2;
break;
case xxxhdpi:
m_dp_factor = 2.5;
break;
default:
m_dp_factor = 1.3;
break;
}
qDebug() << "DP scale factor is " << m_dp_factor;
}
float Sizing::mm(float value)
{
return value*m_mm_factor;
}
float Sizing::dp(float value)
{
return value*m_dp_factor;
}
#ifndef SIZING_H
#define SIZING_H
#include <QObject>
#if QT_VERSION < QT_VERSION_CHECK(5,6,0)
#ifndef Q_ENUM
#define Q_ENUM(x) Q_ENUMS(x)
#endif
#endif
class Sizing : public QObject
{
Q_OBJECT
public:
explicit Sizing(QObject *parent = 0);
enum Densitie{
ldpi,
mdpi,
hdpi,
xhdpi,
xxhdpi,
xxxhdpi
};
#if QT_VERSION < QT_VERSION_CHECK(5,6,0)
Q_ENUM(Densities)
#else
Q_ENUMS(Densities)
#endif
bool isValid(){return m_valid;}
float getMmScaleFactor(){return m_mm_factor;}
float getDpScaleFactor(){return m_dp_factor;}
Densitie getDensitie();
Q_INVOKABLE float mm(float value);
Q_INVOKABLE float dp(float value);
private:
bool m_valid;
int m_p_width;
int m_p_height;
int m_width;
int m_height;
float m_mm_factor;
float m_dp_factor;
qreal m_dpi;
Densitie m_densitie;
void setMmScaleFactor();
void setDpScaleFactor();
};
#endif // SIZING_H
...@@ -30,8 +30,8 @@ ButtonStyle { ...@@ -30,8 +30,8 @@ ButtonStyle {
// The background of the button. // The background of the button.
background: Rectangle { background: Rectangle {
implicitWidth: 240 implicitWidth: size.dp(240)
implicitHeight: 50 implicitHeight: size.dp(50)
clip: true clip: true
color: control.primary ? Theme.primaryButton.background color: control.primary ? Theme.primaryButton.background
: Theme.button.background : Theme.button.background
......
...@@ -39,21 +39,21 @@ CheckBoxStyle { ...@@ -39,21 +39,21 @@ CheckBoxStyle {
indicator: Rectangle { indicator: Rectangle {
id: background id: background
color: "transparent" color: "transparent"
implicitWidth: 72 implicitWidth: size.dp(72)
implicitHeight: 32 implicitHeight: size.dp(32)
Rectangle { Rectangle {
id: back1 id: back1
implicitWidth: 72 implicitWidth: size.dp(72)
implicitHeight: 28 implicitHeight: size.dp(28)
color: Theme.checkbox.back1 color: Theme.checkbox.back1
anchors.centerIn: parent anchors.centerIn: parent
} }
Rectangle { Rectangle {
id: back2 id: back2
implicitWidth: 72 implicitWidth: size.dp(72)
implicitHeight: 28 implicitHeight: size.dp(28)
color: Theme.checkbox.back2 color: Theme.checkbox.back2
anchors.centerIn: parent anchors.centerIn: parent
} }
...@@ -61,6 +61,8 @@ CheckBoxStyle { ...@@ -61,6 +61,8 @@ CheckBoxStyle {
Image { Image {
id: ball id: ball
width: size.dp(40)
height: size.dp(32)
source: "images/switch-ball.png" source: "images/switch-ball.png"
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
...@@ -73,14 +75,13 @@ CheckBoxStyle { ...@@ -73,14 +75,13 @@ CheckBoxStyle {
} else { } else {
anim2.restart() anim2.restart()
} }
} }
} }
Component.onCompleted: { Component.onCompleted: {
back1.opacity = control.checked ? 1 : 0 back1.opacity = control.checked ? 1 : 0
back2.opacity = control.checked ? 0 : 1 back2.opacity = control.checked ? 0 : 1
ball.x = control.checked ? 32 : 0 ball.x = control.checked ? size.dp(32) : 0
} }
SequentialAnimation { SequentialAnimation {
...@@ -89,7 +90,7 @@ CheckBoxStyle { ...@@ -89,7 +90,7 @@ CheckBoxStyle {
NumberAnimation { NumberAnimation {
target: ball target: ball
property: "x" property: "x"
to: 32 to: size.dp(32)
duration: 120 duration: 120
} }
NumberAnimation { NumberAnimation {
......
...@@ -22,8 +22,8 @@ import QtQuick.Controls.Styles.Nemo 1.0 ...@@ -22,8 +22,8 @@ import QtQuick.Controls.Styles.Nemo 1.0
Component { Component {
Rectangle { Rectangle {
implicitHeight: 16 implicitHeight: size.dp(16)
implicitWidth: 440 implicitWidth: size.dp(440)
color: Theme.groove.background color: Theme.groove.background
Rectangle { Rectangle {
antialiasing: true antialiasing: true
......
...@@ -29,9 +29,9 @@ SliderStyle{ ...@@ -29,9 +29,9 @@ SliderStyle{
color: "black" color: "black"
border.color: "#0091e5" border.color: "#0091e5"
border.width: 2 border.width: 2
implicitWidth: 34 implicitWidth: size.dp(34)
implicitHeight: 34 implicitHeight: size.dp(34)
radius: 16 radius: size.dp(16)
visible: control.enabled visible: control.enabled
Text{ Text{
...@@ -46,8 +46,8 @@ SliderStyle{ ...@@ -46,8 +46,8 @@ SliderStyle{
groove: Rectangle{ groove: Rectangle{
id: grove id: grove
implicitHeight: 16 implicitHeight: size.dp(16)
implicitWidth: 440 implicitWidth: size.dp(440)
color: "#313131" color: "#313131"
z: 1 z: 1
Rectangle{ Rectangle{
...@@ -72,9 +72,9 @@ SliderStyle{ ...@@ -72,9 +72,9 @@ SliderStyle{
verticalCenter: dataLine.verticalCenter verticalCenter: dataLine.verticalCenter
} }
source: "images/slider-handle-left.svg" source: "images/slider-handle-left.svg"
height: 34 height: size.dp(34)
visible: control.enabled visible: control.enabled
width: (styleData.handlePosition > 80) ? 80 : styleData.handlePosition width: (styleData.handlePosition > size.dp(80)) ? size.dp(80) : styleData.handlePosition
sourceSize.width: width sourceSize.width: width
sourceSize.height: height sourceSize.height: height
} }
......
...@@ -25,11 +25,14 @@ TextFieldStyle { ...@@ -25,11 +25,14 @@ TextFieldStyle {
selectedTextColor: Theme.textField.selectedTextColor selectedTextColor: Theme.textField.selectedTextColor
selectionColor: Theme.textField.selectionColor selectionColor: Theme.textField.selectionColor
textColor: Theme.textField.selectedTextColor textColor: Theme.textField.selectedTextColor
font.pointSize: 14 font.pointSize: size.dp(14)
font.family: Theme.textField.font font.family: Theme.textField.font
background: Item { background: Item {
anchors.leftMargin: 16 anchors.leftMargin: size.dp(16)
anchors.rightMargin: 16 anchors.rightMargin: size.dp(16)
implicitHeight: size.dp(50)
implicitWidth: size.dp(320)
opacity: control.enabled ? 1 : 0.6 opacity: control.enabled ? 1 : 0.6
Image { Image {
anchors.fill: parent anchors.fill: parent
......
...@@ -28,8 +28,8 @@ Style { ...@@ -28,8 +28,8 @@ Style {
padding.bottom: 3 padding.bottom: 3
property Component panel: Item { property Component panel: Item {
implicitHeight: 75 implicitHeight: size.dp(75)
implicitWidth: 400 implicitWidth: size.dp(40)
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: Theme.toolBar.background color: Theme.toolBar.background
......
...@@ -31,8 +31,8 @@ Style { ...@@ -31,8 +31,8 @@ Style {
id: styleitem id: styleitem
//TODO: Maybe we want to add a descriptive text at the bottom of the icon? //TODO: Maybe we want to add a descriptive text at the bottom of the icon?
implicitWidth: 50 implicitWidth: size.dp(50)
implicitHeight: 50 implicitHeight: size.dp(50)
opacity: control.pressed ? 0.5 : 1 opacity: control.pressed ? 0.5 : 1
...@@ -47,7 +47,7 @@ Style { ...@@ -47,7 +47,7 @@ Style {
id: icon id: icon
anchors.fill: parent anchors.fill: parent
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
anchors.margins: 8 anchors.margins: size.dp(8)
source: control.iconSource source: control.iconSource
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment