Remove usage of context properties for theme and units

This commit is contained in:
Carson Black 2020-07-19 17:13:14 -04:00 committed by Nate Graham
parent 630e5c88e8
commit 6c627ea044
40 changed files with 138 additions and 133 deletions

View File

@ -64,7 +64,7 @@ MouseArea {
// this is needed here as the text is first rendered, counting with the default root.cellHeight
// then root.cellHeight actually changes to whatever it should be, but the Label does not pick
// it up after that, so we need to change it explicitly after the cell size changes
label.font.pixelSize = Math.max(theme.smallestFont.pixelSize, Math.floor(daysCalendar.cellHeight / 3))
label.font.pixelSize = Math.max(PlasmaCore.Theme.smallestFont.pixelSize, Math.floor(daysCalendar.cellHeight / 3))
}
Rectangle {
@ -79,8 +79,8 @@ MouseArea {
0
}
}
Behavior on opacity { NumberAnimation { duration: units.shortDuration*2 } }
color: theme.textColor
Behavior on opacity { NumberAnimation { duration: PlasmaCore.Units.shortDuration*2 } }
color: PlasmaCore.Theme.textColor
}
Rectangle {
@ -96,8 +96,8 @@ MouseArea {
}
}
visible: !today
Behavior on opacity { NumberAnimation { duration: units.shortDuration*2 } }
color: theme.highlightColor
Behavior on opacity { NumberAnimation { duration: PlasmaCore.Units.shortDuration*2 } }
color: PlasmaCore.Theme.highlightColor
z: todayRect.z - 1
}
@ -114,7 +114,7 @@ MouseArea {
id: label
anchors {
fill: todayRect
margins: units.smallSpacing
margins: PlasmaCore.Units.smallSpacing
}
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
@ -123,14 +123,14 @@ MouseArea {
wrapMode: Text.NoWrap
elide: Text.ElideRight
fontSizeMode: Text.HorizontalFit
font.pixelSize: Math.max(theme.smallestFont.pixelSize, Math.floor(daysCalendar.cellHeight / 3))
font.pixelSize: Math.max(PlasmaCore.Theme.smallestFont.pixelSize, Math.floor(daysCalendar.cellHeight / 3))
// Plasma component set point size, this code wants to set pixel size
// Setting both results in a warning
// -1 is an undocumented same as unset (see qquickvaluetypes)
font.pointSize: -1
color: today ? theme.backgroundColor : theme.textColor
color: today ? PlasmaCore.Theme.backgroundColor : PlasmaCore.Theme.textColor
Behavior on color {
ColorAnimation { duration: units.shortDuration * 2 }
ColorAnimation { duration: PlasmaCore.Units.shortDuration * 2 }
}
}
}

View File

@ -76,7 +76,7 @@ Item {
Behavior on scale {
id: scaleBehavior
ScaleAnimator {
duration: units.longDuration
duration: PlasmaCore.Units.longDuration
}
}
@ -93,7 +93,7 @@ Item {
left: canvas.left
right: canvas.right
}
spacing: units.smallSpacing
spacing: PlasmaCore.Units.smallSpacing
PlasmaExtras.Heading {
id: heading
@ -193,7 +193,7 @@ Item {
ctx.reset();
ctx.save();
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.strokeStyle = theme.textColor;
ctx.strokeStyle = PlasmaCore.Theme.textColor;
ctx.lineWidth = root.borderWidth
ctx.globalAlpha = 1.0;
@ -284,7 +284,7 @@ Item {
verticalAlignment: Text.AlignVCenter
opacity: 0.4
text: modelData
font.pixelSize: Math.max(theme.smallestFont.pixelSize, daysCalendar.cellHeight / 3)
font.pixelSize: Math.max(PlasmaCore.Theme.smallestFont.pixelSize, daysCalendar.cellHeight / 3)
}
}
}
@ -313,7 +313,7 @@ Item {
width: daysCalendar.cellWidth
height: daysCalendar.cellHeight
text: Qt.locale(Qt.locale().uiLanguages[0]).dayName(((calendarBackend.firstDayOfWeek + index) % days.count), Locale.ShortFormat)
font.pixelSize: Math.max(theme.smallestFont.pixelSize, daysCalendar.cellHeight / 3)
font.pixelSize: Math.max(PlasmaCore.Theme.smallestFont.pixelSize, daysCalendar.cellHeight / 3)
opacity: 0.4
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter

View File

@ -185,21 +185,21 @@ PinchArea {
pushTransition: StackViewTransition {
NumberAnimation {
target: exitItem
duration: units.longDuration
duration: PlasmaCore.Units.longDuration
property: "opacity"
from: 1
to: 0
}
NumberAnimation {
target: enterItem
duration: units.longDuration
duration: PlasmaCore.Units.longDuration
property: "opacity"
from: 0
to: 1
}
NumberAnimation {
target: enterItem
duration: units.longDuration
duration: PlasmaCore.Units.longDuration
property: "transformScale"
from: 1.5
to: 1
@ -208,21 +208,21 @@ PinchArea {
popTransition: StackViewTransition {
NumberAnimation {
target: exitItem
duration: units.longDuration
duration: PlasmaCore.Units.longDuration
property: "opacity"
from: 1
to: 0
}
NumberAnimation {
target: exitItem
duration: units.longDuration
duration: PlasmaCore.Units.longDuration
property: "transformScale"
// so no matter how much you scaled, it would still fly towards you
to: exitItem.transformScale * 1.5
}
NumberAnimation {
target: enterItem
duration: units.longDuration
duration: PlasmaCore.Units.longDuration
property: "opacity"
from: 0
to: 1

View File

@ -74,7 +74,7 @@ void CoreBindingsPlugin::registerTypes(const char *uri)
Q_ASSERT(uri == QByteArray("org.kde.plasma.core"));
qmlRegisterUncreatableType<Plasma::Types>(uri, 2, 0, "Types", {});
qmlRegisterUncreatableType<Units>(uri, 2, 0, "Units", {});
qmlRegisterSingletonType<Units>(uri, 2, 0, "Units", [=](QQmlEngine*, QJSEngine*) -> QObject* { return &Units::instance(); });
qmlRegisterType<Plasma::Svg>(uri, 2, 0, "Svg");
qmlRegisterType<Plasma::FrameSvg>(uri, 2, 0, "FrameSvg");
@ -82,7 +82,7 @@ void CoreBindingsPlugin::registerTypes(const char *uri)
qmlRegisterType<Plasma::FrameSvgItem>(uri, 2, 0, "FrameSvgItem");
//qmlRegisterType<ThemeProxy>(uri, 2, 0, "Theme");
qmlRegisterUncreatableType<Plasma::QuickTheme>(uri, 2, 0, "Theme", QStringLiteral("It is not possible to instantiate Theme directly."));
qmlRegisterSingletonType<Plasma::QuickTheme>(uri, 2, 0, "Theme", [=](QQmlEngine* engine, QJSEngine*) -> QObject* { return new Plasma::QuickTheme(engine); });
qmlRegisterType<ColorScope>(uri, 2, 0, "ColorScope");
qmlRegisterType<Plasma::DataSource>(uri, 2, 0, "DataSource");

View File

@ -49,7 +49,7 @@ QtControls.Button {
*
* See also Qt documentation for font type.
*/
property font font: theme.defaultFont
property font font: PlasmaCore.Theme.defaultFont
/*
* overrides iconsource for compatibility

View File

@ -80,7 +80,7 @@ Column {
*/
property Item checkedButton;
spacing: theme.defaultFont.pointSize
spacing: PlasmaCore.Theme.defaultFont.pointSize
Component.onCompleted: {
Behavior.create(root, {direction: Qt.Vertical});

View File

@ -76,7 +76,7 @@ Row {
*/
property Item checkedButton;
spacing: theme.defaultFont.pointSize
spacing: PlasmaCore.Theme.defaultFont.pointSize
Component.onCompleted: {
Behavior.create(root, {direction: Qt.Horizontal});

View File

@ -155,8 +155,8 @@ PlasmaComponents.Dialog {
PlasmaCore.IconItem {
id: titleAreaIcon
width: units.iconSizes.small
height: units.iconSizes.small
width: PlasmaCore.Units.iconSizes.small
height: PlasmaCore.Units.iconSizes.small
source: titleIcon
anchors.left: parent.left
anchors.rightMargin: 4

View File

@ -26,7 +26,7 @@ import org.kde.plasma.core 2.0 as PlasmaCore
* derivates)
*
* Provides built-in animation of Behavior on opacity Easing.OutQuad for a
* duration of 250 (defined in units.longDuration).
* duration of 250 (defined in PlasmaCore.Units.longDuration).
*
* (TODO, make optional? e.g. animate: false)
*
@ -57,7 +57,7 @@ Item {
Behavior on opacity {
NumberAnimation {
duration: units.longDuration
duration: PlasmaCore.Units.longDuration
easing.type: Easing.OutQuad
}
}
@ -77,7 +77,7 @@ Item {
Behavior on opacity {
NumberAnimation {
duration: units.longDuration
duration: PlasmaCore.Units.longDuration
easing.type: Easing.OutQuad
}
}

View File

@ -38,7 +38,7 @@ import org.kde.plasma.core 2.0 as PlasmaCore
Text {
id: root
height: Math.round(Math.max(paintedHeight, theme.mSize(theme.defaultFont).height*1.6))
height: Math.round(Math.max(paintedHeight, PlasmaCore.Theme.mSize(PlasmaCore.Theme.defaultFont).height*1.6))
verticalAlignment: lineCount > 1 ? Text.AlignTop : Text.AlignVCenter
activeFocusOnTab: false
@ -47,15 +47,15 @@ Text {
// https://bugreports.qt.io/browse/QTBUG-70481
renderType: QtQuickControlsPrivate.Settings.isMobile || Screen.devicePixelRatio % 1 !== 0 ? Text.QtRendering : Text.NativeRendering
font.capitalization: theme.defaultFont.capitalization
font.family: theme.defaultFont.family
font.italic: theme.defaultFont.italic
font.letterSpacing: theme.defaultFont.letterSpacing
font.pointSize: theme.defaultFont.pointSize
font.strikeout: theme.defaultFont.strikeout
font.underline: theme.defaultFont.underline
font.weight: theme.defaultFont.weight
font.wordSpacing: theme.defaultFont.wordSpacing
font.capitalization: PlasmaCore.Theme.defaultFont.capitalization
font.family: PlasmaCore.Theme.defaultFont.family
font.italic: PlasmaCore.Theme.defaultFont.italic
font.letterSpacing: PlasmaCore.Theme.defaultFont.letterSpacing
font.pointSize: PlasmaCore.Theme.defaultFont.pointSize
font.strikeout: PlasmaCore.Theme.defaultFont.strikeout
font.underline: PlasmaCore.Theme.defaultFont.underline
font.weight: PlasmaCore.Theme.defaultFont.weight
font.wordSpacing: PlasmaCore.Theme.defaultFont.wordSpacing
color: PlasmaCore.ColorScope.textColor
opacity: enabled? 1 : 0.6

View File

@ -85,7 +85,7 @@ Item {
/**
* Should page transitions be animated? Default is true.
*/
property bool animate: units.longDuration > 1
property bool animate: PlasmaCore.Units.longDuration > 1
/**
* The page to be automatically loaded when this PageStack component gets
@ -271,7 +271,7 @@ Item {
property int stackWidth: Math.max(root.width, root.height)
// Duration of transition animation (in ms)
property int transitionDuration: Math.max(1, units.longDuration / 2)
property int transitionDuration: Math.max(1, PlasmaCore.Units.longDuration / 2)
// Flag that indicates the container should be cleaned up after the transition has ended.
property bool cleanupAfterTransition: false

View File

@ -37,8 +37,8 @@ import QtQuick.Controls.Styles.Plasma 2.0 as Styles
* @inherit QtQuick.Controls.ProgressBar
*/
ProgressBar {
width: Math.floor(units.gridUnit * (orientation === Qt.Vertical ? 1.6 : 10))
height: Math.floor(units.gridUnit * (orientation === Qt.Vertical ? 10 : 1.6))
width: Math.floor(PlasmaCore.Units.gridUnit * (orientation === Qt.Vertical ? 1.6 : 10))
height: Math.floor(PlasmaCore.Units.gridUnit * (orientation === Qt.Vertical ? 10 : 1.6))
opacity: enabled ? 1.0 : 0.5
style: Styles.ProgressBarStyle {}

View File

@ -64,9 +64,9 @@ PlasmaComponents.CommonDialog {
}
content: Item {
implicitWidth: Math.max(theme.mSize(theme.defaultFont).width * 15, Math.min(label.implicitWidth+12, theme.mSize(theme.defaultFont).width * 25))
implicitWidth: Math.max(PlasmaCore.Theme.mSize(PlasmaCore.Theme.defaultFont).width * 15, Math.min(label.implicitWidth+12, PlasmaCore.Theme.mSize(PlasmaCore.Theme.defaultFont).width * 25))
implicitHeight: Math.min(theme.mSize(theme.defaultFont).height * 12, label.paintedHeight + 6)
implicitHeight: Math.min(PlasmaCore.Theme.mSize(PlasmaCore.Theme.defaultFont).height * 12, label.paintedHeight + 6)
width: implicitWidth

View File

@ -82,7 +82,7 @@ Item {
implicitWidth: scrollBar.implicitWidth
Behavior on opacity {
NumberAnimation {
duration: units.longDuration
duration: PlasmaCore.Units.longDuration
}
}
@ -140,7 +140,7 @@ Item {
opacity: sectionLabel.text && scrollBar.pressed ? 1 : 0
Behavior on opacity {
NumberAnimation {
duration: units.longDuration
duration: PlasmaCore.Units.longDuration
}
}
}

View File

@ -100,8 +100,8 @@ PlasmaComponents.CommonDialog {
content: Item {
id: contentItem
property alias filterText: filterField.filterText
implicitWidth: theme.mSize(theme.defaultFont).width * 40
implicitHeight: theme.mSize(theme.defaultFont).height * 12
implicitWidth: PlasmaCore.Theme.mSize(PlasmaCore.Theme.defaultFont).width * 40
implicitHeight: PlasmaCore.Theme.mSize(PlasmaCore.Theme.defaultFont).height * 12
height: implicitHeight
TextField {

View File

@ -191,8 +191,8 @@ Item {
mainItem: Item {
id: mainItem
width: theme.mSize(theme.defaultFont).width * 40
height: Math.max(titleBar.childrenRect.height + contentItem.childrenRect.height + buttonsRow.childrenRect.height + 8, theme.mSize(theme.defaultFont).height * 25)
width: PlasmaCore.Theme.mSize(PlasmaCore.Theme.defaultFont).width * 40
height: Math.max(titleBar.childrenRect.height + contentItem.childrenRect.height + buttonsRow.childrenRect.height + 8, PlasmaCore.Theme.mSize(PlasmaCore.Theme.defaultFont).height * 25)
// Consume all key events that are not processed by children
Keys.onPressed: event.accepted = true
@ -225,7 +225,7 @@ Item {
id: titleLabel
elide: Text.ElideRight
height: paintedHeight
font.pointSize: theme.defaultFont.pointSize * 1.1
font.pointSize: PlasmaCore.Theme.defaultFont.pointSize * 1.1
font.weight: Font.Bold
style: Text.Raised
styleColor: Qt.rgba(1,1,1,0.8)
@ -261,7 +261,7 @@ Item {
bottom: parent.bottom
horizontalCenter: parent.horizontalCenter
//the bottom margin is disabled but we want it anyways
bottomMargin: theme.mSize(theme.defaultFont).height*0.6
bottomMargin: PlasmaCore.Theme.mSize(PlasmaCore.Theme.defaultFont).height*0.6
}
PlasmaComponents.Button {

View File

@ -59,8 +59,8 @@ QtControls.Slider {
*/
property bool inverted: false
width: slider.isVertical ? theme.mSize(theme.defaultFont).height*1.6 : 200
height: slider.isVertical ? 200 : theme.mSize(theme.defaultFont).height*1.6
width: slider.isVertical ? PlasmaCore.Theme.mSize(PlasmaCore.Theme.defaultFont).height*1.6 : 200
height: slider.isVertical ? 200 : PlasmaCore.Theme.mSize(PlasmaCore.Theme.defaultFont).height*1.6
// TODO: needs to define if there will be specific graphics for
// disabled sliders
opacity: enabled ? 1.0 : 0.5

View File

@ -126,13 +126,13 @@ FocusScope {
Behavior on x {
PropertyAnimation {
easing.type: Easing.InQuad
duration: units.longDuration
duration: PlasmaCore.Units.longDuration
}
}
Behavior on y {
PropertyAnimation {
easing.type: Easing.InQuad
duration: units.longDuration
duration: PlasmaCore.Units.longDuration
}
}
}
@ -203,9 +203,9 @@ FocusScope {
buttonsLayout.width = buttonsLayout.implicitWidth
buttonsLayout.height = buttonsLayout.implicitHeight
tabBarLayout.width = (tabBarLayout.implicitWidth - tabbarScroller.width <= units.gridUnit * 4) ? tabbarScroller.width : tabBarLayout.implicitWidth;
tabBarLayout.width = (tabBarLayout.implicitWidth - tabbarScroller.width <= PlasmaCore.Units.gridUnit * 4) ? tabbarScroller.width : tabBarLayout.implicitWidth;
} else {
tabBarLayout.width = units.gridUnit * 5;
tabBarLayout.width = PlasmaCore.Units.gridUnit * 5;
}
}
function syncHeight() {
@ -213,9 +213,9 @@ FocusScope {
buttonsLayout.width = buttonsLayout.implicitWidth
buttonsLayout.height = buttonsLayout.implicitHeight
tabBarLayout.height = (tabBarLayout.implicitHeight - tabbarScroller.height <= units.gridUnit * 4) ? tabbarScroller.height : tabBarLayout.implicitHeight;
tabBarLayout.height = (tabBarLayout.implicitHeight - tabbarScroller.height <= PlasmaCore.Units.gridUnit * 4) ? tabbarScroller.height : tabBarLayout.implicitHeight;
} else {
tabBarLayout.height = units.gridUnit * 5;
tabBarLayout.height = PlasmaCore.Units.gridUnit * 5;
}
}
@ -243,13 +243,13 @@ FocusScope {
Behavior on x {
NumberAnimation {
duration: units.longDuration
duration: PlasmaCore.Units.longDuration
easing.type: Easing.InOutQuad
}
}
Behavior on y {
NumberAnimation {
duration: units.longDuration
duration: PlasmaCore.Units.longDuration
easing.type: Easing.InOutQuad
}
}

View File

@ -94,8 +94,8 @@ Item {
Accessible.checked: checked
Accessible.name: text
implicitWidth: Math.max(label.implicitWidth + (internal.portrait ? 0 : (iconSource != null ? units.iconSizes.small : 0)), height)
implicitHeight: 20//label.implicitHeight + (internal.portrait ? (iconSource != null ? units.iconSizes.small : 0) : 0)
implicitWidth: Math.max(label.implicitWidth + (internal.portrait ? 0 : (iconSource != null ? PlasmaCore.Units.iconSizes.small : 0)), height)
implicitHeight: 20//label.implicitHeight + (internal.portrait ? (iconSource != null ? PlasmaCore.Units.iconSizes.small : 0) : 0)
opacity: enabled ? 1 : 0.6
//long notation to not make it overwritten by implementations
@ -122,7 +122,7 @@ Item {
property Item tabBar: Utils.findParent(root, "currentTab")
property Item tabGroup: Utils.findParent(tab, "currentTab")
property bool portrait: (root != undefined) && (label != undefined) && label.text != "" && root.height >= label.paintedHeight + units.iconSizes.small
property bool portrait: (root != undefined) && (label != undefined) && label.text != "" && root.height >= label.paintedHeight + PlasmaCore.Units.iconSizes.small
function click() {
root.clicked()
@ -152,7 +152,7 @@ Item {
colorGroup: PlasmaCore.ColorScope.colorGroup
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
implicitWidth: internal.portrait ? Math.max(units.iconSizes.small, root.height - (label.text ? label.height : 0)) : Math.max(units.iconSizes.small, root.height)
implicitWidth: internal.portrait ? Math.max(PlasmaCore.Units.iconSizes.small, root.height - (label.text ? label.height : 0)) : Math.max(PlasmaCore.Units.iconSizes.small, root.height)
implicitHeight: implicitWidth
}

View File

@ -213,11 +213,11 @@ FocusScope {
ParallelAnimation {
OpacityAnimator {
easing.type: Easing.InQuad
duration: units.longDuration
duration: PlasmaCore.Units.longDuration
}
XAnimator {
easing.type: Easing.InQuad
duration: units.longDuration
duration: PlasmaCore.Units.longDuration
}
}
ScriptAction { script: {incomingDone(); root.clip = false} }
@ -230,11 +230,11 @@ FocusScope {
ParallelAnimation {
OpacityAnimator {
easing.type: Easing.InQuad
duration: units.longDuration
duration: PlasmaCore.Units.longDuration
}
XAnimator {
easing.type: Easing.InQuad
duration: units.longDuration
duration: PlasmaCore.Units.longDuration
}
}
ScriptAction { script: outgoingDone() }

View File

@ -72,15 +72,15 @@ QtControls.TextArea {
// Overriding QtQuick.Item activeFocus property.
//property alias activeFocus: textEdit.activeFocus
implicitWidth: theme.mSize(theme.defaultFont).width*25 + style.textMargin
implicitHeight: theme.mSize(theme.defaultFont).height*8 + style.textMargin
implicitWidth: PlasmaCore.Theme.mSize(PlasmaCore.Theme.defaultFont).width*25 + style.textMargin
implicitHeight: PlasmaCore.Theme.mSize(PlasmaCore.Theme.defaultFont).height*8 + style.textMargin
Label {
anchors.centerIn: parent
width: Math.min(implicitWidth, parent.width)
text: textArea.placeholderText
visible: textArea.text == "" && !textArea.activeFocus
color: theme.viewTextColor
color: PlasmaCore.Theme.viewTextColor
horizontalAlignment: Text.AlignHCenter
opacity: 0.5
}

View File

@ -94,13 +94,13 @@ QtControls.TextField {
PlasmaCore.IconItem {
id: showPasswordButton
source: __effectiveRevealPasswordButtonShown ? (textField.echoMode === TextInput.Normal ? "visibility": "hint") : ""
height: Math.max(textField.height * 0.8, units.iconSizes.small)
height: Math.max(textField.height * 0.8, PlasmaCore.Units.iconSizes.small)
width: height
opacity: (__effectiveRevealPasswordButtonShown && textField.enabled) ? 1 : 0
visible: opacity > 0
Behavior on opacity {
NumberAnimation {
duration: units.longDuration
duration: PlasmaCore.Units.longDuration
easing.type: Easing.InOutQuad
}
}
@ -118,13 +118,13 @@ QtControls.TextField {
id: clearButton
//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") : ""
height: Math.max(textField.height * 0.8, units.iconSizes.small)
height: Math.max(textField.height * 0.8, PlasmaCore.Units.iconSizes.small)
width: height
opacity: (textField.length > 0 && clearButtonShown && textField.enabled) ? 1 : 0
visible: opacity > 0
Behavior on opacity {
NumberAnimation {
duration: units.longDuration
duration: PlasmaCore.Units.longDuration
easing.type: Easing.InOutQuad
}
}

View File

@ -40,7 +40,7 @@ Item{
Behavior on height {
PropertyAnimation {
id: heightAnimation
duration: units.longDuration
duration: PlasmaCore.Units.longDuration
}
}
z: 1000
@ -201,19 +201,19 @@ Item{
Behavior on opacity {
PropertyAnimation {
id: containerAOpacityAnimation
duration: units.longDuration
duration: PlasmaCore.Units.longDuration
}
}
Behavior on x {
enabled: containerA.animationsEnabled
PropertyAnimation {
duration: units.longDuration
duration: PlasmaCore.Units.longDuration
}
}
Behavior on y {
enabled: containerA.animationsEnabled
PropertyAnimation {
duration: units.longDuration
duration: PlasmaCore.Units.longDuration
}
}
}
@ -223,18 +223,18 @@ Item{
height: parent.height
opacity: 0
Behavior on opacity {
PropertyAnimation { duration: units.longDuration }
PropertyAnimation { duration: PlasmaCore.Units.longDuration }
}
Behavior on x {
enabled: containerA.animationsEnabled
PropertyAnimation {
duration: units.longDuration
duration: PlasmaCore.Units.longDuration
}
}
Behavior on y {
enabled: containerA.animationsEnabled
PropertyAnimation {
duration: units.longDuration
duration: PlasmaCore.Units.longDuration
}
}
}

View File

@ -40,7 +40,7 @@ QtControls.ToolButton {
*
* See also Qt documentation for font type.
*/
property font font: theme.defaultFont
property font font: PlasmaCore.Theme.defaultFont
/*
* overrides iconsource for compatibility

View File

@ -58,7 +58,7 @@ Item {
property alias shadow: shadowLoader.sourceComponent
width: surfaceLoader.width + label.paintedWidth
height: theme.mSize(theme.defaultFont).height*1.6
height: PlasmaCore.Theme.mSize(PlasmaCore.Theme.defaultFont).height*1.6
// TODO: needs to define if there will be specific graphics for
// disabled buttons
opacity: dualButton.enabled ? 1.0 : 0.5
@ -108,7 +108,7 @@ Item {
//FIXME: see how this margin will be set
leftMargin: height/4
}
color: theme.textColor
color: PlasmaCore.Theme.textColor
verticalAlignment: Text.AlignVCenter
}

View File

@ -47,7 +47,7 @@ Item {
SequentialAnimation {
id: appearAnimation
NumberAnimation {
duration: units.longDuration
duration: PlasmaCore.Units.longDuration
easing.type: Easing.InOutQuad
target: dismissArea
properties: "opacity"
@ -71,7 +71,7 @@ Item {
PlasmaExtras.FallbackComponent {
id: fallbackComponent
basePath: "desktoptheme"
candidates: [theme.themeName, "default"]
candidates: [PlasmaCore.Theme.themeName, "default"]
property string svgPath: fallbackComponent.filePath("/dialogs/background.svgz")
}
Connections {

View File

@ -34,7 +34,7 @@ PlasmaCore.FrameSvgItem {
opacity: 0
Behavior on opacity {
NumberAnimation {
duration: units.longDuration
duration: PlasmaCore.Units.longDuration
easing.type: Easing.OutQuad
}
}

View File

@ -181,8 +181,8 @@ Item {
priv.tabBar = Utils.findParent(root, "currentTab")
var childCount = root.children.length
var visibleChildCount = childCount
var contentWidth = theme.mSize(theme.defaultFont).width * 3
var contentHeight = theme.mSize(theme.defaultFont).height * 2
var contentWidth = PlasmaCore.Theme.mSize(PlasmaCore.Theme.defaultFont).width * 3
var contentHeight = PlasmaCore.Theme.mSize(PlasmaCore.Theme.defaultFont).height * 2
var maxChildSize = 0
if (childCount != 0) {
//not too much efficient but the loop over children needs to be done two times to get the proper child width
@ -192,7 +192,7 @@ Item {
}
}
var maxAllowedSize = theme.mSize(theme.defaultFont).width * 24
var maxAllowedSize = PlasmaCore.Theme.mSize(PlasmaCore.Theme.defaultFont).width * 24
var itemWidth = Math.min(maxAllowedSize, (root.width - (visibleChildCount-1)*10) / visibleChildCount)
var itemHeight = Math.min(maxAllowedSize, (root.height - (visibleChildCount-1)*10) / visibleChildCount)

View File

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

View File

@ -122,7 +122,7 @@ Item {
clip: true
width: navigationWidth + space
Behavior on width {
NumberAnimation { duration: units.longDuration; easing.type: Easing.InOutExpo; }
NumberAnimation { duration: PlasmaCore.Units.longDuration; easing.type: Easing.InOutExpo; }
}
Item {

View File

@ -57,8 +57,8 @@ import org.kde.plasma.extras 2.0 as PlasmaExtras
* clip: true
* model: myModel
* highlight: PlasmaComponents.Highlight {}
* highlightMoveDuration: units.longDuration
* highlightResizeDuration: units.longDuration
* highlightMoveDuration: PlasmaCore.Units.longDuration
* highlightResizeDuration: PlasmaCore.Units.longDuration
* delegate: PlasmaExtras.ExpandableListItem {
* icon: model.iconName
* iconEmblem: model.isPaused ? "emblem-pause" : ""
@ -377,7 +377,7 @@ Item {
id: mainRowLayout
Layout.fillWidth: true
Layout.margins: units.smallSpacing
Layout.margins: PlasmaCore.Units.smallSpacing
// Otherwise it becomes taller when the button appears
Layout.minimumHeight: defaultActionButton.height
@ -387,8 +387,8 @@ Item {
usesPlasmaTheme: listItem.iconUsesPlasmaSVG
implicitWidth: units.iconSizes.medium
implicitHeight: units.iconSizes.medium
implicitWidth: PlasmaCore.Units.iconSizes.medium
implicitHeight: PlasmaCore.Units.iconSizes.medium
PlasmaCore.IconItem {
id: iconEmblem
@ -398,8 +398,8 @@ Item {
anchors.right: parent.right
anchors.bottom: parent.bottom
implicitWidth: units.iconSizes.small
implicitHeight: units.iconSizes.small
implicitWidth: PlasmaCore.Units.iconSizes.small
implicitHeight: PlasmaCore.Units.iconSizes.small
}
}
@ -436,7 +436,7 @@ Item {
enabled: false
visible: text.length > 0
font: theme.smallestFont
font: PlasmaCore.Theme.smallestFont
Layout.fillWidth: true
@ -491,11 +491,11 @@ Item {
sourceComponent: customExpandedViewContent
Layout.fillWidth: true
Layout.margins: units.smallSpacing
Layout.margins: PlasmaCore.Units.smallSpacing
Behavior on opacity {
NumberAnimation {
duration: units.veryLongDuration
duration: PlasmaCore.Units.veryLongDuration
easing.type: Easing.InOutCubic
}
}
@ -521,10 +521,10 @@ Item {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: listItemIcon.width + units.smallSpacing
anchors.rightMargin: listItemIcon.width + units.smallSpacing * 2
anchors.leftMargin: listItemIcon.width + PlasmaCore.Units.smallSpacing
anchors.rightMargin: listItemIcon.width + PlasmaCore.Units.smallSpacing * 2
height: (units.iconSizes.smallMedium + units.smallSpacing * 2) * actionsList.count
height: (PlasmaCore.Units.iconSizes.smallMedium + PlasmaCore.Units.smallSpacing * 2) * actionsList.count
focus: true
clip: true
@ -539,7 +539,7 @@ Item {
enabled: model.enabled
width: actionsList.width
height: actionItemLayout.height + units.smallSpacing * 2
height: actionItemLayout.height + PlasmaCore.Units.smallSpacing * 2
hoverEnabled: true
@ -556,14 +556,14 @@ Item {
enabled: model.enabled
anchors.left: parent.left
anchors.leftMargin: units.smallSpacing
anchors.leftMargin: PlasmaCore.Units.smallSpacing
anchors.right: parent.right
anchors.rightMargin: units.smallSpacing
anchors.rightMargin: PlasmaCore.Units.smallSpacing
anchors.verticalCenter: parent.verticalCenter
PlasmaCore.IconItem {
implicitWidth: units.iconSizes.smallMedium
implicitHeight: units.iconSizes.smallMedium
implicitWidth: PlasmaCore.Units.iconSizes.smallMedium
implicitHeight: PlasmaCore.Units.iconSizes.smallMedium
source: model.icon.name
}

View File

@ -65,7 +65,7 @@ Label {
wrapMode: Text.WordWrap
function headerPointSize(l) {
var n = theme.defaultFont.pointSize;
var n = PlasmaCore.Theme.defaultFont.pointSize;
var s;
switch (l) {
case 1:

View File

@ -61,7 +61,7 @@ Item {
property ToolBar toolBar
property variant initialPage
//A column is wide enough for 30 characters
property int columnWidth: Math.round(parent.width/(theme.mSize(theme.defaultFont).width*30)) > 0 ? parent.width/Math.round(parent.width/(theme.mSize(theme.defaultFont).width*30)) : width
property int columnWidth: Math.round(parent.width/(PlasmaCore.Theme.mSize(PlasmaCore.Theme.defaultFont).width*30)) > 0 ? parent.width/Math.round(parent.width/(PlasmaCore.Theme.mSize(PlasmaCore.Theme.defaultFont).width*30)) : width
property alias clip: scrollArea.clip
// Indicates whether there is an ongoing page transition.
@ -181,7 +181,7 @@ Item {
property bool completed: false
// Duration of transition animation (in ms)
property int transitionDuration: units.longDuration
property int transitionDuration: PlasmaCore.Units.longDuration
// Sets the page status.
function setPageStatus(page, status)

View File

@ -40,6 +40,7 @@ import org.kde.plasma.extras 2.0 as PlasmaExtras
** Shows how to use PlaceholderMessage to implement a "this view is empty" message
* import QtQuick 2.12
* import org.kde.plasma.extras 2.0 as PlasmaExtras
* import org.kde.plasma.core 2.0 as PlasmaCore
*
* ListView {
* id: listView
@ -48,7 +49,7 @@ import org.kde.plasma.extras 2.0 as PlasmaExtras
*
* PlasmaExtras.PlaceholderMessage {
* anchors.centerIn: parent
* width: parent.width - (units.largeSpacing * 4)
* width: parent.width - (PlasmaCore.Units.largeSpacing * 4)
*
* visible: listView.count == 0
*
@ -61,6 +62,7 @@ import org.kde.plasma.extras 2.0 as PlasmaExtras
* import QtQuick 2.12
* import QtQuick.Controls 2.12 as QQC2
* import org.kde.plasma.extras 2.0 as PlasmaExtras
* import org.kde.plasma.core 2.0 as PlasmaCore
*
* ListView {
* id: listView
@ -69,7 +71,7 @@ import org.kde.plasma.extras 2.0 as PlasmaExtras
*
* PlasmaExtras.PlaceholderMessage {
* anchors.centerIn: parent
* width: parent.width - (units.largeSpacing * 4)
* width: parent.width - (PlasmaCore.Units.largeSpacing * 4)
*
* visible: listView.count == 0
*
@ -90,6 +92,7 @@ import org.kde.plasma.extras 2.0 as PlasmaExtras
** Shows how to use PlaceholderMessage to implement a "there was a problem here" message
* import org.kde.plasma.components 3.0 as PlasmaComponents3
* import org.kde.plasma.extras 2.0 as PlasmaExtras
* import org.kde.plasma.core 2.0 as PlasmaCore
*
* PlasmaComponents3.Page {
* id: root
@ -97,7 +100,7 @@ import org.kde.plasma.extras 2.0 as PlasmaExtras
*
* PlasmaExtras.PlaceholderMessage {
* anchors.centerIn: parent
* width: parent.width - (units.largeSpacing * 4)
* width: parent.width - (PlasmaCore.Units.largeSpacing * 4)
*
* visible: root.networkConnected
*
@ -109,6 +112,7 @@ import org.kde.plasma.extras 2.0 as PlasmaExtras
* @code{.qml}
* import org.kde.plasma.components 3.0 as PlasmaComponents3
* import org.kde.plasma.extras 2.0 as PlasmaExtras
* import org.kde.plasma.core 2.0 as PlasmaCore
*
** Shows how to use PlaceholderMessage to implement a loading indicator
* PlasmaComponents3.Page {
@ -118,7 +122,7 @@ import org.kde.plasma.extras 2.0 as PlasmaExtras
*
* PlasmaExtras.PlaceholderMessage {
* anchors.centerIn: parent
* width: parent.width - (units.largeSpacing * 4)
* width: parent.width - (PlasmaCore.Units.largeSpacing * 4)
*
* visible: root.loading
*
@ -126,7 +130,7 @@ import org.kde.plasma.extras 2.0 as PlasmaExtras
* text: "Loading this awesome app"
*
* PlasmaComponents3.ProgressBar {
* Layout.preferredWidth: units.gridUnit * 20
* Layout.preferredWidth: PlasmaCore.Units.gridUnit * 20
* value: root.completionStatus
* from: 0
* to: 100
@ -138,6 +142,7 @@ import org.kde.plasma.extras 2.0 as PlasmaExtras
* import QtQuick.Controls 2.12 as QQC2
* import org.kde.plasma.components 3.0 as PlasmaComponents3
* import org.kde.plasma.extras 2.0 as PlasmaExtras
* import org.kde.plasma.core 2.0 as PlasmaCore
*
** Shows how to use PlaceholderMessage to implement a "Here's what you do next" button
* PlasmaComponents3.Page {
@ -145,7 +150,7 @@ import org.kde.plasma.extras 2.0 as PlasmaExtras
*
* PlasmaExtras.PlaceholderMessage {
* anchors.centerIn: parent
* width: parent.width - (units.largeSpacing * 4)
* width: parent.width - (PlasmaCore.Units.largeSpacing * 4)
*
* visible: root.loading
*
@ -199,15 +204,15 @@ ColumnLayout {
*/
property alias helpfulAction: actionButton.action
spacing: units.largeSpacing
spacing: PlasmaCore.Units.largeSpacing
PlasmaCore.IconItem {
visible: source != undefined
opacity: 0.5
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: units.iconSizes.huge
Layout.preferredHeight: units.iconSizes.huge
Layout.preferredWidth: PlasmaCore.Units.iconSizes.huge
Layout.preferredHeight: PlasmaCore.Units.iconSizes.huge
source: root.iconName || null
}

View File

@ -44,5 +44,5 @@ import org.kde.plasma.components 2.0
Label {
id: root
// Match size of level 1 Heading
font.pointSize: Math.round(theme.defaultFont.pointSize * 1.50)
font.pointSize: Math.round(PlasmaCore.Theme.defaultFont.pointSize * 1.50)
}

View File

@ -26,7 +26,7 @@ SequentialAnimation {
objectName: "activateAnimation"
property Item targetItem
property int duration: units.shortDuration
property int duration: PlasmaCore.Units.shortDuration
// Fast scaling while we're animation == more FPS
ScriptAction { script: targetItem.smooth = false }

View File

@ -25,7 +25,7 @@ SequentialAnimation {
objectName: "appearAnimation"
property Item targetItem
property int duration: units.longDuration
property int duration: PlasmaCore.Units.longDuration
// Animators run on the render thread so they kick in slightly delayed
// so explicitly set the item's opacity to 0 before starting the animation

View File

@ -25,7 +25,7 @@ SequentialAnimation {
objectName: "disappearAnimation"
property Item targetItem
property int duration: units.longDuration
property int duration: PlasmaCore.Units.longDuration
ParallelAnimation {
OpacityAnimator {

View File

@ -26,7 +26,7 @@ SequentialAnimation {
objectName: "pressedAnimation"
property Item targetItem
property int duration: units.shortDuration
property int duration: PlasmaCore.Units.shortDuration
// Fast scaling while we're animation == more FPS
ScriptAction { script: targetItem.smooth = false }

View File

@ -26,7 +26,7 @@ SequentialAnimation {
objectName: "releasedAnimation"
property Item targetItem
property int duration: units.shortDuration
property int duration: PlasmaCore.Units.shortDuration
// Fast scaling while we're animation == more FPS
ScriptAction { script: targetItem.smooth = false }