Eneboo - Documentación para desarrolladores
|
The QGroupBox widget provides a group box frame with a title. Más...
#include <qgroupbox.h>
Slots públicos | |
void | setChecked (bool b) |
void | setChecked (bool b) |
Señales | |
void | toggled (bool) |
void | toggled (bool) |
Métodos públicos | |
QGroupBox (QWidget *parent=0, const char *name=0) | |
QGroupBox (const QString &title, QWidget *parent=0, const char *name=0) | |
QGroupBox (int strips, Orientation o, QWidget *parent=0, const char *name=0) | |
QGroupBox (int strips, Orientation o, const QString &title, QWidget *parent=0, const char *name=0) | |
~QGroupBox () | |
virtual void | setColumnLayout (int strips, Orientation o) |
QString | title () const |
virtual void | setTitle (const QString &) |
int | alignment () const |
virtual void | setAlignment (int) |
int | columns () const |
void | setColumns (int) |
Orientation | orientation () const |
void | setOrientation (Orientation) |
int | insideMargin () const |
int | insideSpacing () const |
void | setInsideMargin (int m) |
void | setInsideSpacing (int s) |
void | addSpace (int) |
QSize | sizeHint () const |
bool | isFlat () const |
void | setFlat (bool b) |
bool | isCheckable () const |
void | setCheckable (bool b) |
bool | isChecked () const |
void | setEnabled (bool on) |
QGroupBox (QWidget *parent=0, const char *name=0) | |
QGroupBox (const QString &title, QWidget *parent=0, const char *name=0) | |
QGroupBox (int strips, Orientation o, QWidget *parent=0, const char *name=0) | |
QGroupBox (int strips, Orientation o, const QString &title, QWidget *parent=0, const char *name=0) | |
~QGroupBox () | |
virtual void | setColumnLayout (int strips, Orientation o) |
QString | title () const |
virtual void | setTitle (const QString &) |
int | alignment () const |
virtual void | setAlignment (int) |
int | columns () const |
void | setColumns (int) |
Orientation | orientation () const |
void | setOrientation (Orientation) |
int | insideMargin () const |
int | insideSpacing () const |
void | setInsideMargin (int m) |
void | setInsideSpacing (int s) |
void | addSpace (int) |
QSize | sizeHint () const |
bool | isFlat () const |
void | setFlat (bool b) |
bool | isCheckable () const |
void | setCheckable (bool b) |
bool | isChecked () const |
void | setEnabled (bool on) |
Métodos protegidos | |
bool | event (QEvent *) |
void | childEvent (QChildEvent *) |
void | resizeEvent (QResizeEvent *) |
void | paintEvent (QPaintEvent *) |
void | focusInEvent (QFocusEvent *) |
void | fontChange (const QFont &) |
bool | event (QEvent *) |
void | childEvent (QChildEvent *) |
void | resizeEvent (QResizeEvent *) |
void | paintEvent (QPaintEvent *) |
void | focusInEvent (QFocusEvent *) |
void | fontChange (const QFont &) |
Propiedades | |
QString | title |
the group box title text. | |
Alignment | alignment |
the alignment of the group box title. | |
Orientation | orientation |
the group box's orientation | |
int | columns |
the number of columns or rows (depending on QGroupBox::orientation) in the group box | |
bool | flat |
whether the group box is painted flat or has a frame | |
bool | checkable |
Whether the group box has a checkbox in its title. | |
bool | checked |
Whether the group box's checkbox is checked. |
The QGroupBox widget provides a group box frame with a title.
A group box provides a frame, a title and a keyboard shortcut, and displays various other widgets inside itself. The title is on top, the keyboard shortcut moves keyboard focus to one of the group box's child widgets, and the child widgets are usually laid out horizontally (or vertically) inside the frame.
The simplest way to use it is to create a group box with the desired number of columns (or rows) and orientation, and then just create widgets with the group box as parent.
It is also possible to change the orientation() and number of columns() after construction, or to ignore all the automatic layout support and manage the layout yourself. You can add 'empty' spaces to the group box with addSpace().
QGroupBox also lets you set the title() (normally set in the constructor) and the title's alignment().
You can change the spacing used by the group box with setInsideMargin() and setInsideSpacing(). To minimize space consumption, you can remove the right, left and bottom edges of the frame with setFlat().
QGroupBox::QGroupBox | ( | QWidget * | parent = 0 , |
const char * | name = 0 |
||
) |
Constructs a group box widget with no title.
The parent and name arguments are passed to the QWidget constructor.
This constructor does not do automatic layout.
Constructs a group box with the title title.
The parent and name arguments are passed to the QWidget constructor.
This constructor does not do automatic layout.
QGroupBox::QGroupBox | ( | int | strips, |
Orientation | orientation, | ||
QWidget * | parent = 0 , |
||
const char * | name = 0 |
||
) |
Constructs a group box 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.
QGroupBox::QGroupBox | ( | int | strips, |
Orientation | orientation, | ||
const QString & | title, | ||
QWidget * | parent = 0 , |
||
const char * | name = 0 |
||
) |
Constructs a group box titled 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.
QGroupBox::~QGroupBox | ( | ) |
Destroys the group box.
QGroupBox::QGroupBox | ( | QWidget * | parent = 0 , |
const char * | name = 0 |
||
) |
QGroupBox::QGroupBox | ( | int | strips, |
Orientation | o, | ||
QWidget * | parent = 0 , |
||
const char * | name = 0 |
||
) |
QGroupBox::QGroupBox | ( | int | strips, |
Orientation | o, | ||
const QString & | title, | ||
QWidget * | parent = 0 , |
||
const char * | name = 0 |
||
) |
QGroupBox::~QGroupBox | ( | ) |
void QGroupBox::addSpace | ( | int | size | ) |
Adds an empty cell at the next free position. If size is greater than 0, the empty cell takes size to be its fixed width (if orientation() is Horizontal
) or height (if orientation() is Vertical
).
Use this method to separate the widgets in the group box or to skip the next free cell. For performance reasons, call this method after calling setColumnLayout() or by changing the QGroupBox::columns or QGroupBox::orientation properties. It is generally a good idea to call these methods first (if needed at all), and insert the widgets and spaces afterwards.
void QGroupBox::addSpace | ( | int | ) |
int QGroupBox::alignment | ( | ) | const [inline] |
int QGroupBox::alignment | ( | ) | const [inline] |
void QGroupBox::childEvent | ( | QChildEvent * | c | ) | [protected, virtual] |
Reimplementado de QObject.
void QGroupBox::childEvent | ( | QChildEvent * | ) | [protected, virtual] |
This event handler can be reimplemented in a subclass to receive child events.
Child events are sent to objects when children are inserted or removed.
Note that events with QEvent::type() QEvent::ChildInserted
are posted (with {QApplication::postEvent()}) to make sure that the child's construction is completed before this function is called.
If a child is removed immediately after it is inserted, the ChildInserted
event may be suppressed, but the ChildRemoved
event will always be sent. In such cases it is possible that there will be a ChildRemoved
event without a corresponding ChildInserted
event.
If you change state based on ChildInserted
events, call QWidget::constPolish(), or do
in functions that depend on the state. One notable example is QWidget::sizeHint().
Reimplementado de QObject.
int QGroupBox::columns | ( | ) | const |
int QGroupBox::columns | ( | ) | const |
Reimplementado de QWidget.
Reimplementado en QButtonGroup y QButtonGroup.
This is the main event handler; it handles event e. You can reimplement this function in a subclass, but we recommend using one of the specialized event handlers instead.
The main event handler first passes an event through all event filters that have been installed. If none of the filters intercept the event, it calls one of the specialized event handlers.
Key press and release events are treated differently from other events. event() checks for Tab and Shift+Tab and tries to move the focus appropriately. If there is no widget to move the focus to (or the key press is not Tab or Shift+Tab), event() calls keyPressEvent().
This function returns TRUE if it is able to pass the event over to someone (i.e. someone wanted the event); otherwise returns FALSE.
Reimplementado de QWidget.
Reimplementado en QButtonGroup y QButtonGroup.
void QGroupBox::focusInEvent | ( | QFocusEvent * | ) | [protected, virtual] |
Reimplementado de QWidget.
void QGroupBox::focusInEvent | ( | QFocusEvent * | ) | [protected, virtual] |
This event handler can be reimplemented in a subclass to receive keyboard focus events (focus received) for the widget.
A widget normally must setFocusPolicy() to something other than NoFocus
in order to receive focus events. (Note that the application programmer can call setFocus() on any widget, even those that do not normally accept focus.)
The default implementation updates the widget (except for toplevel widgets that do not specify a focusPolicy() ). It also calls setMicroFocusHint(), hinting any system-specific input tools about the focus of the user's attention.
Reimplementado de QWidget.
void QGroupBox::fontChange | ( | const QFont & | oldFont | ) | [protected, virtual] |
This virtual function is called from setFont(). oldFont is the previous font; you can get the new font from font().
Reimplement this function if your widget needs to know when its font changes. You will almost certainly need to update the widget using update().
The default implementation updates the widget including its geometry.
Reimplementado de QWidget.
int QGroupBox::insideMargin | ( | ) | const |
Returns the width of the empty space between the items in the group and the frame of the group.
Only applies if the group box has a defined orientation.
The default is usually 11, by may vary depending on the platform and style.
int QGroupBox::insideMargin | ( | ) | const |
int QGroupBox::insideSpacing | ( | ) | const |
Returns the width of the empty space between each of the items in the group.
Only applies if the group box has a defined orientation.
The default is usually 5, by may vary depending on the platform and style.
int QGroupBox::insideSpacing | ( | ) | const |
bool QGroupBox::isCheckable | ( | ) | const |
bool QGroupBox::isCheckable | ( | ) | const |
bool QGroupBox::isChecked | ( | ) | const |
bool QGroupBox::isChecked | ( | ) | const |
bool QGroupBox::isFlat | ( | ) | const |
bool QGroupBox::isFlat | ( | ) | const |
Orientation QGroupBox::orientation | ( | ) | const [inline] |
Orientation QGroupBox::orientation | ( | ) | const [inline] |
void QGroupBox::paintEvent | ( | QPaintEvent * | event | ) | [protected, virtual] |
Processes the paint event event.
Paints the frame and the contents.
Opens the painter on the frame and calls drawFrame(), then drawContents().
Reimplementado de QFrame.
void QGroupBox::paintEvent | ( | QPaintEvent * | event | ) | [protected, virtual] |
Reimplementado de QFrame.
void QGroupBox::resizeEvent | ( | QResizeEvent * | e | ) | [protected, virtual] |
Processes the resize event e.
Adjusts the frame rectangle for the resized widget. The frame rectangle is elastic, and the surrounding area is static.
The resulting frame rectangle may be null or invalid. You can use setMinimumSize() to avoid those possibilities.
Nothing is done if the frame rectangle is a null rectangle already.
Reimplementado de QFrame.
void QGroupBox::resizeEvent | ( | QResizeEvent * | e | ) | [protected, virtual] |
Reimplementado de QFrame.
void QGroupBox::setAlignment | ( | int | alignment | ) | [virtual] |
virtual void QGroupBox::setAlignment | ( | int | ) | [virtual] |
void QGroupBox::setCheckable | ( | bool | b | ) |
void QGroupBox::setCheckable | ( | bool | b | ) |
void QGroupBox::setChecked | ( | bool | b | ) | [slot] |
void QGroupBox::setChecked | ( | bool | b | ) | [slot] |
void QGroupBox::setColumnLayout | ( | int | strips, |
Orientation | direction | ||
) | [virtual] |
Changes the layout of the group box. This function is only useful in combination with the default constructor that does not take any layout information. This function will put all existing children in the new layout. It is not good Qt programming style to call this function after children have been inserted. Sets the number of columns or rows to be strips, depending on direction.
virtual void QGroupBox::setColumnLayout | ( | int | strips, |
Orientation | o | ||
) | [virtual] |
void QGroupBox::setColumns | ( | int | ) |
void QGroupBox::setColumns | ( | int | c | ) |
void QGroupBox::setFlat | ( | bool | b | ) |
void QGroupBox::setFlat | ( | bool | b | ) |
void QGroupBox::setInsideMargin | ( | int | m | ) |
Sets the the width of the inside margin to m pixels.
void QGroupBox::setInsideMargin | ( | int | m | ) |
void QGroupBox::setInsideSpacing | ( | int | s | ) |
Sets the width of the empty space between each of the items in the group to s pixels.
void QGroupBox::setInsideSpacing | ( | int | s | ) |
void QGroupBox::setOrientation | ( | Orientation | ) |
void QGroupBox::setOrientation | ( | Orientation | ) |
virtual void QGroupBox::setTitle | ( | const QString & | ) | [virtual] |
void QGroupBox::setTitle | ( | const QString & | title | ) | [virtual] |
QString QGroupBox::title | ( | ) | const [inline] |
QString QGroupBox::title | ( | ) | const [inline] |
void QGroupBox::toggled | ( | bool | on | ) | [signal] |
If the group box has a check box (see isCheckable()) this signal is emitted when the check box is toggled. on is TRUE if the check box is checked; otherwise it is FALSE.
void QGroupBox::toggled | ( | bool | ) | [signal] |
Alignment QGroupBox::alignment [read, write] |
the alignment of the group box title.
The title is always placed on the upper frame line. The horizontal alignment can be specified by the alignment parameter.
The alignment is one of the following flags: AlignAuto
aligns the title according to the language, usually to the left. AlignLeft
aligns the title text to the left. AlignRight
aligns the title text to the right. AlignHCenter
aligns the title text centered.
The default alignment is AlignAuto
.
bool QGroupBox::checkable [read, write] |
Whether the group box has a checkbox in its title.
If this property is TRUE, the group box has a checkbox. If the checkbox is checked (which is the default), the group box's children are enabled.
setCheckable() controls whether or not the group box has a checkbox, and isCheckable() controls whether the checkbox is checked or not.
bool QGroupBox::checked [read, write] |
Whether the group box's checkbox is checked.
If the group box has a check box (see isCheckable()), and the check box is checked (see isChecked()), the group box's children are enabled. If the checkbox is unchecked the children are disabled.
int QGroupBox::columns [read, write] |
the number of columns or rows (depending on QGroupBox::orientation) in the group box
Usually it is not a good idea to set this property because it is slow (it does a complete layout). It is best to set the number of columns directly in the constructor.
bool QGroupBox::flat [read, write] |
whether the group box is painted flat or has a frame
By default a group box has a surrounding frame, with the title being placed on the upper frame line. In flat mode the right, left and bottom frame lines are omitted, and only the thin line at the top is drawn.
Orientation QGroupBox::orientation [read, write] |
the group box's orientation
A horizontal group box arranges it's children in columns, while a vertical group box arranges them in rows.
Usually it is not a good idea to set this property because it is slow (it does a complete layout). It is better to set the orientation directly in the constructor.
QString QGroupBox::title [read, write] |
the group box title text.
The group box title text will have a focus-change keyboard accelerator if the title contains &, followed by a letter.
g->setTitle( "&User information" );
This produces "<u>U</u>ser information"; Alt+U moves the keyboard focus to the group box.
There is no default title text.