[PlasmaComponents3] Honor icon.[name|source] property
Since a checkbox is a subclass of AbstractButton, it can be given an icon. QWidgets checkboxes will faithfully display this icon, but PlasmaComponents3 ones will not. They should. :) I will submit a similar change for the QQC2 checkbox style to make them consistent.
This commit is contained in:
parent
ab125ac2d5
commit
b7ee696250
@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import QtQuick 2.6
|
import QtQuick 2.6
|
||||||
|
import QtQuick.Layouts 1.3
|
||||||
import QtQuick.Templates @QQC2_VERSION@ as T
|
import QtQuick.Templates @QQC2_VERSION@ as T
|
||||||
import QtQuick.Controls @QQC2_VERSION@
|
import QtQuick.Controls @QQC2_VERSION@
|
||||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
@ -32,8 +33,9 @@ T.CheckBox {
|
|||||||
indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
|
indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
|
||||||
baselineOffset: contentItem.y + contentItem.baselineOffset
|
baselineOffset: contentItem.y + contentItem.baselineOffset
|
||||||
|
|
||||||
padding: 1
|
leftPadding: control.indicator && !control.mirrored ? control.indicator.width + control.spacing : 0
|
||||||
spacing: Math.round(units.gridUnit / 8)
|
rightPadding: control.indicator && control.mirrored ? control.indicator.width + control.spacing : 0
|
||||||
|
spacing: units.smallSpacing
|
||||||
|
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
|
|
||||||
@ -47,16 +49,26 @@ T.CheckBox {
|
|||||||
control: control
|
control: control
|
||||||
}
|
}
|
||||||
|
|
||||||
contentItem: Label {
|
contentItem: RowLayout {
|
||||||
leftPadding: control.indicator && !control.mirrored ? control.indicator.width + control.spacing : 0
|
|
||||||
rightPadding: control.indicator && control.mirrored ? control.indicator.width + control.spacing : 0
|
|
||||||
opacity: control.enabled ? 1 : 0.6
|
opacity: control.enabled ? 1 : 0.6
|
||||||
text: control.text
|
spacing: units.smallSpacing
|
||||||
font: control.font
|
|
||||||
color: PlasmaCore.ColorScope.textColor
|
PlasmaCore.IconItem {
|
||||||
elide: Text.ElideRight
|
source: control.icon.name || control.icon.source
|
||||||
visible: control.text
|
visible: source.length > 0
|
||||||
horizontalAlignment: Text.AlignLeft
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
implicitWidth: units.iconSizes.smallMedium
|
||||||
|
implicitHeight: units.iconSizes.smallMedium
|
||||||
|
}
|
||||||
|
|
||||||
|
Label {
|
||||||
|
text: control.text
|
||||||
|
font: control.font
|
||||||
|
color: PlasmaCore.ColorScope.textColor
|
||||||
|
elide: Text.ElideRight
|
||||||
|
visible: control.text
|
||||||
|
horizontalAlignment: Text.AlignLeft
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,21 @@ ComponentBase {
|
|||||||
text: "Some awesome checkbox"
|
text: "Some awesome checkbox"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PlasmaComponents.Label {
|
||||||
|
text: "icon"
|
||||||
|
}
|
||||||
|
PlasmaComponents.CheckBox {
|
||||||
|
icon.name: "start-here-kde-plasma"
|
||||||
|
}
|
||||||
|
|
||||||
|
PlasmaComponents.Label {
|
||||||
|
text: "text plus icon"
|
||||||
|
}
|
||||||
|
PlasmaComponents.CheckBox {
|
||||||
|
text: "text"
|
||||||
|
icon.name: "start-here-kde-plasma"
|
||||||
|
}
|
||||||
|
|
||||||
PlasmaComponents.Label {
|
PlasmaComponents.Label {
|
||||||
text: "focus"
|
text: "focus"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user