Commit 53260cd7 authored by Nate Graham's avatar Nate Graham 🔩
Browse files

[applet] Port to checkbox with internally-defined icon property

With frameworks/plasma-framework!46,
checkboxes will be able to have an icon property defined internally, no
need for a separate SVG. So if and when that lands, we can use that and
discard the bespoke SwitchButton component.

This is an alternative to
parent 6d40bdf1
......@@ -5,7 +5,7 @@ set(PROJECT_VERSION "5.19.80")
set(QT_MIN_VERSION "5.14.0")
set(KF5_MIN_VERSION "5.72.0")
set(KF5_MIN_VERSION "5.73.0")
configure_file(version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/version.h)
Copyright 2014 Jan Grulich <>
Copyright 2014-2015 David Rosca <>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) version 3, or any
later version accepted by the membership of KDE e.V. (or its
successor approved by the membership of KDE e.V.), which shall
act as a proxy defined in Section 6 of version 3 of the license.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <>.
import QtQuick 2.2
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 3.0 as PlasmaComponents3
Item {
id: switchButton
property alias icon: switchButtonIcon.source
property alias checked: switchButtonCheckbox.checked
property alias enabled: switchButtonCheckbox.enabled
property alias tooltip: itemTooltip.text
signal clicked
height: switchButtonCheckbox.height + Math.round(units.gridUnit / 2)
width: switchButtonCheckbox.width + switchButtonIcon.width + units.gridUnit
PlasmaComponents3.CheckBox {
id: switchButtonCheckbox
anchors {
left: parent.left
leftMargin: units.smallSpacing
verticalCenter: parent.verticalCenter
MouseArea {
anchors.fill: parent
onClicked: {
if (switchButton.enabled) {
PlasmaComponents3.ToolTip {
id: itemTooltip
PlasmaCore.IconItem {
id: switchButtonIcon
enabled: switchButtonCheckbox.checked
anchors {
left: switchButtonCheckbox.right
bottom: switchButtonCheckbox.bottom
width: height
......@@ -34,13 +34,16 @@ PlasmaExtras.PlasmoidHeading {
anchors.fill: parent
spacing: units.smallSpacing
SwitchButton {
PlasmaComponents3.CheckBox {
checked: btManager.bluetoothOperational
enabled: btManager.bluetoothBlocked || btManager.adapters.length
icon: "preferences-system-bluetooth"
tooltip: i18n("Enable Bluetooth") "preferences-system-bluetooth"
onClicked: toggleBluetooth()
onToggled: toggleBluetooth()
PlasmaComponents3.ToolTip {
text: i18n("Enable Bluetooth")
Item {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment