From a7687dbbb0fa0f619324b43bba1ccb9d5b75ce64 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 28 Oct 2016 16:27:58 +0200 Subject: Doc: fix review findings for Switch & SwitchDelegate Change-Id: I1626cb83d75e9b64fc5e274dc29fff04a157741b Task-number: QTBUG-55904 Reviewed-by: Mitch Curtis --- src/quicktemplates2/qquickswitch.cpp | 14 ++++---------- src/quicktemplates2/qquickswitchdelegate.cpp | 8 ++++++-- 2 files changed, 10 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/quicktemplates2/qquickswitch.cpp b/src/quicktemplates2/qquickswitch.cpp index a7d17e86..8c3d9f0b 100644 --- a/src/quicktemplates2/qquickswitch.cpp +++ b/src/quicktemplates2/qquickswitch.cpp @@ -57,17 +57,11 @@ QT_BEGIN_NAMESPACE Switch is an option button that can be dragged or toggled on (checked) or off (unchecked). Switches are typically used to select between two states. + For larger sets of options, such as those in a list, consider using + \l SwitchDelegate instead. - \table - \row \li \image qtquickcontrols2-switch-normal.png - \li A switch in its normal state. - \row \li \image qtquickcontrols2-switch-checked.png - \li A switch that is checked. - \row \li \image qtquickcontrols2-switch-focused.png - \li A switch that has active focus. - \row \li \image qtquickcontrols2-switch-disabled.png - \li A switch that is disabled. - \endtable + Switch inherits its API from \l AbstractButton. For instance, the state + of the switch can be set with the \l {AbstractButton::}{checked} property. \code ColumnLayout { diff --git a/src/quicktemplates2/qquickswitchdelegate.cpp b/src/quicktemplates2/qquickswitchdelegate.cpp index 62b677e5..edfb15d5 100644 --- a/src/quicktemplates2/qquickswitchdelegate.cpp +++ b/src/quicktemplates2/qquickswitchdelegate.cpp @@ -53,9 +53,13 @@ QT_BEGIN_NAMESPACE SwitchDelegate presents an item delegate that can be toggled on (checked) or off (unchecked). Switch delegates are typically used to select one or more - options from a set of options. + options from a set of options. For smaller sets of options, or for options + that need to be uniquely identifiable, consider using \l Switch instead. - The state of the check delegate can be set with the + SwitchDelegate inherits its API from \l ItemDelegate, which is inherited + from \l AbstractButton. For instance, you can set \l {AbstractButton::text}{text}, + and react to \l {AbstractButton::clicked}{clicks} using the \l AbstractButton + API. The state of the switch delegate can be set with the \l {AbstractButton::}{checked} property. \code -- cgit v1.2.3