| 1 |
/* |
| 2 |
* Copyright 2012 Canonical Ltd. |
| 3 |
* |
| 4 |
* This program is free software; you can redistribute it and/or modify |
| 5 |
* it under the terms of the GNU Lesser General Public License as published by |
| 6 |
* the Free Software Foundation; version 3. |
| 7 |
* |
| 8 |
* This program is distributed in the hope that it will be useful, |
| 9 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 |
* GNU Lesser General Public License for more details. |
| 12 |
* |
| 13 |
* You should have received a copy of the GNU Lesser General Public License |
| 14 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 |
*/ |
| 16 |
|
| 17 |
// FIXME(loicm) It would be nice to have a draggable thumb to toggle the switch, |
| 18 |
// that needs to be validated with designers though. |
| 19 |
|
| 20 |
import QtQuick 2.4 |
| 21 |
|
| 22 |
/*! |
| 23 |
\qmltype Switch |
| 24 |
\inqmlmodule Lomiri.Components |
| 25 |
\ingroup lomiri |
| 26 |
\brief Switch is a component with two states, checked or unchecked. It can |
| 27 |
be used to set boolean options. The behavior is the same as \l CheckBox, the |
| 28 |
only difference is the graphical style. |
| 29 |
|
| 30 |
\l {https://design.lomiri.com/apps/building-blocks/selection}{See also the Design Guidelines on selection}. |
| 31 |
|
| 32 |
Example: |
| 33 |
\qml |
| 34 |
Item { |
| 35 |
Switch { |
| 36 |
checked: true |
| 37 |
} |
| 38 |
} |
| 39 |
\endqml |
| 40 |
*/ |
| 41 |
CheckBox { |
| 42 |
id: switchItem |
| 43 |
style: Theme.createStyleComponent("SwitchStyle.qml", switchItem) |
| 44 |
} |