Qt:Документация 4.3.2/q3buttongroup
Материал из Wiki.crossplatform.ru
Внимание: Актуальная версия перевода документации находится здесь |
__NOTOC__
Главная · Все классы · Основные классы · Классы по группам · Модули · Функции |
[править] Q3ButtonGroup Class Reference
[ Qt3Support module]
The Q3ButtonGroup widget organizes QAbstractButton widgets in a group. Далее...
#include <Q3ButtonGroup>
This class is part of the Qt 3 support library. It is provided to keep old source code working. Мы настоятельно не рекомендуем использовать этот класс в новом коде. See Porting to Qt 4 for more information.
Inherits Q3GroupBox.
Inherited by Q3HButtonGroup and Q3VButtonGroup.
[править] Свойства
- exclusive : bool
- radioButtonExclusive : bool
- selectedId : int
- 8 properties inherited from Q3GroupBox
- 5 properties inherited from QGroupBox
- 56 свойств, унаследованных от QWidget
- 1 свойство, унаследованное от QObject
[править] Открытые функции
- Q3ButtonGroup ( QWidget * parent = 0, const char * name = 0 )
- Q3ButtonGroup ( const QString & title, QWidget * parent = 0, const char * name = 0 )
- Q3ButtonGroup ( int strips, Qt::Orientation orientation, QWidget * parent = 0, const char * name = 0 )
- Q3ButtonGroup ( int strips, Qt::Orientation orientation, const QString & title, QWidget * parent = 0, const char * name = 0 )
- ~Q3ButtonGroup ()
- int count () const
- QAbstractButton * find ( int id ) const
- int id ( QAbstractButton * button ) const
- int insert ( QAbstractButton * button, int id = -1 )
- bool isExclusive () const
- bool isRadioButtonExclusive () const
- void remove ( QAbstractButton * button )
- QAbstractButton * selected () const
- int selectedId () const
- void setButton ( int id )
- void setExclusive ( bool )
- void setRadioButtonExclusive ( bool )
- 22 public functions inherited from Q3GroupBox
- 9 public functions inherited from QGroupBox
- 201 свойство, унаследованное от QWidget
- 29 открытых функций, унаследованных от QObject
- 12 открытых функций, унаследованных от QPaintDevice
[править] Сигналы
- 2 signals inherited from QGroupBox
- 1 сигнал, унаследованный от QWidget
- 1 сигнал, унаследованный от QObject
[править] Дополнительные унаследованные члены
- 1 public slot inherited from QGroupBox
- 19 открытых слотов, унаследованных от QWidget
- 1 открытый слот, унаследованный от QObject
- 4 статических открытых члена, унаследованных от QWidget
- 5 статических открытых членов, унаследованных от QObject
- 1 protected function inherited from QGroupBox
- 38 защищенных функций, унаследованных от QWidget
- 7 защищенных функций, унаследованных от QObject
- 1 защищенная функция, унаследованных от QPaintDevice
- 1 защищенный слот, унаследованый от QWidget
[править] Подробное описание
The Q3ButtonGroup widget organizes QAbstractButton widgets in a group.
A button group widget makes it easier to deal with groups of buttons. Each button in a button group has a unique identifier. The button group emits a clicked() signal with this identifier when a button in the group is clicked. This makes a button group particularly useful when you have several similar buttons and want to connect all their clicked() signals to a single slot.
An exclusive button group switches off all toggle buttons except the one that was clicked. A button group is, by default, non-exclusive. Note that all radio buttons that are inserted into a button group are mutually exclusive even if the button group is non-exclusive. (See setRadioButtonExclusive().)
There are two ways of using a button group:
- The button group is the parent widget of a number of buttons, i.e. the button group is the parent argument in the button constructor. The buttons are assigned identifiers 0, 1, 2, etc., in the order they are created. A Q3ButtonGroup can display a frame and a title because it inherits Q3GroupBox.
- The button group is an invisible widget and the contained buttons have some other parent widget. In this usage, each button must be manually inserted, using insert(), into the button group and given an identifier.
A button can be removed from the group with remove(). A pointer to a button with a given id can be obtained using find(). The id of a button is available using id(). A button can be set on with setButton(). The number of buttons in the group is returned by count().
See also QPushButton, QCheckBox, and QRadioButton.
[править] Описание cвойств
[править] exclusive : bool
This property holds whether the button group is exclusive.
If this property is true, then the buttons in the group are toggled, and to untoggle a button you must click on another button in the group. The default value is false.
Функции доступа:
- bool isExclusive () const
- void setExclusive ( bool )
[править] radioButtonExclusive : bool
This property holds whether the radio buttons in the group are exclusive.
If this property is true (the default), the radio buttons in the group are treated exclusively.
Функции доступа:
- bool isRadioButtonExclusive () const
- void setRadioButtonExclusive ( bool )
[править] selectedId : int
This property holds the id of the selected toggle button.
If no toggle button is selected, id() returns -1.
If setButton() is called on an exclusive group, the button with the given id will be set to on and all the others will be set to off.
Функции доступа:
- int selectedId () const
- void setButton ( int id )
See also selected().
[править] Описание функций-членов
[править] Q3ButtonGroup::Q3ButtonGroup ( QWidget * parent = 0, const char * name = 0 )
Constructs a button group with no title.
The parent and name arguments are passed to the QWidget constructor.
[править] Q3ButtonGroup::Q3ButtonGroup ( const QString & title, QWidget * parent = 0, const char * name = 0 )
Constructs a button group with the title title.
The parent and name arguments are passed to the QWidget constructor.
[править] Q3ButtonGroup::Q3ButtonGroup ( int strips, Qt::Orientation orientation, QWidget * parent = 0, const char * name = 0 )
Constructs a button group with no title. Child widgets will be arranged in strips rows or columns (depending on orientation).
The parent and name arguments are passed to the QWidget constructor.
[править] Q3ButtonGroup::Q3ButtonGroup ( int strips, Qt::Orientation orientation, const QString & title, QWidget * parent = 0, const char * name = 0 )
Constructs a button group with title title. Child widgets will be arranged in strips rows or columns (depending on orientation).
The parent and name arguments are passed to the QWidget constructor.
[править] Q3ButtonGroup::~Q3ButtonGroup ()
Деструктор.
[править] void Q3ButtonGroup::clicked ( int id ) [signal]
This signal is emitted when a button in the group is clicked. The id argument is the button's identifier.
See also insert().
[править] int Q3ButtonGroup::count () const
Returns the number of buttons in the group.
[править] QAbstractButton * Q3ButtonGroup::find ( int id ) const
Returns the button with the specified identifier id, or 0 if the button was not found.
[править] int Q3ButtonGroup::id ( QAbstractButton * button ) const
Returns the id of button, or -1 if button is not a member of this group.
See also selectedId().
[править] int Q3ButtonGroup::insert ( QAbstractButton * button, int id = -1 )
Inserts the button with the identifier id into the button group. Returns the button identifier.
Buttons are normally inserted into a button group automatically by passing the button group as the parent when the button is constructed. So it is not necessary to manually insert buttons that have this button group as their parent widget. An exception is when you want custom identifiers instead of the default 0, 1, 2, etc., or if you want the buttons to have some other parent.
The button is assigned the identifier id or an automatically generated identifier. It works as follows: If id >= 0, this identifier is assigned. If id == -1 (default), the identifier is equal to the number of buttons in the group. If id is any other negative integer, for instance -2, a unique identifier (negative integer <= -2) is generated. No button has an id of -1.
See also find(), remove(), and setExclusive().
[править] void Q3ButtonGroup::pressed ( int id ) [signal]
This signal is emitted when a button in the group is pressed. The id argument is the button's identifier.
See also insert().
[править] void Q3ButtonGroup::released ( int id ) [signal]
This signal is emitted when a button in the group is released. The id argument is the button's identifier.
See also insert().
[править] void Q3ButtonGroup::remove ( QAbstractButton * button )
Removes the button from the button group.
See also insert().
[править] QAbstractButton * Q3ButtonGroup::selected () const
Returns the selected toggle button if exactly one is selected; otherwise returns 0.
See also selectedId().
Copyright © 2007 Trolltech | Trademarks | Qt 4.3.2
|