A collapsive and checkable QGroupBox. More...
#include <qxtgroupbox.h>

Public Slots | |
| void | setCollapsed (bool collapsed=true) |
| void | setExpanded (bool expanded=true) |
Public Member Functions | |
| QxtGroupBox (QWidget *parent=0) | |
| QxtGroupBox (const QString &title, QWidget *parent=0) | |
| virtual | ~QxtGroupBox () |
| bool | isCollapsive () const |
| void | setCollapsive (bool enabled) |
Protected Member Functions | |
| virtual void | childEvent (QChildEvent *event) |
Properties | |
| bool | collapsive |
| This property holds whether the group box is collapsive. | |
Friends | |
| class | QxtGroupBoxPrivate |
A collapsive and checkable QGroupBox.
QxtGroupBox is a checkable group box automatically expanding/collapsing its content according to the check state. QxtGroupBox shows its children when checked and hides its children when unchecked.
Two QxtGroupBoxes - an expanded and a collapsed - on top of each other.
Definition at line 34 of file qxtgroupbox.h.
| QxtGroupBox::QxtGroupBox | ( | QWidget * | parent = 0 ) |
[explicit] |
Constructs a new QxtGroupBox with parent.
Definition at line 58 of file qxtgroupbox.cpp.
References QXT_INIT_PRIVATE, and setExpanded().
: QGroupBox(parent)
{
QXT_INIT_PRIVATE(QxtGroupBox);
setCheckable(true);
setChecked(true);
connect(this, SIGNAL(toggled(bool)), this, SLOT(setExpanded(bool)));
}
| QxtGroupBox::QxtGroupBox | ( | const QString & | title, |
| QWidget * | parent = 0 |
||
| ) | [explicit] |
Constructs a new QxtGroupBox with title and parent.
Definition at line 71 of file qxtgroupbox.cpp.
References QXT_INIT_PRIVATE, and setExpanded().
: QGroupBox(title, parent)
{
QXT_INIT_PRIVATE(QxtGroupBox);
setCheckable(true);
setChecked(true);
connect(this, SIGNAL(toggled(bool)), this, SLOT(setExpanded(bool)));
}
| QxtGroupBox::~QxtGroupBox | ( | ) | [virtual] |
| void QxtGroupBox::childEvent | ( | QChildEvent * | event ) | [protected, virtual] |
Definition at line 148 of file qxtgroupbox.cpp.
{
QObject* child = event->child();
if (event->added() && child->isWidgetType())
{
QWidget* widget = static_cast<QWidget*>(child);
if (qxt_d().collapsive && !isChecked())
widget->hide();
}
}
| bool QxtGroupBox::isCollapsive | ( | ) | const |
Definition at line 90 of file qxtgroupbox.cpp.
{
return qxt_d().collapsive;
}
| void QxtGroupBox::setCollapsed | ( | bool | collapsed = true ) |
[slot] |
Sets the group box collapsed.
A collapsed group box hides its children.
Definition at line 114 of file qxtgroupbox.cpp.
References setExpanded().
{
setExpanded(!collapsed);
}
| void QxtGroupBox::setCollapsive | ( | bool | enabled ) |
Definition at line 95 of file qxtgroupbox.cpp.
References collapsive, and setExpanded().
{
if (qxt_d().collapsive != enable)
{
qxt_d().collapsive = enable;
if (!enable)
setExpanded(true);
else if (!isChecked())
setExpanded(false);
}
}
| void QxtGroupBox::setExpanded | ( | bool | expanded = true ) |
[slot] |
Sets the group box expanded.
An expanded group box shows its children.
Definition at line 126 of file qxtgroupbox.cpp.
References collapsive.
Referenced by QxtGroupBox(), setCollapsed(), and setCollapsive().
{
if (qxt_d().collapsive || expanded)
{
// show/hide direct children
foreach(QObject* child, children())
{
if (child->isWidgetType())
static_cast<QWidget*>(child)->setVisible(expanded);
}
if (expanded) {
setFlat(qxt_d().flat);
} else {
qxt_d().flat = isFlat();
setFlat(true);
}
}
}
friend class QxtGroupBoxPrivate [friend] |
Definition at line 37 of file qxtgroupbox.h.
QxtGroupBox::collapsive [read, write] |
This property holds whether the group box is collapsive.
Definition at line 37 of file qxtgroupbox.h.
Referenced by setCollapsive(), and setExpanded().
1.7.2