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 * @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; bool windowTranslucencyEnabled() const;
KUrl homepage() const; KUrl homepage() const;

View File

@ -96,8 +96,8 @@ Item {
mainItem: Item { mainItem: Item {
id: contentItem id: contentItem
width: Math.max(menuColumn.width, theme.defaultFont.mSize.width * 12) width: Math.max(menuColumn.width, theme.mSize(theme.defaultFont).width * 12)
height: Math.min(menuColumn.height, theme.defaultFont.mSize.height * 25) height: Math.min(menuColumn.height, theme.mSize(theme.defaultFont).height * 25)

View File

@ -91,8 +91,8 @@ Item {
property alias activeFocus: textInput.activeFocus property alias activeFocus: textInput.activeFocus
// TODO: fix default size // TODO: fix default size
implicitWidth: theme.defaultFont.mSize.width*12 implicitWidth: theme.mSize(theme.defaultFont).width*12
implicitHeight: theme.defaultFont.mSize.height*1.6 implicitHeight: theme.mSize(theme.defaultFont).height*1.6
// TODO: needs to define if there will be specific graphics for // TODO: needs to define if there will be specific graphics for
// disabled text fields // disabled text fields
opacity: enabled ? 1.0 : 0.5 opacity: enabled ? 1.0 : 0.5

View File

@ -110,11 +110,11 @@ Item {
if (label.text.length == 0) { if (label.text.length == 0) {
height; height;
} else { } 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 // TODO: needs to define if there will be specific graphics for
// disabled buttons // disabled buttons

View File

@ -39,8 +39,8 @@ Private.DualStateButton {
view: PlasmaCore.FrameSvgItem { view: PlasmaCore.FrameSvgItem {
imagePath: "widgets/button" imagePath: "widgets/button"
prefix: "normal" prefix: "normal"
width: theme.defaultFont.mSize.height + margins.left width: theme.mSize(theme.defaultFont).height + margins.left
height: theme.defaultFont.mSize.height + margins.top height: theme.mSize(theme.defaultFont).height + margins.top
PlasmaCore.SvgItem { PlasmaCore.SvgItem {
svg: PlasmaCore.Svg { svg: PlasmaCore.Svg {

View File

@ -293,7 +293,7 @@ Item {
Item { Item {
id: dialogLayout 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 height: titleBar.height + contentItem.childrenRect.height + buttonItem.childrenRect.height + 10
parent: internalLoader.dialog ? internalLoader.dialog : internalLoader.inlineDialog parent: internalLoader.dialog ? internalLoader.dialog : internalLoader.inlineDialog

View File

@ -33,7 +33,7 @@ import org.kde.plasma.core 0.1 as PlasmaCore
Text { Text {
id: root 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 verticalAlignment: lineCount > 1 ? Text.AlignTop : Text.AlignVCenter
font.capitalization: theme.defaultFont.capitalization font.capitalization: theme.defaultFont.capitalization

View File

@ -64,9 +64,9 @@ PlasmaComponents.CommonDialog {
} }
content: Item { 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 width: implicitWidth

View File

@ -39,7 +39,7 @@ Private.DualStateButton {
imagePath: "widgets/actionbutton" imagePath: "widgets/actionbutton"
} }
elementId: "normal" elementId: "normal"
width: theme.defaultFont.mSize.height + 6 width: theme.mSize(theme.defaultFont).height + 6
height: width height: width
PlasmaCore.SvgItem { PlasmaCore.SvgItem {

View File

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

View File

@ -193,8 +193,8 @@ Item {
mainItem: Item { mainItem: Item {
id: mainItem id: mainItem
width: theme.defaultFont.mSize.width * 40 width: theme.mSize(theme.defaultFont).width * 40
height: Math.max(titleBar.childrenRect.height + contentItem.childrenRect.height + buttonsRow.childrenRect.height + 8, theme.defaultFont.mSize.height * 25) 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 // Consume all key events that are not processed by children
Keys.onPressed: event.accepted = true Keys.onPressed: event.accepted = true
@ -263,7 +263,7 @@ Item {
bottom: parent.bottom bottom: parent.bottom
horizontalCenter: parent.horizontalCenter horizontalCenter: parent.horizontalCenter
//the bottom margin is disabled but we want it anyways //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 { PlasmaComponents.Button {

View File

@ -104,8 +104,8 @@ Item {
*/ */
property alias inverted: range.inverted property alias inverted: range.inverted
width: contents.isVertical ? theme.defaultFont.mSize.height*1.6 : 200 width: contents.isVertical ? theme.mSize(theme.defaultFont).height*1.6 : 200
height: contents.isVertical ? 200 : theme.defaultFont.mSize.height*1.6 height: contents.isVertical ? 200 : theme.mSize(theme.defaultFont).height*1.6
// TODO: needs to define if there will be specific graphics for // TODO: needs to define if there will be specific graphics for
// disabled sliders // disabled sliders
opacity: enabled ? 1.0 : 0.5 opacity: enabled ? 1.0 : 0.5

View File

@ -39,7 +39,7 @@ Private.DualStateButton {
imagePath: "widgets/slider" imagePath: "widgets/slider"
prefix: "groove" prefix: "groove"
width: height * 2 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) button.margins.top + button.margins.bottom)
PlasmaCore.FrameSvgItem { PlasmaCore.FrameSvgItem {

View File

@ -161,7 +161,7 @@ FocusScope {
Private.TabBarLayout { Private.TabBarLayout {
id: tabBarLayout id: tabBarLayout
//A bit of snap before scrolling the layout //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 { anchors {
top: parent.top top: parent.top
bottom: parent.bottom bottom: parent.bottom

View File

@ -137,7 +137,7 @@ Item {
anchors { anchors {
top: internal.portrait && iconSource != null ? imageLoader.bottom : parent.top top: internal.portrait && iconSource != null ? imageLoader.bottom : parent.top
left: internal.portrait || iconSource == null ? parent.left : imageLoader.right 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 right: parent.right
bottom: parent.bottom bottom: parent.bottom
} }

View File

@ -273,8 +273,8 @@ FocusScope {
//property alias activeFocus: textInput.activeFocus //property alias activeFocus: textInput.activeFocus
// TODO: fix default size // TODO: fix default size
implicitWidth: theme.defaultFont.mSize.width*12 + base.internalPadding*2 implicitWidth: theme.mSize(theme.defaultFont).width*12 + base.internalPadding*2
implicitHeight: theme.defaultFont.mSize.height + base.internalPadding*2 implicitHeight: theme.mSize(theme.defaultFont).height + base.internalPadding*2
// TODO: needs to define if there will be specific graphics for // TODO: needs to define if there will be specific graphics for
// disabled text fields // disabled text fields
opacity: enabled ? 1.0 : 0.5 opacity: enabled ? 1.0 : 0.5
@ -292,7 +292,7 @@ FocusScope {
anchors.fill: parent anchors.fill: parent
imagePath: "widgets/lineedit" imagePath: "widgets/lineedit"
prefix: "base" prefix: "base"
property real internalPadding: theme.defaultFont.mSize.height*0.3 property real internalPadding: theme.mSize(theme.defaultFont).height*0.3
} }
MouseArea { MouseArea {

View File

@ -98,11 +98,11 @@ Item {
if (label.text.length == 0) { if (label.text.length == 0) {
height; height;
} else { } 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 // TODO: needs to define if there will be specific graphics for
// disabled buttons // disabled buttons

View File

@ -55,7 +55,7 @@ Item {
property alias shadow: shadowLoader.sourceComponent property alias shadow: shadowLoader.sourceComponent
width: surfaceLoader.width + label.paintedWidth 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 // TODO: needs to define if there will be specific graphics for
// disabled buttons // disabled buttons
opacity: dualButton.enabled ? 1.0 : 0.5 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 itemWidth = (root.width - (visibleChildCount-1)*10) / visibleChildCount
var itemIndex = mirrored ? childCount - 1 : 0 var itemIndex = mirrored ? childCount - 1 : 0

View File

@ -58,7 +58,7 @@ Item {
property ToolBar toolBar property ToolBar toolBar
property variant initialPage property variant initialPage
//A column is wide enough for 30 characters //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 property alias clip: scrollArea.clip
// Indicates whether there is an ongoing page transition. // Indicates whether there is an ongoing page transition.

View File

@ -48,8 +48,8 @@ Item {
mainItem: Item { mainItem: Item {
id: appletParent id: appletParent
width: applet && applet.implicitWidth > 0 ? applet.implicitWidth : theme.defaultFont.mSize.width * 35 width: applet && applet.implicitWidth > 0 ? applet.implicitWidth : theme.mSize(theme.defaultFont).width * 35
height: applet && applet.implicitHeight > 0 ? applet.implicitHeight : theme.defaultFont.mSize.height * 25 height: applet && applet.implicitHeight > 0 ? applet.implicitHeight : theme.mSize(theme.defaultFont).height * 25
onWidthChanged: applet.width = width onWidthChanged: applet.width = width
onHeightChanged: applet.height = height onHeightChanged: applet.height = height
} }

View File

@ -117,7 +117,7 @@ Rectangle {
visible: (configDialog.configModel ? configDialog.configModel.count : 0) + globalConfigModel.count > 1 visible: (configDialog.configModel ? configDialog.configModel.count : 0) + globalConfigModel.count > 1
width: visible ? 100 : 0 width: visible ? 100 : 0
implicitWidth: width implicitWidth: width
implicitHeight: theme.defaultFont.mSize.height * 12 implicitHeight: theme.mSize(theme.defaultFont).height * 12
Flickable { Flickable {
id: categoriesView id: categoriesView
contentWidth: width contentWidth: width