Port to singleton Units

The context property version is slower to access and won't be supported
in Qt6. Let's port away from it and use the singleton version instead.

Here was my full process for making this change:

1. Made the change with `find . -name '*.qml' | xargs perl -pi -e 's/units\./PlasmaCore\.Units\./g'`
2. Verified no more occurrences with `grep -r " units."`
3. Made sure this didn't change any comments in a silly way by inspecting the output of `git diff | grep "+   " | grep "//"`
4. Manually inspected the full git diff to make sure there were no other unintentional or silly changes (there were none)
5. verified that all changed files have the PlasmaCore import with the correct name with `for FILE in `git status | grep modified | cut -d ":" -f 3`; do grep -q "as PlasmaCore" $FILE || echo "$FILE needs the PlasmaCore import"; done` (one needed the import)
This commit is contained in:
Nate Graham 2021-03-05 12:22:42 -07:00
parent bc9eb362c8
commit 5447cef2d8
82 changed files with 291 additions and 290 deletions

View File

@ -17,7 +17,7 @@ Item {
PlasmaCore.IconItem { PlasmaCore.IconItem {
source: "kbugbuster" source: "kbugbuster"
width: units.iconSizes.large width: PlasmaCore.Units.iconSizes.large
height: width height: width
anchors { anchors {
right: col.right right: col.right
@ -29,10 +29,10 @@ Item {
Column { Column {
id: col id: col
spacing: units.largeSpacing /2 spacing: PlasmaCore.Units.largeSpacing /2
anchors { anchors {
fill: parent fill: parent
margins: units.largeSpacing margins: PlasmaCore.Units.largeSpacing
} }
PlasmaExtras.Heading { PlasmaExtras.Heading {

View File

@ -19,7 +19,7 @@ Rectangle {
height: 100 height: 100
radius: 10 radius: 10
smooth: true smooth: true
Layout.minimumWidth: units.gridUnit * 20 Layout.minimumWidth: PlasmaCore.Units.gridUnit * 20
Layout.minimumHeight: column.implicitHeight Layout.minimumHeight: column.implicitHeight
Plasmoid.compactRepresentation: Component { Plasmoid.compactRepresentation: Component {

View File

@ -14,7 +14,7 @@ Item {
id: root id: root
width: 100 width: 100
height: 100 height: 100
Layout.minimumWidth: units.gridUnit * 20 Layout.minimumWidth: PlasmaCore.Units.gridUnit * 20
Layout.minimumHeight: column.implicitHeight Layout.minimumHeight: column.implicitHeight

View File

@ -30,10 +30,10 @@ PlasmaComponents.Page {
text: "Icons" text: "Icons"
} }
PlasmaComponents.Label { PlasmaComponents.Label {
text: "iconSizes.small : " + units.iconSizes.small + text: "iconSizes.small : " + PlasmaCore.Units.iconSizes.small +
", iconSizes.desktop: " + units.iconSizes.desktop + ", iconSizes.desktop: " + PlasmaCore.Units.iconSizes.desktop +
",<br />iconSizes.toolbar: " + units.iconSizes.toolbar + ",<br />iconSizes.toolbar: " + PlasmaCore.Units.iconSizes.toolbar +
", iconSizes.dialog : " + units.iconSizes.dialog ", iconSizes.dialog : " + PlasmaCore.Units.iconSizes.dialog
} }
Flow { Flow {

View File

@ -49,7 +49,7 @@ PlasmaComponents.Page {
} }
PlasmaComponents.Button { PlasmaComponents.Button {
height: units.iconSizes.desktop height: PlasmaCore.Units.iconSizes.desktop
text: "Busy" text: "Busy"
checked: plasmoid.busy checked: plasmoid.busy
onClicked: { onClicked: {
@ -59,7 +59,7 @@ PlasmaComponents.Page {
PlasmaComponents.Button { PlasmaComponents.Button {
id: ctxButton id: ctxButton
height: units.iconSizes.desktop height: PlasmaCore.Units.iconSizes.desktop
text: "Context Menu" text: "Context Menu"
Loader { Loader {
id: menuLoader id: menuLoader

View File

@ -18,11 +18,11 @@ Item {
width: 100 width: 100
height: 100 height: 100
clip: true clip: true
Layout.minimumWidth: units.gridUnit * 20 Layout.minimumWidth: PlasmaCore.Units.gridUnit * 20
Layout.minimumHeight: units.gridUnit * 30 Layout.minimumHeight: PlasmaCore.Units.gridUnit * 30
property int _s: units.iconSizes.small property int _s: PlasmaCore.Units.iconSizes.small
property int _h: units.iconSizes.desktop property int _h: PlasmaCore.Units.iconSizes.desktop
PlasmaCore.DataSource { PlasmaCore.DataSource {
id: dataSource id: dataSource

View File

@ -61,7 +61,7 @@ ShaderExample {
} }
PlasmaComponents.Button { PlasmaComponents.Button {
anchors { right: parent.right; bottom: parent.bottom; } anchors { right: parent.right; bottom: parent.bottom; }
// height: units.iconSizes.toolbar // height: PlasmaCore.Units.iconSizes.toolbar
text: "Busy" text: "Busy"
checked: plasmoid.busy checked: plasmoid.busy
onClicked: { onClicked: {

View File

@ -17,10 +17,10 @@ Item {
width: 400 width: 400
height: 400 height: 400
Layout.minimumWidth: units.gridUnit * 20 Layout.minimumWidth: PlasmaCore.Units.gridUnit * 20
Layout.minimumHeight: units.gridUnit * 30 Layout.minimumHeight: PlasmaCore.Units.gridUnit * 30
property int _s: units.iconSizes.small property int _s: PlasmaCore.Units.iconSizes.small
property int _h: units.iconSizes.desktop property int _h: PlasmaCore.Units.iconSizes.desktop
property int _m: 12 property int _m: 12
Item { Item {
@ -35,7 +35,7 @@ Item {
right: parent.right right: parent.right
top: parent.top top: parent.top
} }
height: units.iconSizes.toolbar * 1.5 height: PlasmaCore.Units.iconSizes.toolbar * 1.5
PlasmaComponents.TabButton { tab: colorShower; text: tab.pageName; } PlasmaComponents.TabButton { tab: colorShower; text: tab.pageName; }
PlasmaComponents.TabButton { tab: wobbleExample; text: tab.pageName; } PlasmaComponents.TabButton { tab: wobbleExample; text: tab.pageName; }

View File

@ -27,7 +27,7 @@ Text {
text: "Lesley 40:83 - (" + font.family + ")" text: "Lesley 40:83 - (" + font.family + ")"
height: paintedHeightCheck.checked ? paintedHeight : 22 height: paintedHeightCheck.checked ? paintedHeight : 22
//anchors.fill: parent //anchors.fill: parent
//spacing: units.smallSpacing/2 //spacing: PlasmaCore.Units.smallSpacing/2
verticalAlignment: Text.AlignTop verticalAlignment: Text.AlignTop
Rectangle { Rectangle {

View File

@ -18,15 +18,15 @@ Column {
width: 400 width: 400
height: 400 height: 400
spacing: units.gridUnit spacing: PlasmaCore.Units.gridUnit
id: themePage id: themePage
anchors { anchors {
margins: units.largeSpacing margins: PlasmaCore.Units.largeSpacing
} }
Row { Row {
spacing: units.gridUnit/2 spacing: PlasmaCore.Units.gridUnit/2
PlasmaComponents.CheckBox { PlasmaComponents.CheckBox {
id: boxesCheck id: boxesCheck
text: "Show Boxes" text: "Show Boxes"
@ -56,24 +56,24 @@ Column {
FontGizmo { FontGizmo {
id: giz2 id: giz2
font.pixelSize: units.gridUnit * 1 font.pixelSize: PlasmaCore.Units.gridUnit * 1
} }
FontGizmo { FontGizmo {
id: giz3 id: giz3
font.pixelSize: units.gridUnit * 2 font.pixelSize: PlasmaCore.Units.gridUnit * 2
} }
FontGizmo { FontGizmo {
id: giz4 id: giz4
font.pixelSize: units.gridUnit * 2 font.pixelSize: PlasmaCore.Units.gridUnit * 2
text: "AlignTop" text: "AlignTop"
verticalAlignment: Text.AlignTop verticalAlignment: Text.AlignTop
} }
FontGizmo { FontGizmo {
id: giz5 id: giz5
font.pixelSize: units.gridUnit * 2 font.pixelSize: PlasmaCore.Units.gridUnit * 2
text: "AlignVCenter" text: "AlignVCenter"
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
} }
@ -86,7 +86,7 @@ Column {
// //
Rectangle { Rectangle {
width: parent.width width: parent.width
height: units.gridUnit * 6 height: PlasmaCore.Units.gridUnit * 6
color: "transparent" color: "transparent"
border.width: boxesCheck.checked ? 1 : 0 border.width: boxesCheck.checked ? 1 : 0
@ -95,7 +95,7 @@ Column {
Rectangle { Rectangle {
id: img id: img
color: "orange" color: "orange"
height: units.gridUnit * 2 height: PlasmaCore.Units.gridUnit * 2
width: height width: height
anchors { anchors {
top: parent.top top: parent.top
@ -113,11 +113,11 @@ Column {
text: "That's a Headline" text: "That's a Headline"
//height: paintedHeight //height: paintedHeight
height: units.gridUnit height: PlasmaCore.Units.gridUnit
font.pixelSize: height font.pixelSize: height
anchors { anchors {
left: img.right left: img.right
leftMargin: units.gridUnit / 2 leftMargin: PlasmaCore.Units.gridUnit / 2
top: img.top top: img.top
} }
} }

View File

@ -21,7 +21,7 @@ Item {
id: themePage id: themePage
anchors { anchors {
margins: units.largeSpacing margins: PlasmaCore.Units.largeSpacing
} }
FontTest { FontTest {

View File

@ -15,10 +15,10 @@ Item {
property int cheight: 48 property int cheight: 48
property int cwidth: themePage.width / 1.2 property int cwidth: themePage.width / 1.2
property int _m: units.gridUnit / 2 * units.devicePixelRatio property int _m: PlasmaCore.Units.gridUnit / 2 * PlasmaCore.Units.devicePixelRatio
anchors { anchors {
margins: units.largeSpacing margins: PlasmaCore.Units.largeSpacing
} }
Column { Column {
id: col id: col
@ -42,7 +42,7 @@ Item {
PlasmaComponents.Label { PlasmaComponents.Label {
id: cheatLabel id: cheatLabel
text: "Cheating with the font size. This label scales with the devicePixelRatio <b>on top of</b> font rendering. Just to show how text scaling can work dynamically. Normal labels scale with the font size. For demonstration purposes we're faking scaled fonts here, to show how layouts' flows change." text: "Cheating with the font size. This label scales with the devicePixelRatio <b>on top of</b> font rendering. Just to show how text scaling can work dynamically. Normal labels scale with the font size. For demonstration purposes we're faking scaled fonts here, to show how layouts' flows change."
font.pointSize: theme.defaultFont.pointSize * units.devicePixelRatio / 1.8 font.pointSize: theme.defaultFont.pointSize * PlasmaCore.Units.devicePixelRatio / 1.8
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
anchors { anchors {
margins: _m margins: _m
@ -54,7 +54,7 @@ Item {
Image { Image {
id: apeImage id: apeImage
objectName: "apeImage" objectName: "apeImage"
height: parent.height / 6 * units.devicePixelRatio height: parent.height / 6 * PlasmaCore.Units.devicePixelRatio
//width: height //width: height
anchors { anchors {
top: cheatLabel.top top: cheatLabel.top
@ -68,41 +68,41 @@ Item {
anchors { anchors {
left: parent.left left: parent.left
top: cheatLabel.height > apeImage.height ? cheatLabel.bottom : apeImage.bottom top: cheatLabel.height > apeImage.height ? cheatLabel.bottom : apeImage.bottom
topMargin: units.largeSpacing topMargin: PlasmaCore.Units.largeSpacing
right: parent.right right: parent.right
} }
//height: _h //height: _h
//width: parent.width //width: parent.width
spacing: units.smallSpacing spacing: PlasmaCore.Units.smallSpacing
PlasmaCore.IconItem { PlasmaCore.IconItem {
source: "configure" source: "configure"
width: units.iconSizes.small width: PlasmaCore.Units.iconSizes.small
height: width height: width
} }
PlasmaCore.IconItem { PlasmaCore.IconItem {
source: "dialog-ok" source: "dialog-ok"
width: units.iconSizes.smallMedium width: PlasmaCore.Units.iconSizes.smallMedium
height: width height: width
} }
PlasmaCore.IconItem { PlasmaCore.IconItem {
source: "resize-tr2bl" source: "resize-tr2bl"
width: units.iconSizes.medium width: PlasmaCore.Units.iconSizes.medium
height: width height: width
} }
PlasmaCore.IconItem { PlasmaCore.IconItem {
source: "akonadi" source: "akonadi"
width: units.iconSizes.large width: PlasmaCore.Units.iconSizes.large
height: width height: width
} }
PlasmaCore.IconItem { PlasmaCore.IconItem {
source: "clock" source: "clock"
width: units.iconSizes.huge width: PlasmaCore.Units.iconSizes.huge
height: width height: width
} }
// KQuickControlsAddons.QIconItem { // KQuickControlsAddons.QIconItem {
// icon: "preferences-desktop-icons" // icon: "preferences-desktop-icons"
// width: units.iconSizes.enormous // width: PlasmaCore.Units.iconSizes.enormous
// height: width // height: width
// } // }

View File

@ -21,12 +21,12 @@ Item {
id: themePage id: themePage
anchors { anchors {
margins: units.largeSpacing margins: PlasmaCore.Units.largeSpacing
} }
Column { Column {
//anchors.fill: parent //anchors.fill: parent
//spacing: units.smallSpacing/2 //spacing: PlasmaCore.Units.smallSpacing/2
PlasmaExtras.Heading { PlasmaExtras.Heading {
width: parent.width width: parent.width
@ -41,7 +41,7 @@ Item {
width: cwidth/2 width: cwidth/2
onClicked: { onClicked: {
print("DPI Button onClicked"); print("DPI Button onClicked");
var d = units.devicePixelRatio * 96; var d = PlasmaCore.Units.devicePixelRatio * 96;
dpilabel.text = "\t" + d; dpilabel.text = "\t" + d;
} }
} }
@ -51,48 +51,48 @@ Item {
} }
Row { Row {
PlasmaComponents.Label { PlasmaComponents.Label {
text: "units.devicePixelRatio: " text: "PlasmaCore.Units.devicePixelRatio: "
width: cwidth width: cwidth
} }
PlasmaComponents.Label { PlasmaComponents.Label {
width: cheight width: cheight
height: cheight / 2 height: cheight / 2
text: units.devicePixelRatio text: PlasmaCore.Units.devicePixelRatio
} }
} }
Row { Row {
PlasmaComponents.Label { PlasmaComponents.Label {
text: "units.gridUnit: " text: "PlasmaCore.Units.gridUnit: "
width: cwidth width: cwidth
} }
PlasmaComponents.Label { PlasmaComponents.Label {
width: cheight width: cheight
height: cheight / 2 height: cheight / 2
text: units.gridUnit text: PlasmaCore.Units.gridUnit
} }
} }
Row { Row {
PlasmaComponents.Label { PlasmaComponents.Label {
text: "units.largeSpacing: " text: "PlasmaCore.Units.largeSpacing: "
width: cwidth width: cwidth
} }
PlasmaComponents.Label { PlasmaComponents.Label {
width: cheight width: cheight
height: cheight / 2 height: cheight / 2
text: units.largeSpacing text: PlasmaCore.Units.largeSpacing
} }
} }
Row { Row {
PlasmaComponents.Label { PlasmaComponents.Label {
text: "units.smallSpacing: " text: "PlasmaCore.Units.smallSpacing: "
width: cwidth width: cwidth
} }
PlasmaComponents.Label { PlasmaComponents.Label {
width: cheight width: cheight
height: cheight / 2 height: cheight / 2
text: units.smallSpacing text: PlasmaCore.Units.smallSpacing
} }
} }

View File

@ -17,11 +17,11 @@ Item {
width: 300 width: 300
height: 400 height: 400
clip: true clip: true
Layout.minimumWidth: units.gridUnit * 10 Layout.minimumWidth: PlasmaCore.Units.gridUnit * 10
Layout.minimumHeight: units.gridUnit * 10 Layout.minimumHeight: PlasmaCore.Units.gridUnit * 10
property int _s: units.iconSizes.small property int _s: PlasmaCore.Units.iconSizes.small
property int _h: units.iconSizes.medium property int _h: PlasmaCore.Units.iconSizes.medium
PlasmaComponents.TabBar { PlasmaComponents.TabBar {
id: tabBar id: tabBar
@ -77,7 +77,7 @@ Item {
visible: false visible: false
anchors { anchors {
bottom: parent.bottom bottom: parent.bottom
bottomMargin: units.largeSpacing/2 bottomMargin: PlasmaCore.Units.largeSpacing/2
left: sliderLabel.right left: sliderLabel.right
right: parent.right right: parent.right
} }
@ -87,14 +87,14 @@ Item {
focus: true focus: true
onValueChanged: { onValueChanged: {
var r = value / 96; var r = value / 96;
print("Setting units.devicePixelRatio: " + r); print("Setting PlasmaCore.Units.devicePixelRatio: " + r);
units.devicePixelRatio = r; PlasmaCore.Units.devicePixelRatio = r;
if (value == 0) { if (value == 0) {
value = units.devicePixelRatio * 96; value = PlasmaCore.Units.devicePixelRatio * 96;
} }
} }
Component.onCompleted: dprSlider.value = units.devicePixelRatio * 96 Component.onCompleted: dprSlider.value = PlasmaCore.Units.devicePixelRatio * 96
} }

View File

@ -14,8 +14,8 @@ import org.kde.plasma.extras 2.0 as PlasmaExtras
Item { Item {
// Initial size of the window in gridUnits // Initial size of the window in gridUnits
width: units.gridUnit * 28 width: PlasmaCore.Units.gridUnit * 28
height: units.gridUnit * 20 height: PlasmaCore.Units.gridUnit * 20
// We use a ColumnLayout to position and size the individual items // We use a ColumnLayout to position and size the individual items
ColumnLayout { ColumnLayout {
@ -23,10 +23,10 @@ Item {
// Our ColumnLayout is fills the parent item with a bit of margin // Our ColumnLayout is fills the parent item with a bit of margin
anchors { anchors {
fill: parent fill: parent
margins: units.largeSpacing margins: PlasmaCore.Units.largeSpacing
} }
spacing: units.gridUnit spacing: PlasmaCore.Units.gridUnit
// A title on top // A title on top
PlasmaExtras.Heading { PlasmaExtras.Heading {
@ -71,7 +71,7 @@ Item {
PlasmaCore.IconItem { PlasmaCore.IconItem {
// We use an anchor layout and dpi-corrected sizing // We use an anchor layout and dpi-corrected sizing
width: units.iconSizes.large * 4 width: PlasmaCore.Units.iconSizes.large * 4
height: width height: width
anchors { anchors {
left: parent.left left: parent.left

View File

@ -16,10 +16,10 @@ Column {
property alias cfg_Speed: slider.value property alias cfg_Speed: slider.value
Row { Row {
spacing: units.largeSpacing / 2 spacing: PlasmaCore.Units.largeSpacing / 2
QtControls.Label { QtControls.Label {
width: formAlignment - units.largeSpacing width: formAlignment - PlasmaCore.Units.largeSpacing
horizontalAlignment: Text.AlignRight horizontalAlignment: Text.AlignRight
text: "Speed:" text: "Speed:"
} }

View File

@ -15,12 +15,12 @@ PlasmaCore.ColorScope {
id: tooltipContentItem id: tooltipContentItem
property Item toolTip property Item toolTip
property int preferredTextWidth: units.gridUnit * 20 property int preferredTextWidth: PlasmaCore.Units.gridUnit * 20
Layout.minimumWidth: childrenRect.width + units.gridUnit Layout.minimumWidth: childrenRect.width + PlasmaCore.Units.gridUnit
Layout.minimumHeight: childrenRect.height + units.gridUnit Layout.minimumHeight: childrenRect.height + PlasmaCore.Units.gridUnit
Layout.maximumWidth: childrenRect.width + units.gridUnit Layout.maximumWidth: childrenRect.width + PlasmaCore.Units.gridUnit
Layout.maximumHeight: childrenRect.height + units.gridUnit Layout.maximumHeight: childrenRect.height + PlasmaCore.Units.gridUnit
LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft
LayoutMirroring.childrenInherit: true LayoutMirroring.childrenInherit: true
@ -32,10 +32,10 @@ PlasmaCore.ColorScope {
anchors { anchors {
left: parent.left left: parent.left
top: parent.top top: parent.top
margins: units.gridUnit / 2 margins: PlasmaCore.Units.gridUnit / 2
} }
spacing: units.largeSpacing spacing: PlasmaCore.Units.largeSpacing
Image { Image {
id: tooltipImage id: tooltipImage
@ -50,8 +50,8 @@ PlasmaCore.ColorScope {
source: toolTip ? toolTip.icon : "" source: toolTip ? toolTip.icon : ""
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
visible: toolTip != null && toolTip.icon != "" && toolTip.image == "" && valid visible: toolTip != null && toolTip.icon != "" && toolTip.image == "" && valid
Layout.preferredWidth: units.iconSizes.medium Layout.preferredWidth: PlasmaCore.Units.iconSizes.medium
Layout.preferredHeight: units.iconSizes.medium Layout.preferredHeight: PlasmaCore.Units.iconSizes.medium
} }
ColumnLayout { ColumnLayout {

View File

@ -28,7 +28,7 @@ QtObject {
property int gridUnit: fontMetrics.height property int gridUnit: fontMetrics.height
/** /**
* units.iconSizes provides access to platform-dependent icon sizing * PlasmaCore.Units.iconSizes provides access to platform-dependent icon sizing
* *
* The icon sizes provided are normalized for different DPI, so icons * The icon sizes provided are normalized for different DPI, so icons
* will scale depending on the DPI. * will scale depending on the DPI.
@ -55,7 +55,7 @@ QtObject {
} }
/** /**
* units.smallSpacing is the amount of spacing that should be used around smaller UI elements, * PlasmaCore.Units.smallSpacing is the amount of spacing that should be used around smaller UI elements,
* for example as spacing in Columns. Internally, this size depends on the size of * for example as spacing in Columns. Internally, this size depends on the size of
* the default font as rendered on the screen, so it takes user-configured font size and DPI * the default font as rendered on the screen, so it takes user-configured font size and DPI
* into account. * into account.
@ -63,7 +63,7 @@ QtObject {
property int smallSpacing: Math.floor(gridUnit/4) property int smallSpacing: Math.floor(gridUnit/4)
/** /**
* units.largeSpacing is the amount of spacing that should be used inside bigger UI elements, * PlasmaCore.Units.largeSpacing is the amount of spacing that should be used inside bigger UI elements,
* for example between an icon and the corresponding text. Internally, this size depends on * for example between an icon and the corresponding text. Internally, this size depends on
* the size of the default font as rendered on the screen, so it takes user-configured font * the size of the default font as rendered on the screen, so it takes user-configured font
* size and DPI into account. * size and DPI into account.
@ -73,34 +73,34 @@ QtObject {
/** /**
* The ratio between physical and device-independent pixels. This value does not depend on the \ * The ratio between physical and device-independent pixels. This value does not depend on the \
* size of the configured font. If you want to take font sizes into account when scaling elements, * size of the configured font. If you want to take font sizes into account when scaling elements,
* use theme.mSize(theme.defaultFont), units.smallSpacing and units.largeSpacing. * use theme.mSize(theme.defaultFont), PlasmaCore.Units.smallSpacing and PlasmaCore.Units.largeSpacing.
* The devicePixelRatio follows the definition of "device independent pixel" by Microsoft. * The devicePixelRatio follows the definition of "device independent pixel" by Microsoft.
*/ */
property real devicePixelRatio: Math.max(1, ((fontMetrics.font.pixelSize*0.75) / fontMetrics.font.pointSize)) property real devicePixelRatio: Math.max(1, ((fontMetrics.font.pixelSize*0.75) / fontMetrics.font.pointSize))
/** /**
* units.longDuration should be used for longer, screen-covering animations, for opening and * PlasmaCore.Units.longDuration should be used for longer, screen-covering animations, for opening and
* closing of dialogs and other "not too small" animations * closing of dialogs and other "not too small" animations
*/ */
property int longDuration: units.longDuration property int longDuration: PlasmaCore.Units.longDuration
/** /**
* units.shortDuration should be used for short animations, such as accentuating a UI event, * PlasmaCore.Units.shortDuration should be used for short animations, such as accentuating a UI event,
* hover events, etc.. * hover events, etc..
*/ */
property int shortDuration: units.shortDuration property int shortDuration: PlasmaCore.Units.shortDuration
/** /**
* units.veryLongDuration should be used for specialty animations that benefit * PlasmaCore.Units.veryLongDuration should be used for specialty animations that benefit
* from being even longer than longDuration. * from being even longer than longDuration.
*/ */
property int veryLongDuration: units.veryLongDuration property int veryLongDuration: PlasmaCore.Units.veryLongDuration
/** /**
* units.veryShortDuration should be used for elements that should have a hint of smoothness, * PlasmaCore.Units.veryShortDuration should be used for elements that should have a hint of smoothness,
* but otherwise animate near instantly. * but otherwise animate near instantly.
*/ */
property int veryShortDuration: units.veryShortDuration property int veryShortDuration: PlasmaCore.Units.veryShortDuration
readonly property QtObject __styleItem: QtQuickControlsPrivate.StyleItem {elementType: "frame" } readonly property QtObject __styleItem: QtQuickControlsPrivate.StyleItem {elementType: "frame" }

View File

@ -20,10 +20,10 @@ QtObject {
* Given the screen has an accurate DPI settings, it corresponds to a width of * Given the screen has an accurate DPI settings, it corresponds to a width of
* the capital letter M * the capital letter M
*/ */
property int gridUnit: units.gridUnit property int gridUnit: PlasmaCore.Units.gridUnit
/** /**
* units.iconSizes provides access to platform-dependent icon sizing * PlasmaCore.Units.iconSizes provides access to platform-dependent icon sizing
* *
* The icon sizes provided are normalized for different DPI, so icons * The icon sizes provided are normalized for different DPI, so icons
* will scale depending on the DPI. * will scale depending on the DPI.
@ -50,7 +50,7 @@ QtObject {
} }
/** /**
* units.smallSpacing is the amount of spacing that should be used around smaller UI elements, * PlasmaCore.Units.smallSpacing is the amount of spacing that should be used around smaller UI elements,
* for example as spacing in Columns. Internally, this size depends on the size of * for example as spacing in Columns. Internally, this size depends on the size of
* the default font as rendered on the screen, so it takes user-configured font size and DPI * the default font as rendered on the screen, so it takes user-configured font size and DPI
* into account. * into account.
@ -58,7 +58,7 @@ QtObject {
property int smallSpacing: Math.floor(gridUnit/4) property int smallSpacing: Math.floor(gridUnit/4)
/** /**
* units.largeSpacing is the amount of spacing that should be used inside bigger UI elements, * PlasmaCore.Units.largeSpacing is the amount of spacing that should be used inside bigger UI elements,
* for example between an icon and the corresponding text. Internally, this size depends on * for example between an icon and the corresponding text. Internally, this size depends on
* the size of the default font as rendered on the screen, so it takes user-configured font * the size of the default font as rendered on the screen, so it takes user-configured font
* size and DPI into account. * size and DPI into account.
@ -68,34 +68,34 @@ QtObject {
/** /**
* The ratio between physical and device-independent pixels. This value does not depend on the \ * The ratio between physical and device-independent pixels. This value does not depend on the \
* size of the configured font. If you want to take font sizes into account when scaling elements, * size of the configured font. If you want to take font sizes into account when scaling elements,
* use theme.mSize(theme.defaultFont), units.smallSpacing and units.largeSpacing. * use theme.mSize(theme.defaultFont), PlasmaCore.Units.smallSpacing and PlasmaCore.Units.largeSpacing.
* The devicePixelRatio follows the definition of "device independent pixel" by Microsoft. * The devicePixelRatio follows the definition of "device independent pixel" by Microsoft.
*/ */
property real devicePixelRatio: units.devicePixelRatio property real devicePixelRatio: PlasmaCore.Units.devicePixelRatio
/** /**
* units.longDuration should be used for longer, screen-covering animations, for opening and * PlasmaCore.Units.longDuration should be used for longer, screen-covering animations, for opening and
* closing of dialogs and other "not too small" animations * closing of dialogs and other "not too small" animations
*/ */
property int longDuration: units.longDuration property int longDuration: PlasmaCore.Units.longDuration
/** /**
* units.shortDuration should be used for short animations, such as accentuating a UI event, * PlasmaCore.Units.shortDuration should be used for short animations, such as accentuating a UI event,
* hover events, etc.. * hover events, etc..
*/ */
property int shortDuration: units.shortDuration property int shortDuration: PlasmaCore.Units.shortDuration
/** /**
* units.veryShortDuration should be used for elements that should have a hint of smoothness, * PlasmaCore.Units.veryShortDuration should be used for elements that should have a hint of smoothness,
* but otherwise animate near instantly. * but otherwise animate near instantly.
*/ */
property int veryShortDuration: units.veryShortDuration property int veryShortDuration: PlasmaCore.Units.veryShortDuration
/** /**
* units.veryLongDuration should be used for specialty animations that benefit * PlasmaCore.Units.veryLongDuration should be used for specialty animations that benefit
* from being even longer than longDuration. * from being even longer than longDuration.
*/ */
property int veryLongDuration: units.veryLongDuration property int veryLongDuration: PlasmaCore.Units.veryLongDuration
/** /**
* How much the mouse scroll wheel scrolls, expressed in lines of text. * How much the mouse scroll wheel scrolls, expressed in lines of text.

View File

@ -22,7 +22,7 @@ T.CheckBox {
leftPadding: control.indicator && !control.mirrored ? control.indicator.width + control.spacing : 0 leftPadding: control.indicator && !control.mirrored ? control.indicator.width + control.spacing : 0
rightPadding: control.indicator && control.mirrored ? control.indicator.width + control.spacing : 0 rightPadding: control.indicator && control.mirrored ? control.indicator.width + control.spacing : 0
spacing: units.smallSpacing spacing: PlasmaCore.Units.smallSpacing
hoverEnabled: true hoverEnabled: true
@ -38,14 +38,14 @@ T.CheckBox {
contentItem: RowLayout { contentItem: RowLayout {
opacity: control.enabled ? 1 : 0.6 opacity: control.enabled ? 1 : 0.6
spacing: units.smallSpacing spacing: PlasmaCore.Units.smallSpacing
PlasmaCore.IconItem { PlasmaCore.IconItem {
source: control.icon.name || control.icon.source source: control.icon.name || control.icon.source
visible: source.length > 0 visible: source.length > 0
implicitWidth: units.iconSizes.smallMedium implicitWidth: PlasmaCore.Units.iconSizes.smallMedium
implicitHeight: units.iconSizes.smallMedium implicitHeight: PlasmaCore.Units.iconSizes.smallMedium
} }
Label { Label {

View File

@ -21,7 +21,7 @@ T.CheckDelegate {
bottomPadding: background.margins.bottom bottomPadding: background.margins.bottom
leftPadding: background.margins.left leftPadding: background.margins.left
rightPadding: background.margins.right rightPadding: background.margins.right
spacing: units.smallSpacing spacing: PlasmaCore.Units.smallSpacing
contentItem: Label { contentItem: Label {
leftPadding: control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0 leftPadding: control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0

View File

@ -13,7 +13,7 @@ PlasmaCore.FrameSvgItem {
property Item control property Item control
imagePath: "widgets/button" imagePath: "widgets/button"
prefix: "normal" prefix: "normal"
implicitWidth: units.iconSizes.small implicitWidth: PlasmaCore.Units.iconSizes.small
implicitHeight: implicitWidth implicitHeight: implicitWidth
opacity: control.enabled ? 1 : 0.6 opacity: control.enabled ? 1 : 0.6
@ -47,7 +47,7 @@ PlasmaCore.FrameSvgItem {
} }
Behavior on opacity { Behavior on opacity {
NumberAnimation { NumberAnimation {
duration: units.longDuration duration: PlasmaCore.Units.longDuration
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
} }
} }

View File

@ -17,16 +17,16 @@ import "mobiletextselection" as MobileTextSelection
T.ComboBox { T.ComboBox {
id: control id: control
implicitWidth: Math.max(units.gridUnit, contentItem.implicitWidth) implicitWidth: Math.max(PlasmaCore.Units.gridUnit, contentItem.implicitWidth)
+ leftPadding + rightPadding + indicator.implicitWidth + rightPadding + leftPadding + rightPadding + indicator.implicitWidth + rightPadding
implicitHeight: Math.max(units.gridUnit, contentItem.implicitHeight) implicitHeight: Math.max(PlasmaCore.Units.gridUnit, contentItem.implicitHeight)
+ topPadding + bottomPadding + topPadding + bottomPadding
baselineOffset: contentItem.y + contentItem.baselineOffset baselineOffset: contentItem.y + contentItem.baselineOffset
hoverEnabled: true hoverEnabled: true
topPadding: surfaceNormal.margins.top topPadding: surfaceNormal.margins.top
leftPadding: surfaceNormal.margins.left leftPadding: surfaceNormal.margins.left
rightPadding: surfaceNormal.margins.right + units.gridUnit * 2 rightPadding: surfaceNormal.margins.right + PlasmaCore.Units.gridUnit * 2
bottomPadding: surfaceNormal.margins.bottom bottomPadding: surfaceNormal.margins.bottom
delegate: ItemDelegate { delegate: ItemDelegate {
@ -37,7 +37,7 @@ T.ComboBox {
} }
indicator: PlasmaCore.SvgItem { indicator: PlasmaCore.SvgItem {
implicitWidth: units.iconSizes.small implicitWidth: PlasmaCore.Units.iconSizes.small
implicitHeight: implicitWidth implicitHeight: implicitWidth
anchors { anchors {
right: parent.right right: parent.right

View File

@ -12,7 +12,7 @@ import "private" as Private
T.Dial { T.Dial {
id: control id: control
implicitWidth: units.gridUnit * 5 implicitWidth: PlasmaCore.Units.gridUnit * 5
implicitHeight: implicitWidth implicitHeight: implicitWidth
hoverEnabled: true hoverEnabled: true
onPositionChanged: canvas.requestPaint() onPositionChanged: canvas.requestPaint()
@ -53,7 +53,7 @@ T.Dial {
x: (control.width/2) + Math.cos((-(control.angle-90)*Math.PI)/180) * (control.width/2-width/2) - width/2 x: (control.width/2) + Math.cos((-(control.angle-90)*Math.PI)/180) * (control.width/2-width/2) - width/2
y: (control.height/2) + Math.sin(((control.angle-90)*Math.PI)/180) * (control.height/2-height/2) - height/2 y: (control.height/2) + Math.sin(((control.angle-90)*Math.PI)/180) * (control.height/2-height/2) - height/2
implicitHeight: Math.floor(units.gridUnit*1.6) implicitHeight: Math.floor(PlasmaCore.Units.gridUnit*1.6)
implicitWidth: implicitHeight implicitWidth: implicitHeight
Private.RoundShadow { Private.RoundShadow {
@ -82,7 +82,7 @@ T.Dial {
height: width height: width
anchors.centerIn: parent anchors.centerIn: parent
Behavior on opacity { Behavior on opacity {
NumberAnimation { duration: units.longDuration } NumberAnimation { duration: PlasmaCore.Units.longDuration }
} }
} }
} }

View File

@ -47,7 +47,7 @@ T.Dialog {
contentItem: Item { } contentItem: Item { }
background: PlasmaCore.FrameSvgItem { background: PlasmaCore.FrameSvgItem {
implicitWidth: units.gridUnit * 12 implicitWidth: PlasmaCore.Units.gridUnit * 12
imagePath: "widgets/background" imagePath: "widgets/background"
} }

View File

@ -14,7 +14,7 @@ T.DialogButtonBox {
implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding
implicitHeight: contentItem.implicitHeight + topPadding + bottomPadding implicitHeight: contentItem.implicitHeight + topPadding + bottomPadding
spacing: units.smallSpacing spacing: PlasmaCore.Units.smallSpacing
leftPadding: parent.leftPadding leftPadding: parent.leftPadding
topPadding: parent.topPadding topPadding: parent.topPadding
rightPadding: parent.rightPadding rightPadding: parent.rightPadding
@ -27,7 +27,7 @@ T.DialogButtonBox {
contentItem: ListView { contentItem: ListView {
implicitWidth: contentWidth implicitWidth: contentWidth
implicitHeight: units.gridUnit * 1.6 implicitHeight: PlasmaCore.Units.gridUnit * 1.6
model: control.contentModel model: control.contentModel
spacing: control.spacing spacing: control.spacing

View File

@ -19,10 +19,10 @@ T.Drawer {
contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0) contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0) contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
topPadding: control.edge === Qt.BottomEdge ? Math.round(units.devicePixelRatio) : 0 topPadding: control.edge === Qt.BottomEdge ? Math.round(PlasmaCore.Units.devicePixelRatio) : 0
leftPadding: control.edge === Qt.RightEdge ? Math.round(units.devicePixelRatio) : 0 leftPadding: control.edge === Qt.RightEdge ? Math.round(PlasmaCore.Units.devicePixelRatio) : 0
rightPadding: control.edge === Qt.LeftEdge ? Math.round(units.devicePixelRatio) : 0 rightPadding: control.edge === Qt.LeftEdge ? Math.round(PlasmaCore.Units.devicePixelRatio) : 0
bottomPadding: control.edge === Qt.TopEdge ? Math.round(units.devicePixelRatio) : 0 bottomPadding: control.edge === Qt.TopEdge ? Math.round(PlasmaCore.Units.devicePixelRatio) : 0
background: PlasmaCore.FrameSvgItem { background: PlasmaCore.FrameSvgItem {
anchors { anchors {
@ -32,7 +32,7 @@ T.Drawer {
rightMargin: -margins.right rightMargin: -margins.right
bottomMargin: -margins.bottom bottomMargin: -margins.bottom
} }
implicitWidth: units.gridUnit * 12 implicitWidth: PlasmaCore.Units.gridUnit * 12
imagePath: "widgets/background" imagePath: "widgets/background"
enabledBorders: { enabledBorders: {
switch (control.edge) { switch (control.edge) {

View File

@ -18,7 +18,7 @@ T.Frame {
contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0) contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0) contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
padding: units.smallSpacing padding: PlasmaCore.Units.smallSpacing
background: PlasmaCore.FrameSvgItem { background: PlasmaCore.FrameSvgItem {
imagePath: "widgets/frame" imagePath: "widgets/frame"

View File

@ -21,7 +21,7 @@ T.CheckDelegate {
bottomPadding: background.margins.bottom bottomPadding: background.margins.bottom
leftPadding: background.margins.left leftPadding: background.margins.left
rightPadding: background.margins.right rightPadding: background.margins.right
spacing: units.smallSpacing spacing: PlasmaCore.Units.smallSpacing
contentItem: Label { contentItem: Label {
leftPadding: control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0 leftPadding: control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0

View File

@ -88,7 +88,7 @@ T.Menu {
background: PlasmaCore.FrameSvgItem { background: PlasmaCore.FrameSvgItem {
imagePath: "widgets/background" imagePath: "widgets/background"
implicitWidth: units.gridUnit * 8 implicitWidth: PlasmaCore.Units.gridUnit * 8
implicitHeight: units.gridUnit * 2 implicitHeight: PlasmaCore.Units.gridUnit * 2
} }
} }

View File

@ -25,7 +25,7 @@ T.MenuItem {
topPadding: highlight.margins.top topPadding: highlight.margins.top
rightPadding: highlight.margins.right rightPadding: highlight.margins.right
bottomPadding: highlight.margins.bottom bottomPadding: highlight.margins.bottom
spacing: units.smallSpacing spacing: PlasmaCore.Units.smallSpacing
hoverEnabled: true hoverEnabled: true
Kirigami.MnemonicData.enabled: controlRoot.enabled && controlRoot.visible Kirigami.MnemonicData.enabled: controlRoot.enabled && controlRoot.visible
@ -101,7 +101,7 @@ T.MenuItem {
} }
background: Item { background: Item {
implicitWidth: units.gridUnit * 8 implicitWidth: PlasmaCore.Units.gridUnit * 8
PlasmaCore.FrameSvgItem { PlasmaCore.FrameSvgItem {
id: highlight id: highlight
@ -118,7 +118,7 @@ T.MenuItem {
} }
Behavior on opacity { Behavior on opacity {
NumberAnimation { NumberAnimation {
duration: units.shortDuration duration: PlasmaCore.Units.shortDuration
} }
} }
} }

View File

@ -15,11 +15,11 @@ T.PageIndicator {
implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding
implicitHeight: contentItem.implicitHeight + topPadding + bottomPadding implicitHeight: contentItem.implicitHeight + topPadding + bottomPadding
padding: units.smallSpacing padding: PlasmaCore.Units.smallSpacing
spacing: units.smallSpacing spacing: PlasmaCore.Units.smallSpacing
delegate: Rectangle { delegate: Rectangle {
implicitWidth: units.gridUnit/2 implicitWidth: PlasmaCore.Units.gridUnit/2
implicitHeight: implicitWidth implicitHeight: implicitWidth
radius: width radius: width
@ -28,7 +28,7 @@ T.PageIndicator {
opacity: index === currentIndex ? 0.9 : pressed ? 0.7 : 0.5 opacity: index === currentIndex ? 0.9 : pressed ? 0.7 : 0.5
Behavior on opacity { Behavior on opacity {
OpacityAnimator { OpacityAnimator {
duration: units.longDuration duration: PlasmaCore.Units.longDuration
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
} }
} }

View File

@ -11,7 +11,7 @@ import org.kde.plasma.core 2.0 as PlasmaCore
T.ProgressBar { T.ProgressBar {
id: control id: control
implicitWidth: units.gridUnit * 8 implicitWidth: PlasmaCore.Units.gridUnit * 8
implicitHeight: background.implicitHeight implicitHeight: background.implicitHeight
hoverEnabled: true hoverEnabled: true
@ -36,7 +36,7 @@ T.ProgressBar {
running: control.indeterminate && control.visible running: control.indeterminate && control.visible
onStarted: indicator.width = Qt.binding(function() { onStarted: indicator.width = Qt.binding(function() {
return units.gridUnit * 2; return PlasmaCore.Units.gridUnit * 2;
}); });
onStopped: indicator.width = Qt.binding(function() { onStopped: indicator.width = Qt.binding(function() {
return indicator.parent.width * control.position; return indicator.parent.width * control.position;

View File

@ -20,7 +20,7 @@ T.RadioButton {
baselineOffset: contentItem.y + contentItem.baselineOffset baselineOffset: contentItem.y + contentItem.baselineOffset
padding: 1 padding: 1
spacing: Math.round(units.gridUnit / 8) spacing: Math.round(PlasmaCore.Units.gridUnit / 8)
hoverEnabled: true hoverEnabled: true

View File

@ -21,7 +21,7 @@ T.RadioDelegate {
bottomPadding: background.margins.bottom bottomPadding: background.margins.bottom
leftPadding: background.margins.left leftPadding: background.margins.left
rightPadding: background.margins.right rightPadding: background.margins.right
spacing: units.smallSpacing spacing: PlasmaCore.Units.smallSpacing
contentItem: Label { contentItem: Label {
leftPadding: control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0 leftPadding: control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0

View File

@ -18,7 +18,7 @@ PlasmaCore.SvgItem {
opacity: control.enabled ? 1 : 0.6 opacity: control.enabled ? 1 : 0.6
implicitWidth: implicitHeight implicitWidth: implicitHeight
implicitHeight: units.iconSizes.small implicitHeight: PlasmaCore.Units.iconSizes.small
PlasmaCore.SvgItem { PlasmaCore.SvgItem {
id: checkmark id: checkmark
@ -33,7 +33,7 @@ PlasmaCore.SvgItem {
} }
Behavior on opacity { Behavior on opacity {
NumberAnimation { NumberAnimation {
duration: units.longDuration duration: PlasmaCore.Units.longDuration
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
} }
} }

View File

@ -12,8 +12,8 @@ import "private" as Private
T.RangeSlider { T.RangeSlider {
id: control id: control
implicitWidth: control.orientation === Qt.Horizontal ? units.gridUnit * 12 : units.gridUnit * 1.6 implicitWidth: control.orientation === Qt.Horizontal ? PlasmaCore.Units.gridUnit * 12 : PlasmaCore.Units.gridUnit * 1.6
implicitHeight: control.orientation === Qt.Horizontal ? units.gridUnit * 1.6 : units.gridUnit * 12 implicitHeight: control.orientation === Qt.Horizontal ? PlasmaCore.Units.gridUnit * 1.6 : PlasmaCore.Units.gridUnit * 12
PlasmaCore.Svg { PlasmaCore.Svg {
id: grooveSvg id: grooveSvg
@ -78,8 +78,8 @@ T.RangeSlider {
prefix: "groove" prefix: "groove"
colorGroup: PlasmaCore.ColorScope.colorGroup colorGroup: PlasmaCore.ColorScope.colorGroup
readonly property bool horizontal: control.orientation === Qt.Horizontal readonly property bool horizontal: control.orientation === Qt.Horizontal
implicitWidth: horizontal ? units.gridUnit * 8 : margins.left + margins.right implicitWidth: horizontal ? PlasmaCore.Units.gridUnit * 8 : margins.left + margins.right
implicitHeight: horizontal ? margins.top + margins.bottom : units.gridUnit * 8 implicitHeight: horizontal ? margins.top + margins.bottom : PlasmaCore.Units.gridUnit * 8
width: horizontal ? control.availableWidth : implicitWidth width: horizontal ? control.availableWidth : implicitWidth
height: horizontal ? implicitHeight : control.availableHeight height: horizontal ? implicitHeight : control.availableHeight
anchors.centerIn: parent anchors.centerIn: parent

View File

@ -14,9 +14,9 @@ import "private" as Private
T.RoundButton { T.RoundButton {
id: control id: control
implicitWidth: Math.max(units.gridUnit, contentItem.implicitWidth) implicitWidth: Math.max(PlasmaCore.Units.gridUnit, contentItem.implicitWidth)
+ leftPadding + rightPadding + leftPadding + rightPadding
implicitHeight: Math.max(units.gridUnit, contentItem.implicitHeight) implicitHeight: Math.max(PlasmaCore.Units.gridUnit, contentItem.implicitHeight)
+ topPadding + bottomPadding + topPadding + bottomPadding
leftPadding: text.length > 0 ? surfaceNormal.margins.left : contentItem.extraSpace leftPadding: text.length > 0 ? surfaceNormal.margins.left : contentItem.extraSpace
@ -28,10 +28,10 @@ T.RoundButton {
contentItem: RowLayout { contentItem: RowLayout {
// This is the spacing which will make the icon a square inscribed in the circle with an extra smallspacing of margins // This is the spacing which will make the icon a square inscribed in the circle with an extra smallspacing of margins
readonly property int extraSpace: implicitWidth/2 - implicitWidth/2*Math.sqrt(2)/2 + units.smallSpacing readonly property int extraSpace: implicitWidth/2 - implicitWidth/2*Math.sqrt(2)/2 + PlasmaCore.Units.smallSpacing
PlasmaCore.IconItem { PlasmaCore.IconItem {
Layout.preferredWidth: units.iconSizes.smallMedium Layout.preferredWidth: PlasmaCore.Units.iconSizes.smallMedium
Layout.preferredHeight: units.iconSizes.smallMedium Layout.preferredHeight: PlasmaCore.Units.iconSizes.smallMedium
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
visible: source.length > 0 visible: source.length > 0
@ -85,7 +85,7 @@ T.RoundButton {
//internal: if there is no hover status, don't paint on mouse over in touchscreens //internal: if there is no hover status, don't paint on mouse over in touchscreens
opacity: (control.pressed || control.checked || !control.flat || (roundShadow.hasOverState && control.hovered)) ? 1 : 0 opacity: (control.pressed || control.checked || !control.flat || (roundShadow.hasOverState && control.hovered)) ? 1 : 0
Behavior on opacity { Behavior on opacity {
PropertyAnimation { duration: units.longDuration } PropertyAnimation { duration: PlasmaCore.Units.longDuration }
} }
} }
@ -107,7 +107,7 @@ T.RoundButton {
opacity: background.useNormalButton && (!control.flat || control.hovered) && (!control.pressed || !control.checked) ? 1 : 0 opacity: background.useNormalButton && (!control.flat || control.hovered) && (!control.pressed || !control.checked) ? 1 : 0
Behavior on opacity { Behavior on opacity {
OpacityAnimator { OpacityAnimator {
duration: units.longDuration duration: PlasmaCore.Units.longDuration
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
} }
} }
@ -131,7 +131,7 @@ T.RoundButton {
opacity: control.checked || control.pressed ? 1 : 0 opacity: control.checked || control.pressed ? 1 : 0
Behavior on opacity { Behavior on opacity {
OpacityAnimator { OpacityAnimator {
duration: units.longDuration duration: PlasmaCore.Units.longDuration
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
} }
} }

View File

@ -33,7 +33,7 @@ T.ScrollBar {
} }
// the separator line doesn't work yet with the plasmoids design // the separator line doesn't work yet with the plasmoids design
visible: typeof plasmoid === "undefined" visible: typeof plasmoid === "undefined"
width: units.devicePixelRatio width: PlasmaCore.Units.devicePixelRatio
color: PlasmaCore.ColorScope.textColor color: PlasmaCore.ColorScope.textColor
opacity: 0.1 opacity: 0.1
} }
@ -46,7 +46,7 @@ T.ScrollBar {
opacity: controlRoot.hovered opacity: controlRoot.hovered
Behavior on opacity { Behavior on opacity {
OpacityAnimator { OpacityAnimator {
duration: units.longDuration duration: PlasmaCore.Units.longDuration
} }
} }
} }

View File

@ -12,8 +12,8 @@ import "private" as Private
T.Slider { T.Slider {
id: control id: control
implicitWidth: control.orientation === Qt.Horizontal ? units.gridUnit * 12 : units.gridUnit * 1.6 implicitWidth: control.orientation === Qt.Horizontal ? PlasmaCore.Units.gridUnit * 12 : PlasmaCore.Units.gridUnit * 1.6
implicitHeight: control.orientation === Qt.Horizontal ? units.gridUnit * 1.6 : units.gridUnit * 12 implicitHeight: control.orientation === Qt.Horizontal ? PlasmaCore.Units.gridUnit * 1.6 : PlasmaCore.Units.gridUnit * 12
wheelEnabled: true wheelEnabled: true
snapMode: T.Slider.SnapOnRelease snapMode: T.Slider.SnapOnRelease
@ -55,8 +55,8 @@ T.Slider {
prefix: "groove" prefix: "groove"
colorGroup: PlasmaCore.ColorScope.colorGroup colorGroup: PlasmaCore.ColorScope.colorGroup
readonly property bool horizontal: control.orientation === Qt.Horizontal readonly property bool horizontal: control.orientation === Qt.Horizontal
implicitWidth: horizontal ? units.gridUnit * 8 : margins.left + margins.right implicitWidth: horizontal ? PlasmaCore.Units.gridUnit * 8 : margins.left + margins.right
implicitHeight: horizontal ? margins.top + margins.bottom : units.gridUnit * 8 implicitHeight: horizontal ? margins.top + margins.bottom : PlasmaCore.Units.gridUnit * 8
width: horizontal ? control.availableWidth : implicitWidth width: horizontal ? control.availableWidth : implicitWidth
height: horizontal ? implicitHeight : control.availableHeight height: horizontal ? implicitHeight : control.availableHeight
anchors.centerIn: parent anchors.centerIn: parent
@ -90,9 +90,9 @@ T.Slider {
Rectangle { Rectangle {
color: PlasmaCore.ColorScope.textColor color: PlasmaCore.ColorScope.textColor
opacity: 0.3 opacity: 0.3
width: background.horizontal ? units.devicePixelRatio : units.gridUnit/2 width: background.horizontal ? PlasmaCore.Units.devicePixelRatio : PlasmaCore.Units.gridUnit/2
height: background.horizontal ? units.gridUnit/2 : units.devicePixelRatio height: background.horizontal ? PlasmaCore.Units.gridUnit/2 : PlasmaCore.Units.devicePixelRatio
y: background.horizontal ? background.height + units.devicePixelRatio : handle.height / 2 + index * ((repeater.height - handle.height) / (repeater.count > 1 ? repeater.count - 1 : 1)) y: background.horizontal ? background.height + PlasmaCore.Units.devicePixelRatio : handle.height / 2 + index * ((repeater.height - handle.height) / (repeater.count > 1 ? repeater.count - 1 : 1))
x: background.horizontal ? handle.width / 2 + index * ((repeater.width - handle.width) / (repeater.count > 1 ? repeater.count - 1 : 1)) : background.width x: background.horizontal ? handle.width / 2 + index * ((repeater.width - handle.width) / (repeater.count > 1 ? repeater.count - 1 : 1)) : background.width
} }
} }

View File

@ -14,8 +14,8 @@ import "private" as Private
T.SpinBox { T.SpinBox {
id: control id: control
implicitWidth: Math.max(units.gridUnit * 6, contentItem.implicitWidth + 2 * padding + up.indicator.implicitWidth + down.indicator.implicitWidth) implicitWidth: Math.max(PlasmaCore.Units.gridUnit * 6, contentItem.implicitWidth + 2 * padding + up.indicator.implicitWidth + down.indicator.implicitWidth)
implicitHeight: units.gridUnit * 1.6 implicitHeight: PlasmaCore.Units.gridUnit * 1.6
padding: 6 padding: 6
leftPadding: padding + height leftPadding: padding + height
@ -74,7 +74,7 @@ T.SpinBox {
// How many pixels you have to drag to change the value by one unit // How many pixels you have to drag to change the value by one unit
// of 'control.stepSize'; bigger magnitudes will require more movement // of 'control.stepSize'; bigger magnitudes will require more movement
// to achieve the same change in spinbox value // to achieve the same change in spinbox value
property int magnitude: units.gridUnit property int magnitude: PlasmaCore.Units.gridUnit
target: null // Don't actually move anything, we just want drag data target: null // Don't actually move anything, we just want drag data
xAxis.enabled: true xAxis.enabled: true

View File

@ -14,11 +14,11 @@ T.Switch {
implicitWidth: Math.max(background ? background.implicitWidth : 0, implicitWidth: Math.max(background ? background.implicitWidth : 0,
contentItem.implicitWidth + leftPadding + rightPadding) contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: units.gridUnit * 1.6 implicitHeight: PlasmaCore.Units.gridUnit * 1.6
baselineOffset: contentItem.y + contentItem.baselineOffset baselineOffset: contentItem.y + contentItem.baselineOffset
padding: 1 padding: 1
spacing: Math.round(units.gridUnit / 8) spacing: Math.round(PlasmaCore.Units.gridUnit / 8)
hoverEnabled: true hoverEnabled: true

View File

@ -21,7 +21,7 @@ T.SwitchDelegate {
bottomPadding: background.margins.bottom bottomPadding: background.margins.bottom
leftPadding: background.margins.left leftPadding: background.margins.left
rightPadding: background.margins.right rightPadding: background.margins.right
spacing: units.smallSpacing spacing: PlasmaCore.Units.smallSpacing
contentItem: Label { contentItem: Label {
leftPadding: control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0 leftPadding: control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0

View File

@ -10,8 +10,8 @@ import "private" as Private
Item { Item {
property Item control property Item control
implicitWidth: Math.round(units.gridUnit * 1.5) implicitWidth: Math.round(PlasmaCore.Units.gridUnit * 1.5)
implicitHeight : units.gridUnit implicitHeight : PlasmaCore.Units.gridUnit
opacity: control.enabled ? 1 : 0.6 opacity: control.enabled ? 1 : 0.6
@ -35,7 +35,7 @@ Item {
opacity: control.checked ? 1 : 0 opacity: control.checked ? 1 : 0
Behavior on opacity { Behavior on opacity {
OpacityAnimator { OpacityAnimator {
duration: units.longDuration duration: PlasmaCore.Units.longDuration
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
} }
} }
@ -50,7 +50,7 @@ Item {
elementId: "normal" elementId: "normal"
implicitWidth: implicitHeight implicitWidth: implicitHeight
implicitHeight: units.gridUnit implicitHeight: PlasmaCore.Units.gridUnit
Private.RoundShadow { Private.RoundShadow {
anchors.fill: parent anchors.fill: parent
@ -59,7 +59,7 @@ Item {
} }
Behavior on x { Behavior on x {
XAnimator { XAnimator {
duration: units.longDuration duration: PlasmaCore.Units.longDuration
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
} }
} }

View File

@ -29,7 +29,7 @@ T.TabBar {
flickableDirection: Flickable.AutoFlickIfNeeded flickableDirection: Flickable.AutoFlickIfNeeded
snapMode: ListView.SnapToItem snapMode: ListView.SnapToItem
highlightMoveDuration: units.longDuration highlightMoveDuration: PlasmaCore.Units.longDuration
highlightRangeMode: ListView.ApplyRange highlightRangeMode: ListView.ApplyRange
preferredHighlightBegin: 40 preferredHighlightBegin: 40
preferredHighlightEnd: width - 40 preferredHighlightEnd: width - 40

View File

@ -19,7 +19,7 @@ T.TabButton {
implicitHeight: contentItem.implicitHeight + topPadding + bottomPadding implicitHeight: contentItem.implicitHeight + topPadding + bottomPadding
baselineOffset: contentItem.y + contentItem.baselineOffset baselineOffset: contentItem.y + contentItem.baselineOffset
padding: units.smallSpacing padding: PlasmaCore.Units.smallSpacing
hoverEnabled: true hoverEnabled: true
@ -50,8 +50,8 @@ T.TabButton {
Layout.maximumWidth: control.icon.width > 0 ? control.icon.width : Number.POSITIVE_INFINITY Layout.maximumWidth: control.icon.width > 0 ? control.icon.width : Number.POSITIVE_INFINITY
Layout.maximumHeight: control.icon.height > 0 ? control.icon.height : Number.POSITIVE_INFINITY Layout.maximumHeight: control.icon.height > 0 ? control.icon.height : Number.POSITIVE_INFINITY
implicitWidth: control.icon.width > 0 ? control.icon.width : units.iconSizes.smallMedium implicitWidth: control.icon.width > 0 ? control.icon.width : PlasmaCore.Units.iconSizes.smallMedium
implicitHeight: control.icon.height > 0 ? control.icon.height : units.iconSizes.smallMedium implicitHeight: control.icon.height > 0 ? control.icon.height : PlasmaCore.Units.iconSizes.smallMedium
colorGroup: control.PlasmaCore.ColorScope.colorGroup colorGroup: control.PlasmaCore.ColorScope.colorGroup
visible: source.length > 0 && control.display !== T.AbstractButton.TextOnly visible: source.length > 0 && control.display !== T.AbstractButton.TextOnly

View File

@ -36,10 +36,10 @@ T.TextField {
&& (echoMode == TextInput.Normal || control.text.length > 0) && (echoMode == TextInput.Normal || control.text.length > 0)
implicitWidth: Math.max((placeholderText ? placeholder.implicitWidth : 0), implicitWidth: Math.max((placeholderText ? placeholder.implicitWidth : 0),
units.gridUnit * 8, PlasmaCore.Units.gridUnit * 8,
contentWidth) contentWidth)
+ base.margins.left + base.margins.right + base.margins.left + base.margins.right
implicitHeight: Math.max(units.gridUnit, contentHeight) implicitHeight: Math.max(PlasmaCore.Units.gridUnit, contentHeight)
+ topPadding + bottomPadding + topPadding + bottomPadding
leftPadding: base.margins.left + (LayoutMirroring.enabled ? inlineButtonRow.width : 0) leftPadding: base.margins.left + (LayoutMirroring.enabled ? inlineButtonRow.width : 0)
@ -120,13 +120,13 @@ T.TextField {
PlasmaCore.IconItem { PlasmaCore.IconItem {
id: showPasswordButton id: showPasswordButton
source: __effectiveRevealPasswordButtonShown ? (control.echoMode === TextInput.Normal ? "visibility": "hint") : "" source: __effectiveRevealPasswordButtonShown ? (control.echoMode === TextInput.Normal ? "visibility": "hint") : ""
height: Math.max(control.height * 0.8, units.iconSizes.small) height: Math.max(control.height * 0.8, PlasmaCore.Units.iconSizes.small)
width: height width: height
opacity: (__effectiveRevealPasswordButtonShown && control.enabled) ? 1 : 0 opacity: (__effectiveRevealPasswordButtonShown && control.enabled) ? 1 : 0
visible: opacity > 0 visible: opacity > 0
Behavior on opacity { Behavior on opacity {
NumberAnimation { NumberAnimation {
duration: units.longDuration duration: PlasmaCore.Units.longDuration
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
} }
} }
@ -144,13 +144,13 @@ T.TextField {
id: clearButton id: clearButton
//ltr confusingly refers to the direction of the arrow in the icon, not the text direction which it should be used in //ltr confusingly refers to the direction of the arrow in the icon, not the text direction which it should be used in
source: clearButtonShown ? (LayoutMirroring.enabled ? "edit-clear-locationbar-ltr" : "edit-clear-locationbar-rtl") : "" source: clearButtonShown ? (LayoutMirroring.enabled ? "edit-clear-locationbar-ltr" : "edit-clear-locationbar-rtl") : ""
height: Math.max(control.height * 0.8, units.iconSizes.small) height: Math.max(control.height * 0.8, PlasmaCore.Units.iconSizes.small)
width: height width: height
opacity: (control.length > 0 && clearButtonShown && control.enabled) ? 1 : 0 opacity: (control.length > 0 && clearButtonShown && control.enabled) ? 1 : 0
visible: opacity > 0 visible: opacity > 0
Behavior on opacity { Behavior on opacity {
NumberAnimation { NumberAnimation {
duration: units.longDuration duration: PlasmaCore.Units.longDuration
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
} }
} }

View File

@ -11,7 +11,7 @@ import org.kde.kirigami 2.5 as Kirigami
Item { Item {
id: root id: root
width: 1 //<-important that this is actually a single device pixel width: 1 //<-important that this is actually a single device pixel
height: units.gridUnit height: PlasmaCore.Units.gridUnit
property Item target property Item target
@ -20,7 +20,7 @@ Item {
visible: Kirigami.Settings.tabletMode && ((target.activeFocus && !selectionStartHandle) || target.selectedText.length > 0) visible: Kirigami.Settings.tabletMode && ((target.activeFocus && !selectionStartHandle) || target.selectedText.length > 0)
Rectangle { Rectangle {
width: Math.round(units.devicePixelRatio * 3) width: Math.round(PlasmaCore.Units.devicePixelRatio * 3)
anchors { anchors {
horizontalCenter: parent.horizontalCenter horizontalCenter: parent.horizontalCenter
top: parent.top top: parent.top
@ -29,7 +29,7 @@ Item {
color: Qt.tint(theme.highlightColor, Qt.rgba(1,1,1,0.4)) color: Qt.tint(theme.highlightColor, Qt.rgba(1,1,1,0.4))
radius: width radius: width
Rectangle { Rectangle {
width: Math.round(units.gridUnit/1.5) width: Math.round(PlasmaCore.Units.gridUnit/1.5)
height: width height: width
visible: MobileTextActionsToolBar.shouldBeVisible visible: MobileTextActionsToolBar.shouldBeVisible
anchors { anchors {
@ -42,7 +42,7 @@ Item {
MouseArea { MouseArea {
anchors { anchors {
fill: parent fill: parent
margins: -units.gridUnit margins: -PlasmaCore.Units.gridUnit
} }
preventStealing: true preventStealing: true
onPositionChanged: { onPositionChanged: {

View File

@ -10,6 +10,7 @@ import QtQuick 2.1
import QtQuick.Layouts 1.2 import QtQuick.Layouts 1.2
import QtQuick.Window 2.2 import QtQuick.Window 2.2
import QtQuick.Controls @QQC2_VERSION@ import QtQuick.Controls @QQC2_VERSION@
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.kirigami 2.5 as Kirigami import org.kde.kirigami 2.5 as Kirigami
Popup { Popup {
@ -33,7 +34,7 @@ Popup {
if (desiredY >= 0) { if (desiredY >= 0) {
return Math.min(desiredY, parent.height - root.height); return Math.min(desiredY, parent.height - root.height);
} else { } else {
return Math.min(Math.max(0, controlRoot.mapToItem(root.parent, 0, controlRoot.positionToRectangle(controlRoot.selectionEnd).y + Math.round(units.gridUnit*1.5)).y), parent.height - root.height); return Math.min(Math.max(0, controlRoot.mapToItem(root.parent, 0, controlRoot.positionToRectangle(controlRoot.selectionEnd).y + Math.round(PlasmaCore.Units.gridUnit*1.5)).y), parent.height - root.height);
} }
} }

View File

@ -52,7 +52,7 @@ Item {
to: "hidden" to: "hidden"
SequentialAnimation { SequentialAnimation {
OpacityAnimator { OpacityAnimator {
duration: units.shortDuration duration: PlasmaCore.Units.shortDuration
easing.type: Easing.OutQuad easing.type: Easing.OutQuad
} }
PropertyAction { PropertyAction {
@ -72,7 +72,7 @@ Item {
value: true value: true
} }
OpacityAnimator { OpacityAnimator {
duration: units.shortDuration duration: PlasmaCore.Units.shortDuration
easing.type: Easing.OutQuad easing.type: Easing.OutQuad
} }
} }

View File

@ -140,7 +140,7 @@ Item {
} }
NumberAnimation { NumberAnimation {
property: "opacity" property: "opacity"
duration: units.shortDuration duration: PlasmaCore.Units.shortDuration
easing.type: Easing.OutQuad easing.type: Easing.OutQuad
} }
PropertyAction { PropertyAction {
@ -162,7 +162,7 @@ Item {
NumberAnimation { NumberAnimation {
property: "opacity" property: "opacity"
// Using a shorter duration here makes things feel more responsive. // Using a shorter duration here makes things feel more responsive.
duration: units.shortDuration/2 duration: PlasmaCore.Units.shortDuration/2
easing.type: Easing.OutQuad easing.type: Easing.OutQuad
} }
PropertyAction { PropertyAction {
@ -184,7 +184,7 @@ Item {
NumberAnimation { NumberAnimation {
property: "opacity" property: "opacity"
// Using a shorter duration here makes things feel more responsive. // Using a shorter duration here makes things feel more responsive.
duration: units.shortDuration/2 duration: PlasmaCore.Units.shortDuration/2
easing.type: Easing.OutQuad easing.type: Easing.OutQuad
} }
PropertyAction { PropertyAction {

View File

@ -159,7 +159,7 @@ Item {
} }
NumberAnimation { NumberAnimation {
property: "opacity" property: "opacity"
duration: units.shortDuration duration: PlasmaCore.Units.shortDuration
easing.type: Easing.OutQuad easing.type: Easing.OutQuad
} }
PropertyAction { PropertyAction {
@ -181,7 +181,7 @@ Item {
NumberAnimation { NumberAnimation {
property: "opacity" property: "opacity"
// Using a shorter duration here makes things feel more responsive. // Using a shorter duration here makes things feel more responsive.
duration: units.shortDuration/2 duration: PlasmaCore.Units.shortDuration/2
easing.type: Easing.OutQuad easing.type: Easing.OutQuad
} }
PropertyAction { PropertyAction {
@ -202,7 +202,7 @@ Item {
} }
NumberAnimation { NumberAnimation {
property: "opacity" property: "opacity"
duration: units.shortDuration duration: PlasmaCore.Units.shortDuration
easing.type: Easing.OutQuad easing.type: Easing.OutQuad
} }
PropertyAction { PropertyAction {

View File

@ -113,7 +113,7 @@ Item {
Transition { Transition {
PropertyAnimation { PropertyAnimation {
properties: "opacity" properties: "opacity"
duration: units.longDuration duration: PlasmaCore.Units.longDuration
easing.type: Easing.OutQuad easing.type: Easing.OutQuad
} }
} }

View File

@ -77,7 +77,7 @@ Item {
Transition { Transition {
PropertyAnimation { PropertyAnimation {
properties: "opacity" properties: "opacity"
duration: units.longDuration duration: PlasmaCore.Units.longDuration
easing.type: Easing.OutQuad easing.type: Easing.OutQuad
} }
} }

View File

@ -25,7 +25,7 @@ QtQuickControlStyle.ButtonStyle {
property int minimumHeight property int minimumHeight
label: RowLayout { label: RowLayout {
spacing: units.smallSpacing spacing: PlasmaCore.Units.smallSpacing
property real minimumWidth: implicitWidth + style.padding.left + style.padding.right property real minimumWidth: implicitWidth + style.padding.left + style.padding.right
onMinimumWidthChanged: { onMinimumWidthChanged: {
@ -46,8 +46,8 @@ QtQuickControlStyle.ButtonStyle {
PlasmaCore.IconItem { PlasmaCore.IconItem {
id: icon id: icon
source: control.iconName || control.iconSource source: control.iconName || control.iconSource
Layout.minimumWidth: valid ? units.iconSizes.tiny : 0 Layout.minimumWidth: valid ? PlasmaCore.Units.iconSizes.tiny : 0
Layout.preferredWidth: valid ? units.iconSizes.small : 0 Layout.preferredWidth: valid ? PlasmaCore.Units.iconSizes.small : 0
visible: valid visible: valid
Layout.minimumHeight: Layout.minimumWidth Layout.minimumHeight: Layout.minimumWidth
Layout.preferredHeight: Layout.preferredWidth Layout.preferredHeight: Layout.preferredWidth
@ -80,7 +80,7 @@ QtQuickControlStyle.ButtonStyle {
id: arrow id: arrow
when: control.menu !== null when: control.menu !== null
visible: when visible: when
Layout.minimumWidth: units.iconSizes.small Layout.minimumWidth: PlasmaCore.Units.iconSizes.small
Layout.maximumWidth: Layout.minimumWidth Layout.maximumWidth: Layout.minimumWidth
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
height: width height: width

View File

@ -21,12 +21,12 @@ QtQuickControlStyle.CalendarStyle {
background: Item { background: Item {
implicitWidth: Math.max(250, Math.round(units.gridUnit * 14)) implicitWidth: Math.max(250, Math.round(PlasmaCore.Units.gridUnit * 14))
implicitHeight: Math.max(250, Math.round(units.gridUnit * 14)) implicitHeight: Math.max(250, Math.round(PlasmaCore.Units.gridUnit * 14))
} }
navigationBar: Item { navigationBar: Item {
height: Math.round(units.gridUnit * 2.73) height: Math.round(PlasmaCore.Units.gridUnit * 2.73)
PlasmaComponents.ToolButton { PlasmaComponents.ToolButton {
id: previousMonth id: previousMonth
@ -42,7 +42,7 @@ QtQuickControlStyle.CalendarStyle {
text: styleData.title text: styleData.title
elide: Text.ElideRight elide: Text.ElideRight
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
font.pixelSize: units.gridUnit * 1.25 font.pixelSize: PlasmaCore.Units.gridUnit * 1.25
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.left: previousMonth.right anchors.left: previousMonth.right
anchors.leftMargin: 2 anchors.leftMargin: 2
@ -97,7 +97,7 @@ QtQuickControlStyle.CalendarStyle {
} }
dayOfWeekDelegate: Item { dayOfWeekDelegate: Item {
implicitHeight: Math.round(units.gridUnit * 2.25) implicitHeight: Math.round(PlasmaCore.Units.gridUnit * 2.25)
PlasmaComponents.Label { PlasmaComponents.Label {
text: control.__locale.dayName(styleData.dayOfWeek, control.dayOfWeekFormat) text: control.__locale.dayName(styleData.dayOfWeek, control.dayOfWeekFormat)
anchors.centerIn: parent anchors.centerIn: parent
@ -105,7 +105,7 @@ QtQuickControlStyle.CalendarStyle {
} }
weekNumberDelegate: Item { weekNumberDelegate: Item {
implicitWidth: Math.round(units.gridUnit * 2) implicitWidth: Math.round(PlasmaCore.Units.gridUnit * 2)
PlasmaComponents.Label { PlasmaComponents.Label {
text: styleData.weekNumber text: styleData.weekNumber
anchors.centerIn: parent anchors.centerIn: parent

View File

@ -20,19 +20,19 @@ QtQuickControlStyle.CheckBoxStyle {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.top: parent.bottom anchors.top: parent.bottom
height: 1 * units.devicePixelRatio height: 1 * PlasmaCore.Units.devicePixelRatio
color: theme.highlightColor color: theme.highlightColor
visible: control.activeFocus visible: control.activeFocus
} }
} }
background: Item {} background: Item {}
spacing: units.smallSpacing spacing: PlasmaCore.Units.smallSpacing
indicator: PlasmaCore.FrameSvgItem { indicator: PlasmaCore.FrameSvgItem {
imagePath: "widgets/button" imagePath: "widgets/button"
prefix: "normal" prefix: "normal"
width: units.iconSizes.small width: PlasmaCore.Units.iconSizes.small
height: width height: width
opacity: control.enabled ? 1 : 0.6 opacity: control.enabled ? 1 : 0.6
@ -57,7 +57,7 @@ QtQuickControlStyle.CheckBoxStyle {
} }
Behavior on opacity { Behavior on opacity {
NumberAnimation { NumberAnimation {
duration: units.longDuration duration: PlasmaCore.Units.longDuration
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
} }
} }

View File

@ -14,7 +14,7 @@ import org.kde.plasma.components 2.0 as PlasmaComponents
import "private" as Private import "private" as Private
QtQuickControlStyle.ComboBoxStyle { QtQuickControlStyle.ComboBoxStyle {
drowDownButtonWidth: units.iconSizes.small drowDownButtonWidth: PlasmaCore.Units.iconSizes.small
label: PlasmaComponents.Label { label: PlasmaComponents.Label {
text: control.currentText text: control.currentText

View File

@ -12,14 +12,14 @@ Item {
property Item input: parent property Item input: parent
width: units.smallSpacing width: PlasmaCore.Units.smallSpacing
height: input.cursorRectangle.height height: input.cursorRectangle.height
visible: input.activeFocus && input.selectionStart === input.selectionEnd visible: input.activeFocus && input.selectionStart === input.selectionEnd
Rectangle { Rectangle {
width: units.smallSpacing width: PlasmaCore.Units.smallSpacing
height: parent.height + units.gridUnit height: parent.height + PlasmaCore.Units.gridUnit
radius: width radius: width
color: theme.highlightColor color: theme.highlightColor
} }
@ -27,7 +27,7 @@ Item {
Rectangle { Rectangle {
id: handle id: handle
x: -width/2 + parent.width/2 x: -width/2 + parent.width/2
width: units.gridUnit width: PlasmaCore.Units.gridUnit
height: width height: width
radius: width radius: width
color: theme.highlightColor color: theme.highlightColor

View File

@ -8,20 +8,20 @@ import QtQuick 2.2
import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.core 2.0 as PlasmaCore
Item { Item {
width: units.gridUnit width: PlasmaCore.Units.gridUnit
height: styleData.lineHeight + units.gridUnit height: styleData.lineHeight + PlasmaCore.Units.gridUnit
visible: styleData.hasSelection visible: styleData.hasSelection
Rectangle { Rectangle {
id: handle id: handle
width: units.gridUnit width: PlasmaCore.Units.gridUnit
height: width height: width
radius: width radius: width
color: theme.highlightColor color: theme.highlightColor
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
} }
Rectangle { Rectangle {
width: units.gridUnit/2 width: PlasmaCore.Units.gridUnit/2
height: width height: width
anchors { anchors {
left: handle.left left: handle.left
@ -30,8 +30,8 @@ Item {
color: theme.highlightColor color: theme.highlightColor
} }
Rectangle { Rectangle {
width: units.smallSpacing width: PlasmaCore.Units.smallSpacing
height: styleData.lineHeight + units.gridUnit/2 height: styleData.lineHeight + PlasmaCore.Units.gridUnit/2
color: theme.highlightColor color: theme.highlightColor
anchors.left: parent.left anchors.left: parent.left
} }

View File

@ -128,7 +128,7 @@ Item {
var endRect = input.positionToRectangle(input.selectionEnd); var endRect = input.positionToRectangle(input.selectionEnd);
var pos = getMenuInstance().parent.mapFromItem(input, (startRect.x + endRect.x)/2 - getMenuInstance().width/2, endRect.y); var pos = getMenuInstance().parent.mapFromItem(input, (startRect.x + endRect.x)/2 - getMenuInstance().width/2, endRect.y);
pos.y += (pos.y + getMenuInstance().height + units.gridUnit) > getMenuInstance().parent.height ? -units.smallSpacing - getMenuInstance().height : units.gridUnit*2; pos.y += (pos.y + getMenuInstance().height + PlasmaCore.Units.gridUnit) > getMenuInstance().parent.height ? -PlasmaCore.Units.smallSpacing - getMenuInstance().height : PlasmaCore.Units.gridUnit*2;
getMenuInstance().dismiss(); getMenuInstance().dismiss();
getMenuInstance().popup(pos); getMenuInstance().popup(pos);

View File

@ -35,7 +35,7 @@ Style {
id: label id: label
anchors.top: parent.top anchors.top: parent.top
anchors.left: checkboxloader.right anchors.left: checkboxloader.right
anchors.margins: units.smallSpacing anchors.margins: PlasmaCore.Units.smallSpacing
text: control.title text: control.title
} }

View File

@ -27,8 +27,8 @@ QtQuickControlStyle.MenuBarStyle {
imagePath: "widgets/tabbar" imagePath: "widgets/tabbar"
prefix: styleData.open || styleData.selected ? "north-active-tab" : "" prefix: styleData.open || styleData.selected ? "north-active-tab" : ""
property string plainText: QtQuickControlsPrivate.StyleHelpers.removeMnemonics(styleData.text) property string plainText: QtQuickControlsPrivate.StyleHelpers.removeMnemonics(styleData.text)
implicitWidth: text.implicitWidth + units.smallSpacing * 3 implicitWidth: text.implicitWidth + PlasmaCore.Units.smallSpacing * 3
implicitHeight: text.implicitHeight + units.smallSpacing * 2 implicitHeight: text.implicitHeight + PlasmaCore.Units.smallSpacing * 2
enabled: styleData.enabled enabled: styleData.enabled
colorGroup: PlasmaCore.ColorScope.colorGroup colorGroup: PlasmaCore.ColorScope.colorGroup

View File

@ -36,7 +36,7 @@ ProgressBarStyle {
} }
background: Item { background: Item {
implicitWidth: units.gridUnit * 14 implicitWidth: PlasmaCore.Units.gridUnit * 14
implicitHeight: theme.mSize(theme.defaultFont).height * 1.6 implicitHeight: theme.mSize(theme.defaultFont).height * 1.6
PlasmaCore.FrameSvgItem { PlasmaCore.FrameSvgItem {
anchors.centerIn: parent anchors.centerIn: parent
@ -56,7 +56,7 @@ ProgressBarStyle {
prefix: "bar-active" prefix: "bar-active"
colorGroup: PlasmaCore.ColorScope.colorGroup colorGroup: PlasmaCore.ColorScope.colorGroup
width: control.indeterminate ? units.gridUnit * 2 : Math.max(margins.left + margins.right, parent.width) width: control.indeterminate ? PlasmaCore.Units.gridUnit * 2 : Math.max(margins.left + margins.right, parent.width)
height: style.implicitHeight height: style.implicitHeight
visible: control.indeterminate || currentProgress > 0 visible: control.indeterminate || currentProgress > 0
@ -77,7 +77,7 @@ ProgressBarStyle {
duration: PlasmaCore.Units.veryLongDuration * 2 duration: PlasmaCore.Units.veryLongDuration * 2
// The progress Item's width might be left over from the previous state // The progress Item's width might be left over from the previous state
// so we use the control.width/height directly instead // so we use the control.width/height directly instead
to: control.width - units.gridUnit * 2 to: control.width - PlasmaCore.Units.gridUnit * 2
onToChanged: { onToChanged: {
//the animation won't update the boundaries automatically //the animation won't update the boundaries automatically
if (anim.running) { if (anim.running) {

View File

@ -20,7 +20,7 @@ QtQuickControlStyle.RadioButtonStyle {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.top: parent.bottom anchors.top: parent.bottom
height: 1 * units.devicePixelRatio height: 1 * PlasmaCore.Units.devicePixelRatio
color: theme.highlightColor color: theme.highlightColor
visible: control.activeFocus visible: control.activeFocus
} }
@ -28,7 +28,7 @@ QtQuickControlStyle.RadioButtonStyle {
//Not needed? //Not needed?
background: Item {} background: Item {}
spacing: units.smallSpacing spacing: PlasmaCore.Units.smallSpacing
indicator: PlasmaCore.SvgItem { indicator: PlasmaCore.SvgItem {
svg: PlasmaCore.Svg { svg: PlasmaCore.Svg {
@ -38,7 +38,7 @@ QtQuickControlStyle.RadioButtonStyle {
elementId: "normal" elementId: "normal"
opacity: control.enabled ? 1 : 0.6 opacity: control.enabled ? 1 : 0.6
width: units.iconSizes.small width: PlasmaCore.Units.iconSizes.small
height: width height: width
PlasmaCore.SvgItem { PlasmaCore.SvgItem {
@ -54,7 +54,7 @@ QtQuickControlStyle.RadioButtonStyle {
} }
Behavior on opacity { Behavior on opacity {
NumberAnimation { NumberAnimation {
duration: units.longDuration duration: PlasmaCore.Units.longDuration
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
} }
} }

View File

@ -36,9 +36,9 @@ QtQuickControlStyle.ScrollViewStyle {
// QTBUG-35608 // QTBUG-35608
// default values are hardcoded in qtdeclarative/src/quick/items/qquickflickablebehavior_p.h // default values are hardcoded in qtdeclarative/src/quick/items/qquickflickablebehavior_p.h
control.flickableItem.flickDeceleration = Math.round(1500 * units.devicePixelRatio); control.flickableItem.flickDeceleration = Math.round(1500 * PlasmaCore.Units.devicePixelRatio);
// double maximum speed so it feels better // double maximum speed so it feels better
control.flickableItem.maximumFlickVelocity = Math.round(2500 * units.devicePixelRatio); control.flickableItem.maximumFlickVelocity = Math.round(2500 * PlasmaCore.Units.devicePixelRatio);
control.flickableItem.interactive = true; control.flickableItem.interactive = true;
} }
@ -76,7 +76,7 @@ QtQuickControlStyle.ScrollViewStyle {
opacity: !visible || flickableItem.atYBeginning ? 0 : 1 opacity: !visible || flickableItem.atYBeginning ? 0 : 1
Behavior on opacity { Behavior on opacity {
NumberAnimation { NumberAnimation {
duration: units.longDuration duration: PlasmaCore.Units.longDuration
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
} }
} }
@ -102,7 +102,7 @@ QtQuickControlStyle.ScrollViewStyle {
opacity: !visible || flickableItem.atYEnd ? 0 : 1 opacity: !visible || flickableItem.atYEnd ? 0 : 1
Behavior on opacity { Behavior on opacity {
NumberAnimation { NumberAnimation {
duration: units.longDuration duration: PlasmaCore.Units.longDuration
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
} }
} }
@ -127,7 +127,7 @@ QtQuickControlStyle.ScrollViewStyle {
opacity: !visible || flickableItem.atXBeginning ? 0 : 1 opacity: !visible || flickableItem.atXBeginning ? 0 : 1
Behavior on opacity { Behavior on opacity {
NumberAnimation { NumberAnimation {
duration: units.longDuration duration: PlasmaCore.Units.longDuration
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
} }
} }
@ -152,7 +152,7 @@ QtQuickControlStyle.ScrollViewStyle {
opacity: !visible || flickableItem.atXEnd ? 0 : 1 opacity: !visible || flickableItem.atXEnd ? 0 : 1
Behavior on opacity { Behavior on opacity {
NumberAnimation { NumberAnimation {
duration: units.longDuration duration: PlasmaCore.Units.longDuration
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
} }
} }
@ -172,7 +172,7 @@ QtQuickControlStyle.ScrollViewStyle {
opacity: styleData.hovered ? 1 : 0 opacity: styleData.hovered ? 1 : 0
Behavior on opacity { Behavior on opacity {
NumberAnimation { NumberAnimation {
duration: units.longDuration duration: PlasmaCore.Units.longDuration
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
} }
} }
@ -200,8 +200,8 @@ QtQuickControlStyle.ScrollViewStyle {
svg: scrollbarSvg svg: scrollbarSvg
visible: scrollbarSvg.arrowPresent visible: scrollbarSvg.arrowPresent
//if there is no arrow we don't want to waste space, a tiny margin does look better though //if there is no arrow we don't want to waste space, a tiny margin does look better though
implicitWidth: scrollbarSvg.arrowPresent ? widthHint : units.smallSpacing implicitWidth: scrollbarSvg.arrowPresent ? widthHint : PlasmaCore.Units.smallSpacing
implicitHeight: scrollbarSvg.arrowPresent ? widthHint : units.smallSpacing implicitHeight: scrollbarSvg.arrowPresent ? widthHint : PlasmaCore.Units.smallSpacing
elementId: { elementId: {
if (styleData.pressed) { if (styleData.pressed) {
return styleData.horizontal ? "sunken-arrow-right" : "sunken-arrow-down" return styleData.horizontal ? "sunken-arrow-right" : "sunken-arrow-down"
@ -217,8 +217,8 @@ QtQuickControlStyle.ScrollViewStyle {
decrementControl: PlasmaCore.SvgItem { decrementControl: PlasmaCore.SvgItem {
svg: scrollbarSvg svg: scrollbarSvg
visible: scrollbarSvg.arrowPresent visible: scrollbarSvg.arrowPresent
implicitWidth: scrollbarSvg.arrowPresent ? widthHint : units.smallSpacing implicitWidth: scrollbarSvg.arrowPresent ? widthHint : PlasmaCore.Units.smallSpacing
implicitHeight: scrollbarSvg.arrowPresent ? widthHint : units.smallSpacing implicitHeight: scrollbarSvg.arrowPresent ? widthHint : PlasmaCore.Units.smallSpacing
elementId: { elementId: {
if (styleData.pressed) { if (styleData.pressed) {
return styleData.horizontal ? "sunken-arrow-left" : "sunken-arrow-up" return styleData.horizontal ? "sunken-arrow-left" : "sunken-arrow-up"

View File

@ -8,21 +8,21 @@ import QtQuick 2.2
import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.core 2.0 as PlasmaCore
Item { Item {
width: units.gridUnit width: PlasmaCore.Units.gridUnit
x: -width x: -width
height: styleData.lineHeight + units.gridUnit height: styleData.lineHeight + PlasmaCore.Units.gridUnit
visible: styleData.hasSelection visible: styleData.hasSelection
Rectangle { Rectangle {
id: handle id: handle
width: units.gridUnit width: PlasmaCore.Units.gridUnit
height: width height: width
radius: width radius: width
color: theme.highlightColor color: theme.highlightColor
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
} }
Rectangle { Rectangle {
width: units.gridUnit/2 width: PlasmaCore.Units.gridUnit/2
height: width height: width
anchors { anchors {
right: handle.right right: handle.right
@ -31,8 +31,8 @@ Item {
color: theme.highlightColor color: theme.highlightColor
} }
Rectangle { Rectangle {
width: units.smallSpacing width: PlasmaCore.Units.smallSpacing
height: styleData.lineHeight + units.gridUnit/2 height: styleData.lineHeight + PlasmaCore.Units.gridUnit/2
color: theme.highlightColor color: theme.highlightColor
anchors.right: parent.right anchors.right: parent.right
} }

View File

@ -12,10 +12,10 @@ import org.kde.plasma.core 2.0 as PlasmaCore
QtQuickControlStyle.StatusBarStyle { QtQuickControlStyle.StatusBarStyle {
padding { padding {
left: units.smallSpacing left: PlasmaCore.Units.smallSpacing
right: units.smallSpacing right: PlasmaCore.Units.smallSpacing
top: units.smallSpacing top: PlasmaCore.Units.smallSpacing
bottom: units.smallSpacing/2 bottom: PlasmaCore.Units.smallSpacing/2
} }

View File

@ -40,7 +40,7 @@ QtQuickControlStyle.SwitchStyle {
opacity: checked ? 1 : 0 opacity: checked ? 1 : 0
Behavior on opacity { Behavior on opacity {
PropertyAnimation { duration: units.shortDuration * 2 } PropertyAnimation { duration: PlasmaCore.Units.shortDuration * 2 }
} }
} }
} }

View File

@ -40,7 +40,7 @@ QtQuickControlStyle.TabViewStyle {
colorGroup: PlasmaCore.ColorScope.colorGroup colorGroup: PlasmaCore.ColorScope.colorGroup
Behavior on opacity { Behavior on opacity {
PropertyAnimation { PropertyAnimation {
duration: units.longDuration duration: PlasmaCore.Units.longDuration
} }
} }
} }

View File

@ -53,7 +53,7 @@ QtQuickControlStyle.TableViewStyle {
rowDelegate: Rectangle { rowDelegate: Rectangle {
height: Math.round(units.gridUnit * 1.2) height: Math.round(PlasmaCore.Units.gridUnit * 1.2)
property color selectedColor: styleData.hasActiveFocus ? theme.viewHoverColor: theme.viewFocusColor property color selectedColor: styleData.hasActiveFocus ? theme.viewHoverColor: theme.viewFocusColor
color: styleData.selected ? selectedColor : color: styleData.selected ? selectedColor :
@ -113,8 +113,8 @@ QtQuickControlStyle.TableViewStyle {
svg: scrollbarSvg svg: scrollbarSvg
visible: scrollbarSvg.arrowPresent visible: scrollbarSvg.arrowPresent
//if there is no arrow we don't want to waste space, a tiny margin does look better though //if there is no arrow we don't want to waste space, a tiny margin does look better though
implicitWidth: scrollbarSvg.arrowPresent ? scrollbarWidthHint : units.smallSpacing implicitWidth: scrollbarSvg.arrowPresent ? scrollbarWidthHint : PlasmaCore.Units.smallSpacing
implicitHeight: scrollbarSvg.arrowPresent ? scrollbarWidthHint : units.smallSpacing implicitHeight: scrollbarSvg.arrowPresent ? scrollbarWidthHint : PlasmaCore.Units.smallSpacing
elementId: { elementId: {
if (styleData.pressed) { if (styleData.pressed) {
return styleData.horizontal ? "sunken-arrow-right" : "sunken-arrow-down" return styleData.horizontal ? "sunken-arrow-right" : "sunken-arrow-down"
@ -130,8 +130,8 @@ QtQuickControlStyle.TableViewStyle {
decrementControl: PlasmaCore.SvgItem { decrementControl: PlasmaCore.SvgItem {
svg: scrollbarSvg svg: scrollbarSvg
visible: scrollbarSvg.arrowPresent visible: scrollbarSvg.arrowPresent
implicitWidth: scrollbarSvg.arrowPresent ? scrollbarWidthHint : units.smallSpacing implicitWidth: scrollbarSvg.arrowPresent ? scrollbarWidthHint : PlasmaCore.Units.smallSpacing
implicitHeight: scrollbarSvg.arrowPresent ? scrollbarWidthHint : units.smallSpacing implicitHeight: scrollbarSvg.arrowPresent ? scrollbarWidthHint : PlasmaCore.Units.smallSpacing
elementId: { elementId: {
if (styleData.pressed) { if (styleData.pressed) {
return styleData.horizontal ? "sunken-arrow-left" : "sunken-arrow-up" return styleData.horizontal ? "sunken-arrow-left" : "sunken-arrow-up"

View File

@ -48,7 +48,7 @@ QtQuickControlStyle.TextAreaStyle {
style.padding.left = base.margins.left style.padding.left = base.margins.left
style.padding.top = base.margins.top style.padding.top = base.margins.top
//TODO: if QtControls gets a component for this, use it instead of this hardcoded heuristic //TODO: if QtControls gets a component for this, use it instead of this hardcoded heuristic
style.padding.right = base.margins.right + (control.clearButtonShown ? Math.max(control.parent.height*0.8, units.iconSizes.small)+units.smallSpacing : 0) style.padding.right = base.margins.right + (control.clearButtonShown ? Math.max(control.parent.height*0.8, PlasmaCore.Units.iconSizes.small)+PlasmaCore.Units.smallSpacing : 0)
style.padding.bottom = base.margins.bottom style.padding.bottom = base.margins.bottom
} }
} }

View File

@ -74,11 +74,11 @@ QtQuickControlStyle.TextFieldStyle {
//TODO: if QtControls gets a component for this, use it instead of this hardcoded heuristic //TODO: if QtControls gets a component for this, use it instead of this hardcoded heuristic
root.padding.right = Qt.binding(function() { root.padding.right = Qt.binding(function() {
var actionIconSize = Math.max(control.height * 0.8, units.iconSizes.small); var actionIconSize = Math.max(control.height * 0.8, PlasmaCore.Units.iconSizes.small);
//actionCount is an int of the number of items //actionCount is an int of the number of items
var actionCount = (control.hasOwnProperty("clearButtonShown") && control.clearButtonShown) + var actionCount = (control.hasOwnProperty("clearButtonShown") && control.clearButtonShown) +
(control.hasOwnProperty("__effectiveRevealPasswordButtonShown") && control.__effectiveRevealPasswordButtonShown); (control.hasOwnProperty("__effectiveRevealPasswordButtonShown") && control.__effectiveRevealPasswordButtonShown);
return base.margins.right + (actionIconSize * actionCount) + (actionCount > 0 ? units.smallSpacing : 0); return base.margins.right + (actionIconSize * actionCount) + (actionCount > 0 ? PlasmaCore.Units.smallSpacing : 0);
}) })
} }
} }

View File

@ -33,9 +33,9 @@ QtQuickControlStyle.ButtonStyle {
RowLayout { RowLayout {
id: buttonContent id: buttonContent
anchors.fill: parent anchors.fill: parent
spacing: units.smallSpacing spacing: PlasmaCore.Units.smallSpacing
Layout.preferredHeight: Math.max(units.iconSizes.small, label.implicitHeight) Layout.preferredHeight: Math.max(PlasmaCore.Units.iconSizes.small, label.implicitHeight)
property real minimumWidth: Layout.minimumWidth + style.padding.left + style.padding.right property real minimumWidth: Layout.minimumWidth + style.padding.left + style.padding.right
onMinimumWidthChanged: { onMinimumWidthChanged: {
@ -98,7 +98,7 @@ QtQuickControlStyle.ButtonStyle {
id: arrow id: arrow
when: control.menu !== null when: control.menu !== null
visible: when visible: when
Layout.minimumWidth: units.iconSizes.small Layout.minimumWidth: PlasmaCore.Units.iconSizes.small
Layout.maximumWidth: Layout.minimumWidth Layout.maximumWidth: Layout.minimumWidth
Layout.minimumHeight: Layout.minimumWidth Layout.minimumHeight: Layout.minimumWidth
@ -174,7 +174,7 @@ QtQuickControlStyle.ButtonStyle {
//internal: if there is no hover status, don't paint on mouse over in touchscreens //internal: if there is no hover status, don't paint on mouse over in touchscreens
opacity: (control.pressed || control.checked || !style.flat || (roundShadow.hasOverState && style.controlHovered)) ? 1 : 0 opacity: (control.pressed || control.checked || !style.flat || (roundShadow.hasOverState && style.controlHovered)) ? 1 : 0
Behavior on opacity { Behavior on opacity {
PropertyAnimation { duration: units.longDuration } PropertyAnimation { duration: PlasmaCore.Units.longDuration }
} }
} }
} }

View File

@ -114,7 +114,7 @@ Item {
Transition { Transition {
PropertyAnimation { PropertyAnimation {
properties: "opacity" properties: "opacity"
duration: units.longDuration duration: PlasmaCore.Units.longDuration
easing.type: Easing.OutQuad easing.type: Easing.OutQuad
} }
} }

View File

@ -113,7 +113,7 @@ Item {
Transition { Transition {
PropertyAnimation { PropertyAnimation {
properties: "opacity" properties: "opacity"
duration: units.veryShortDuration duration: PlasmaCore.Units.veryShortDuration
easing.type: Easing.OutQuad easing.type: Easing.OutQuad
} }
} }

View File

@ -77,7 +77,7 @@ Item {
Transition { Transition {
PropertyAnimation { PropertyAnimation {
properties: "opacity" properties: "opacity"
duration: units.longDuration duration: PlasmaCore.Units.longDuration
easing.type: Easing.OutQuad easing.type: Easing.OutQuad
} }
} }

View File

@ -16,7 +16,7 @@ ColumnLayout {
property alias cfg_DisplayText: textField.text property alias cfg_DisplayText: textField.text
RowLayout { RowLayout {
spacing: units.largeSpacing / 2 spacing: PlasmaCore.Units.largeSpacing / 2
// To allow aligned integration in the settings form, // To allow aligned integration in the settings form,
// "formAlignment" is a property injected by the config containment // "formAlignment" is a property injected by the config containment
@ -24,7 +24,7 @@ ColumnLayout {
QtControls.Label { QtControls.Label {
Layout.minimumWidth: width Layout.minimumWidth: width
Layout.maximumWidth: width Layout.maximumWidth: width
width: formAlignment - units.largeSpacing width: formAlignment - PlasmaCore.Units.largeSpacing
horizontalAlignment: Text.AlignRight horizontalAlignment: Text.AlignRight
// use i18nd in config QML, as the default textdomain is set to that of the config container // use i18nd in config QML, as the default textdomain is set to that of the config container

View File

@ -16,7 +16,7 @@ ColumnLayout {
property alias cfg_DisplayText: textField.text property alias cfg_DisplayText: textField.text
RowLayout { RowLayout {
spacing: units.largeSpacing / 2 spacing: PlasmaCore.Units.largeSpacing / 2
// To allow aligned integration in the settings form, // To allow aligned integration in the settings form,
// "formAlignment" is a property injected by the config containment // "formAlignment" is a property injected by the config containment
@ -24,7 +24,7 @@ ColumnLayout {
QtControls.Label { QtControls.Label {
Layout.minimumWidth: width Layout.minimumWidth: width
Layout.maximumWidth: width Layout.maximumWidth: width
width: formAlignment - units.largeSpacing width: formAlignment - PlasmaCore.Units.largeSpacing
horizontalAlignment: Text.AlignRight horizontalAlignment: Text.AlignRight
// use i18nd in config QML, as the default textdomain is set to that of the config container // use i18nd in config QML, as the default textdomain is set to that of the config container

View File

@ -19,8 +19,8 @@ ColumnLayout {
Layout.minimumHeight: rect1.height Layout.minimumHeight: rect1.height
Rectangle { Rectangle {
id: rect1 id: rect1
width: units.gridUnit * 30 width: PlasmaCore.Units.gridUnit * 30
height: units.gridUnit * 15 height: PlasmaCore.Units.gridUnit * 15
color: PlasmaCore.ColorScope.backgroundColor color: PlasmaCore.ColorScope.backgroundColor
Column { Column {
@ -48,7 +48,7 @@ ColumnLayout {
} }
Rectangle { Rectangle {
width: parent.width width: parent.width
height: units.gridUnit * 3 height: PlasmaCore.Units.gridUnit * 3
color: PlasmaCore.ColorScope.textColor color: PlasmaCore.ColorScope.textColor
} }
} }
@ -61,8 +61,8 @@ ColumnLayout {
Layout.minimumHeight: rect1.height Layout.minimumHeight: rect1.height
Rectangle { Rectangle {
id: rect2 id: rect2
width: units.gridUnit * 30 width: PlasmaCore.Units.gridUnit * 30
height: units.gridUnit * 15 height: PlasmaCore.Units.gridUnit * 15
color: PlasmaCore.ColorScope.backgroundColor color: PlasmaCore.ColorScope.backgroundColor
} }
} }

View File

@ -42,7 +42,7 @@ ColumnLayout
id: menuColumn id: menuColumn
Layout.minimumWidth: menuColumn.implicitWidth Layout.minimumWidth: menuColumn.implicitWidth
Layout.minimumHeight: menuColumn.implicitHeight Layout.minimumHeight: menuColumn.implicitHeight
spacing: units.smallSpacing spacing: PlasmaCore.Units.smallSpacing
PlasmaExtras.Heading { PlasmaExtras.Heading {
level: 3 level: 3

View File

@ -16,7 +16,7 @@ import org.kde.plasma.extras 2.0 as PlasmaExtras
ColumnLayout ColumnLayout
{ {
height: units.gridUnit * 20 height: PlasmaCore.Units.gridUnit * 20
Controls.Label { Controls.Label {
id: label id: label
text: "Press the button and make sure the popup is on the correct place" text: "Press the button and make sure the popup is on the correct place"
@ -46,7 +46,7 @@ ColumnLayout
id: menuColumn id: menuColumn
Layout.minimumWidth: menuColumn.implicitWidth Layout.minimumWidth: menuColumn.implicitWidth
Layout.minimumHeight: menuColumn.implicitHeight Layout.minimumHeight: menuColumn.implicitHeight
spacing: units.smallSpacing spacing: PlasmaCore.Units.smallSpacing
PlasmaExtras.Heading { PlasmaExtras.Heading {
level: 3 level: 3