[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.Layouts 1.3
|
||||
import QtQuick.Templates @QQC2_VERSION@ as T
|
||||
import QtQuick.Controls @QQC2_VERSION@
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
@ -32,8 +33,9 @@ T.CheckBox {
|
||||
indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
|
||||
baselineOffset: contentItem.y + contentItem.baselineOffset
|
||||
|
||||
padding: 1
|
||||
spacing: Math.round(units.gridUnit / 8)
|
||||
leftPadding: control.indicator && !control.mirrored ? control.indicator.width + control.spacing : 0
|
||||
rightPadding: control.indicator && control.mirrored ? control.indicator.width + control.spacing : 0
|
||||
spacing: units.smallSpacing
|
||||
|
||||
hoverEnabled: true
|
||||
|
||||
@ -47,16 +49,26 @@ T.CheckBox {
|
||||
control: control
|
||||
}
|
||||
|
||||
contentItem: Label {
|
||||
leftPadding: control.indicator && !control.mirrored ? control.indicator.width + control.spacing : 0
|
||||
rightPadding: control.indicator && control.mirrored ? control.indicator.width + control.spacing : 0
|
||||
contentItem: RowLayout {
|
||||
opacity: control.enabled ? 1 : 0.6
|
||||
text: control.text
|
||||
font: control.font
|
||||
color: PlasmaCore.ColorScope.textColor
|
||||
elide: Text.ElideRight
|
||||
visible: control.text
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
spacing: units.smallSpacing
|
||||
|
||||
PlasmaCore.IconItem {
|
||||
source: control.icon.name || control.icon.source
|
||||
visible: source.length > 0
|
||||
|
||||
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"
|
||||
}
|
||||
|
||||
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 {
|
||||
text: "focus"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user