theme.defaultFont.mSize api changed

QML2 has QFont directly binded, but doesn't have mSize, so move it to Theme
theme.defaultFont.mSize to theme.mSize(theme.defaultFont)
This commit is contained in:
Marco Martin 2013-03-11 17:06:05 +01:00
parent 74d1a62bdd
commit 83baa3691e
22 changed files with 35 additions and 35 deletions

View File

@ -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;

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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 {

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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

View File

@ -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 {

View File

@ -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

View File

@ -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
}

View File

@ -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 {

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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
}

View File

@ -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