diff --git a/src/declarativeimports/core/theme.h b/src/declarativeimports/core/theme.h index 81027716a..90b753611 100644 --- a/src/declarativeimports/core/theme.h +++ b/src/declarativeimports/core/theme.h @@ -96,7 +96,7 @@ public: /** * @return The size of an uppercase M in a font, defaultFont() by default */ - QSizeF mSize(const QFont &font = QApplication::font()) const; + Q_INVOKABLE QSizeF mSize(const QFont &font = QApplication::font()) const; bool windowTranslucencyEnabled() const; KUrl homepage() const; diff --git a/src/declarativeimports/plasmacomponents/platformcomponents/touch/Menu.qml b/src/declarativeimports/plasmacomponents/platformcomponents/touch/Menu.qml index 699c78b5e..38dc2c4dc 100644 --- a/src/declarativeimports/plasmacomponents/platformcomponents/touch/Menu.qml +++ b/src/declarativeimports/plasmacomponents/platformcomponents/touch/Menu.qml @@ -96,8 +96,8 @@ Item { mainItem: Item { id: contentItem - width: Math.max(menuColumn.width, theme.defaultFont.mSize.width * 12) - height: Math.min(menuColumn.height, theme.defaultFont.mSize.height * 25) + width: Math.max(menuColumn.width, theme.mSize(theme.defaultFont).width * 12) + height: Math.min(menuColumn.height, theme.mSize(theme.defaultFont).height * 25) diff --git a/src/declarativeimports/plasmacomponents/platformcomponents/touch/TextField.qml b/src/declarativeimports/plasmacomponents/platformcomponents/touch/TextField.qml index 5d01b1971..966fbd4bf 100644 --- a/src/declarativeimports/plasmacomponents/platformcomponents/touch/TextField.qml +++ b/src/declarativeimports/plasmacomponents/platformcomponents/touch/TextField.qml @@ -91,8 +91,8 @@ Item { property alias activeFocus: textInput.activeFocus // TODO: fix default size - implicitWidth: theme.defaultFont.mSize.width*12 - implicitHeight: theme.defaultFont.mSize.height*1.6 + implicitWidth: theme.mSize(theme.defaultFont).width*12 + implicitHeight: theme.mSize(theme.defaultFont).height*1.6 // TODO: needs to define if there will be specific graphics for // disabled text fields opacity: enabled ? 1.0 : 0.5 diff --git a/src/declarativeimports/plasmacomponents/qml/Button.qml b/src/declarativeimports/plasmacomponents/qml/Button.qml index 56e07d428..c960c0de6 100644 --- a/src/declarativeimports/plasmacomponents/qml/Button.qml +++ b/src/declarativeimports/plasmacomponents/qml/Button.qml @@ -110,11 +110,11 @@ Item { if (label.text.length == 0) { height; } else { - Math.max(theme.defaultFont.mSize.width*12, minimumWidth); + Math.max(theme.mSize(theme.defaultFont).width*12, minimumWidth); } } - implicitHeight: Math.max(theme.defaultFont.mSize.height*1.6, minimumHeight) + implicitHeight: Math.max(theme.mSize(theme.defaultFont).height*1.6, minimumHeight) // TODO: needs to define if there will be specific graphics for // disabled buttons diff --git a/src/declarativeimports/plasmacomponents/qml/CheckBox.qml b/src/declarativeimports/plasmacomponents/qml/CheckBox.qml index 0ac902bfb..318b63c20 100644 --- a/src/declarativeimports/plasmacomponents/qml/CheckBox.qml +++ b/src/declarativeimports/plasmacomponents/qml/CheckBox.qml @@ -39,8 +39,8 @@ Private.DualStateButton { view: PlasmaCore.FrameSvgItem { imagePath: "widgets/button" prefix: "normal" - width: theme.defaultFont.mSize.height + margins.left - height: theme.defaultFont.mSize.height + margins.top + width: theme.mSize(theme.defaultFont).height + margins.left + height: theme.mSize(theme.defaultFont).height + margins.top PlasmaCore.SvgItem { svg: PlasmaCore.Svg { diff --git a/src/declarativeimports/plasmacomponents/qml/Dialog.qml b/src/declarativeimports/plasmacomponents/qml/Dialog.qml index 0f2ace5e4..93edf26bf 100644 --- a/src/declarativeimports/plasmacomponents/qml/Dialog.qml +++ b/src/declarativeimports/plasmacomponents/qml/Dialog.qml @@ -293,7 +293,7 @@ Item { Item { id: dialogLayout - width: Math.max(buttonItem.childrenRect.width, Math.min(contentItem.childrenRect.width, theme.defaultFont.mSize.width * 30)) + width: Math.max(buttonItem.childrenRect.width, Math.min(contentItem.childrenRect.width, theme.mSize(theme.defaultFont).width * 30)) height: titleBar.height + contentItem.childrenRect.height + buttonItem.childrenRect.height + 10 parent: internalLoader.dialog ? internalLoader.dialog : internalLoader.inlineDialog diff --git a/src/declarativeimports/plasmacomponents/qml/Label.qml b/src/declarativeimports/plasmacomponents/qml/Label.qml index 1d80d7855..9d65bb49f 100644 --- a/src/declarativeimports/plasmacomponents/qml/Label.qml +++ b/src/declarativeimports/plasmacomponents/qml/Label.qml @@ -33,7 +33,7 @@ import org.kde.plasma.core 0.1 as PlasmaCore Text { id: root - height: Math.max(paintedHeight, theme.defaultFont.mSize.height*1.6) + height: Math.max(paintedHeight, theme.mSize(theme.defaultFont).height*1.6) verticalAlignment: lineCount > 1 ? Text.AlignTop : Text.AlignVCenter font.capitalization: theme.defaultFont.capitalization diff --git a/src/declarativeimports/plasmacomponents/qml/QueryDialog.qml b/src/declarativeimports/plasmacomponents/qml/QueryDialog.qml index 42630487a..98c705e80 100644 --- a/src/declarativeimports/plasmacomponents/qml/QueryDialog.qml +++ b/src/declarativeimports/plasmacomponents/qml/QueryDialog.qml @@ -64,9 +64,9 @@ PlasmaComponents.CommonDialog { } content: Item { - implicitWidth: Math.max(theme.defaultFont.mSize.width * 15, Math.min(label.implicitWidth+12, theme.defaultFont.mSize.width * 25)) + implicitWidth: Math.max(theme.mSize(theme.defaultFont).width * 15, Math.min(label.implicitWidth+12, theme.mSize(theme.defaultFont).width * 25)) - implicitHeight: Math.min(theme.defaultFont.mSize.height * 12, label.paintedHeight + 6) + implicitHeight: Math.min(theme.mSize(theme.defaultFont).height * 12, label.paintedHeight + 6) width: implicitWidth diff --git a/src/declarativeimports/plasmacomponents/qml/RadioButton.qml b/src/declarativeimports/plasmacomponents/qml/RadioButton.qml index b1da4028e..fbe87b68e 100644 --- a/src/declarativeimports/plasmacomponents/qml/RadioButton.qml +++ b/src/declarativeimports/plasmacomponents/qml/RadioButton.qml @@ -39,7 +39,7 @@ Private.DualStateButton { imagePath: "widgets/actionbutton" } elementId: "normal" - width: theme.defaultFont.mSize.height + 6 + width: theme.mSize(theme.defaultFont).height + 6 height: width PlasmaCore.SvgItem { diff --git a/src/declarativeimports/plasmacomponents/qml/SelectionDialog.qml b/src/declarativeimports/plasmacomponents/qml/SelectionDialog.qml index 95a3f51d4..c29ad9ba1 100644 --- a/src/declarativeimports/plasmacomponents/qml/SelectionDialog.qml +++ b/src/declarativeimports/plasmacomponents/qml/SelectionDialog.qml @@ -100,8 +100,8 @@ PlasmaComponents.CommonDialog { content: Item { id: contentItem property alias filterText: filterField.filterText - implicitWidth: theme.defaultFont.mSize.width * 40 - implicitHeight: theme.defaultFont.mSize.height * 12 + implicitWidth: theme.mSize(theme.defaultFont).width * 40 + implicitHeight: theme.mSize(theme.defaultFont).height * 12 height: implicitHeight TextField { diff --git a/src/declarativeimports/plasmacomponents/qml/Sheet.qml b/src/declarativeimports/plasmacomponents/qml/Sheet.qml index ca74e6a40..0e256824b 100644 --- a/src/declarativeimports/plasmacomponents/qml/Sheet.qml +++ b/src/declarativeimports/plasmacomponents/qml/Sheet.qml @@ -193,8 +193,8 @@ Item { mainItem: Item { id: mainItem - width: theme.defaultFont.mSize.width * 40 - height: Math.max(titleBar.childrenRect.height + contentItem.childrenRect.height + buttonsRow.childrenRect.height + 8, theme.defaultFont.mSize.height * 25) + 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) // Consume all key events that are not processed by children Keys.onPressed: event.accepted = true @@ -263,7 +263,7 @@ Item { bottom: parent.bottom horizontalCenter: parent.horizontalCenter //the bottom margin is disabled but we want it anyways - bottomMargin: theme.defaultFont.mSize.height*0.6 + bottomMargin: theme.mSize(theme.defaultFont).height*0.6 } PlasmaComponents.Button { diff --git a/src/declarativeimports/plasmacomponents/qml/Slider.qml b/src/declarativeimports/plasmacomponents/qml/Slider.qml index b1db3d55f..1e1a109c7 100644 --- a/src/declarativeimports/plasmacomponents/qml/Slider.qml +++ b/src/declarativeimports/plasmacomponents/qml/Slider.qml @@ -104,8 +104,8 @@ Item { */ property alias inverted: range.inverted - width: contents.isVertical ? theme.defaultFont.mSize.height*1.6 : 200 - height: contents.isVertical ? 200 : theme.defaultFont.mSize.height*1.6 + width: contents.isVertical ? theme.mSize(theme.defaultFont).height*1.6 : 200 + height: contents.isVertical ? 200 : theme.mSize(theme.defaultFont).height*1.6 // TODO: needs to define if there will be specific graphics for // disabled sliders opacity: enabled ? 1.0 : 0.5 diff --git a/src/declarativeimports/plasmacomponents/qml/Switch.qml b/src/declarativeimports/plasmacomponents/qml/Switch.qml index d4630f92d..2743f529e 100644 --- a/src/declarativeimports/plasmacomponents/qml/Switch.qml +++ b/src/declarativeimports/plasmacomponents/qml/Switch.qml @@ -39,7 +39,7 @@ Private.DualStateButton { imagePath: "widgets/slider" prefix: "groove" width: height * 2 - height: Math.max(theme.defaultFont.mSize.height + margins.top + margins.bottom, + height: Math.max(theme.mSize(theme.defaultFont).height + margins.top + margins.bottom, button.margins.top + button.margins.bottom) PlasmaCore.FrameSvgItem { diff --git a/src/declarativeimports/plasmacomponents/qml/TabBar.qml b/src/declarativeimports/plasmacomponents/qml/TabBar.qml index 85ef14da3..8a3f70074 100644 --- a/src/declarativeimports/plasmacomponents/qml/TabBar.qml +++ b/src/declarativeimports/plasmacomponents/qml/TabBar.qml @@ -161,7 +161,7 @@ FocusScope { Private.TabBarLayout { id: tabBarLayout //A bit of snap before scrolling the layout - width: (implicitWidth - parent.width < theme.defaultFont.mSize.width*4) ? parent.width : implicitWidth + width: (implicitWidth - parent.width < theme.mSize(theme.defaultFont).width*4) ? parent.width : implicitWidth anchors { top: parent.top bottom: parent.bottom diff --git a/src/declarativeimports/plasmacomponents/qml/TabButton.qml b/src/declarativeimports/plasmacomponents/qml/TabButton.qml index 062530f2c..8a00edb93 100644 --- a/src/declarativeimports/plasmacomponents/qml/TabButton.qml +++ b/src/declarativeimports/plasmacomponents/qml/TabButton.qml @@ -137,7 +137,7 @@ Item { anchors { top: internal.portrait && iconSource != null ? imageLoader.bottom : parent.top left: internal.portrait || iconSource == null ? parent.left : imageLoader.right - leftMargin: iconSource == null ? 0 : theme.defaultFont.mSize.width + leftMargin: iconSource == null ? 0 : theme.mSize(theme.defaultFont).width right: parent.right bottom: parent.bottom } diff --git a/src/declarativeimports/plasmacomponents/qml/TextField.qml b/src/declarativeimports/plasmacomponents/qml/TextField.qml index e790eadad..b581cf680 100644 --- a/src/declarativeimports/plasmacomponents/qml/TextField.qml +++ b/src/declarativeimports/plasmacomponents/qml/TextField.qml @@ -273,8 +273,8 @@ FocusScope { //property alias activeFocus: textInput.activeFocus // TODO: fix default size - implicitWidth: theme.defaultFont.mSize.width*12 + base.internalPadding*2 - implicitHeight: theme.defaultFont.mSize.height + base.internalPadding*2 + implicitWidth: theme.mSize(theme.defaultFont).width*12 + base.internalPadding*2 + implicitHeight: theme.mSize(theme.defaultFont).height + base.internalPadding*2 // TODO: needs to define if there will be specific graphics for // disabled text fields opacity: enabled ? 1.0 : 0.5 @@ -292,7 +292,7 @@ FocusScope { anchors.fill: parent imagePath: "widgets/lineedit" prefix: "base" - property real internalPadding: theme.defaultFont.mSize.height*0.3 + property real internalPadding: theme.mSize(theme.defaultFont).height*0.3 } MouseArea { diff --git a/src/declarativeimports/plasmacomponents/qml/ToolButton.qml b/src/declarativeimports/plasmacomponents/qml/ToolButton.qml index 0f20ada16..6ea39b1fb 100644 --- a/src/declarativeimports/plasmacomponents/qml/ToolButton.qml +++ b/src/declarativeimports/plasmacomponents/qml/ToolButton.qml @@ -98,11 +98,11 @@ Item { if (label.text.length == 0) { height; } else { - Math.max(theme.defaultFont.mSize.width*12, minimumWidth); + Math.max(theme.mSize(theme.defaultFont).width*12, minimumWidth); } } - implicitHeight: Math.max(theme.defaultFont.mSize.height*1.6, minimumHeight) + implicitHeight: Math.max(theme.mSize(theme.defaultFont).height*1.6, minimumHeight) // TODO: needs to define if there will be specific graphics for // disabled buttons diff --git a/src/declarativeimports/plasmacomponents/qml/private/DualStateButton.qml b/src/declarativeimports/plasmacomponents/qml/private/DualStateButton.qml index 694c21d0e..67d6d4a75 100644 --- a/src/declarativeimports/plasmacomponents/qml/private/DualStateButton.qml +++ b/src/declarativeimports/plasmacomponents/qml/private/DualStateButton.qml @@ -55,7 +55,7 @@ Item { property alias shadow: shadowLoader.sourceComponent width: surfaceLoader.width + label.paintedWidth - height: theme.defaultFont.mSize.height*1.6 + height: theme.mSize(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 diff --git a/src/declarativeimports/plasmacomponents/qml/private/TabBarLayout.qml b/src/declarativeimports/plasmacomponents/qml/private/TabBarLayout.qml index 7125c28d8..5979d5853 100644 --- a/src/declarativeimports/plasmacomponents/qml/private/TabBarLayout.qml +++ b/src/declarativeimports/plasmacomponents/qml/private/TabBarLayout.qml @@ -175,7 +175,7 @@ Item { } } - var maxAllowedWidth = theme.defaultFont.mSize.width * 14 + var maxAllowedWidth = theme.mSize(theme.defaultFont).width * 14 var itemWidth = (root.width - (visibleChildCount-1)*10) / visibleChildCount var itemIndex = mirrored ? childCount - 1 : 0 diff --git a/src/declarativeimports/plasmaextracomponents/qml/PageRow.qml b/src/declarativeimports/plasmaextracomponents/qml/PageRow.qml index e6e1e148e..6ff9ba15c 100644 --- a/src/declarativeimports/plasmaextracomponents/qml/PageRow.qml +++ b/src/declarativeimports/plasmaextracomponents/qml/PageRow.qml @@ -58,7 +58,7 @@ Item { property ToolBar toolBar property variant initialPage //A column is wide enough for 30 characters - property int columnWidth: Math.round(parent.width/(theme.defaultFont.mSize.width*30)) > 0 ? parent.width/Math.round(parent.width/(theme.defaultFont.mSize.width*30)) : width + 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 alias clip: scrollArea.clip // Indicates whether there is an ongoing page transition. diff --git a/src/shell/qmlpackages/desktop/contents/components/CompactApplet.qml b/src/shell/qmlpackages/desktop/contents/components/CompactApplet.qml index 5d7a45b40..4c2e61b2d 100644 --- a/src/shell/qmlpackages/desktop/contents/components/CompactApplet.qml +++ b/src/shell/qmlpackages/desktop/contents/components/CompactApplet.qml @@ -48,8 +48,8 @@ Item { mainItem: Item { id: appletParent - width: applet && applet.implicitWidth > 0 ? applet.implicitWidth : theme.defaultFont.mSize.width * 35 - height: applet && applet.implicitHeight > 0 ? applet.implicitHeight : theme.defaultFont.mSize.height * 25 + width: applet && applet.implicitWidth > 0 ? applet.implicitWidth : theme.mSize(theme.defaultFont).width * 35 + height: applet && applet.implicitHeight > 0 ? applet.implicitHeight : theme.mSize(theme.defaultFont).height * 25 onWidthChanged: applet.width = width onHeightChanged: applet.height = height } diff --git a/src/shell/qmlpackages/desktop/contents/components/Configuration.qml b/src/shell/qmlpackages/desktop/contents/components/Configuration.qml index edf9e0011..f20fc4231 100644 --- a/src/shell/qmlpackages/desktop/contents/components/Configuration.qml +++ b/src/shell/qmlpackages/desktop/contents/components/Configuration.qml @@ -117,7 +117,7 @@ Rectangle { visible: (configDialog.configModel ? configDialog.configModel.count : 0) + globalConfigModel.count > 1 width: visible ? 100 : 0 implicitWidth: width - implicitHeight: theme.defaultFont.mSize.height * 12 + implicitHeight: theme.mSize(theme.defaultFont).height * 12 Flickable { id: categoriesView contentWidth: width