Comment 1 for bug 1211483

Revision history for this message
Tim Peeters (tpeeters) wrote :

I'm exposing the icons in the SwitchStyle in the linked branch. So when that lands, you can use the following to change the look of the Switch for a single instance (for more instances, it is recommended to create a custom theme that derives from Ambience instead of this):

import QtQuick 2.2
import Ubuntu.Components 1.1
import Ubuntu.Components.Themes.Ambiance 1.1 as Ambience

MainView {
    id: root
    useDeprecatedToolbar: false

    width: units.gu(30)
    height: units.gu(40)

    Switch {
        id: testSwitch
        anchors.centerIn: parent
        width: units.gu(10)
        height: units.gu(5)
        checked: true
        style: Ambience.SwitchStyle {
            checkedIconSource: "image://theme/stock_video"
            uncheckedIconSource: "image://theme/stock_image"
            checkedThumbColor: "red"
        }
    }
}