QGroupBox基本如下:
class Q_GUI_EXPORT QGroupBox : public QWidget
{
public:
explicit QGroupBox(QWidget* parent=0);
explicit QGroupBox(const QString &title, QWidget* parent=0);
~QGroupBox();
QString title() const;
void setTitle(const QString &title);
Qt::Alignment alignment() const;
void setAlignment(int alignment);
QSize minimumSizeHint() const;
bool isFlat() const;
void setFlat(bool flat);
bool isCheckable() const;
void setCheckable(bool checkable);
bool isChecked() const;
public Q_SLOTS:
void setChecked(bool checked);
Q_SIGNALS:
void clicked(bool checked = false);
void toggled(bool);
};
其中
setFlat控制显示外框与否
setCheckable()设置QGroupBox是否为活动状态
如果可以当前QGroupBox是活动状态,则点击QGroupBox则激发toggled