diff options
| author | Gabriel de Dietrich <gabriel.dedietrich@digia.com> | 2013-02-21 15:01:34 +0100 |
|---|---|---|
| committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-02-22 09:56:36 +0100 |
| commit | f862a9dc004937876742a1a4687d803fa36a0276 (patch) | |
| tree | f38651ee64df58fc846e7d5772d4c8bc68922cc7 /src/controls/qtexclusivegroup.cpp | |
| parent | 04e7898e97d959c86c19660ef9b7186474cc8bc6 (diff) | |
| download | qtquickcontrols-f862a9dc004937876742a1a4687d803fa36a0276.tar.gz | |
ExclusiveGroup: Several fixes, API improvements
- Moved 'exclusiveGroup' property from ButtonBehaviour to BasicButton.
- Renamed registerCheckable() to bindCheckable(), unregisterCheckable()
to unbindCheckable().
- Improved and updated documentation.
Change-Id: I74cdea37cb8fcdf5cce22f58981cfb3a7dafaf8f
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Diffstat (limited to 'src/controls/qtexclusivegroup.cpp')
| -rw-r--r-- | src/controls/qtexclusivegroup.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/controls/qtexclusivegroup.cpp b/src/controls/qtexclusivegroup.cpp index 3327f13c..fe19e0fe 100644 --- a/src/controls/qtexclusivegroup.cpp +++ b/src/controls/qtexclusivegroup.cpp @@ -92,11 +92,11 @@ static bool isChecked(const QObject *o) \endcode - For an object, or control, to be compatible with \c ExclusiveGroup, it should have a \c checked - property, and either a \c checkedChanged, \c toggled(), or \c toggled(bool) signal. It also needs - to be registered with \c ExclusiveGroup::registerCheckable(object) when its \c ExclusiveGroup property is set. + Several controls already support \c ExclusiveGroup, e.g. \l MenuItem, \l Button, and \l RadioButton. - \sa Action, ButtonBehavior + It is possible to add support for \c ExclusiveGroup for an object, or control. It should have a \c checked + property, and either a \c checkedChanged, \c toggled(), or \c toggled(bool) signal. It also needs + to be bound with \c ExclusiveGroup::bindCheckable(object) when its \c ExclusiveGroup property is set. */ /*! @@ -106,23 +106,23 @@ static bool isChecked(const QObject *o) */ /*! - \qmlmethod void ExclusiveGroup::registerCheckable(object) + \qmlmethod void ExclusiveGroup::bindCheckable(object) Register \c object to the exclusive group. You should only need to call this function when creating a component you want to be compatible with \c ExclusiveGroup. - \sa ExclusiveGroup::unregisterCheckable(object) + \sa ExclusiveGroup::unbindCheckable(object) */ /*! - \qmlmethod void ExclusiveGroup::unregisterCheckable(object) + \qmlmethod void ExclusiveGroup::unbindCheckable(object) Unregister \c object from the exclusive group. You should only need to call this function when creating a component you want to be compatible with \c ExclusiveGroup. - \sa ExclusiveGroup::registerCheckable(object) + \sa ExclusiveGroup::bindCheckable(object) */ QtExclusiveGroup::QtExclusiveGroup(QObject *parent) @@ -152,31 +152,31 @@ void QtExclusiveGroup::updateCurrent() setCurrent(checkable); } -void QtExclusiveGroup::registerCheckable(QObject *o) +void QtExclusiveGroup::bindCheckable(QObject *o) { for (const char **signalName = checkableSignals; *signalName; signalName++) { int signalIndex = o->metaObject()->indexOfSignal(*signalName); if (signalIndex != -1) { QMetaMethod signalMethod = o->metaObject()->method(signalIndex); connect(o, signalMethod, this, m_updateCurrentMethod, Qt::UniqueConnection); - connect(o, SIGNAL(destroyed(QObject*)), this, SLOT(unregisterCheckable(QObject*)), Qt::UniqueConnection); + connect(o, SIGNAL(destroyed(QObject*)), this, SLOT(unbindCheckable(QObject*)), Qt::UniqueConnection); if (!m_current && isChecked(o)) setCurrent(o); return; } } - qWarning() << "QtExclusiveGroup::registerCheckable(): Cannot register" << o; + qWarning() << "QtExclusiveGroup::bindCheckable(): Cannot register" << o; } -void QtExclusiveGroup::unregisterCheckable(QObject *o) +void QtExclusiveGroup::unbindCheckable(QObject *o) { for (const char **signalName = checkableSignals; *signalName; signalName++) { int signalIndex = o->metaObject()->indexOfSignal(*signalName); if (signalIndex != -1) { QMetaMethod signalMethod = o->metaObject()->method(signalIndex); if (disconnect(o, signalMethod, this, m_updateCurrentMethod)) { - disconnect(o, SIGNAL(destroyed(QObject*)), this, SLOT(unregisterCheckable(QObject*))); + disconnect(o, SIGNAL(destroyed(QObject*)), this, SLOT(unbindCheckable(QObject*))); break; } } |
