Mechanics of Defect Evolution Library
Loading...
Searching...
No Matches
DDqtControls.cpp
Go to the documentation of this file.
1/* This file is part of MoDELib, distributed under GNU GPL v2. */
2#include <DDqtControls.h>
3
4namespace model::controls
5{
6
7 auto GroupBox::showEvent(QShowEvent *event) -> void
8 {
9 if (isCheckable() && !body && layout())
10 {
11 body = new QWidget(this);
12 body->setLayout(layout());
13 auto *outer = new QVBoxLayout(this);
14 outer->setContentsMargins(0, 0, 0, 0);
15 outer->setSpacing(0);
16 outer->addWidget(body);
17 body->setVisible(isChecked());
18 }
19 QGroupBox::showEvent(event);
20 }
21
22 GroupBox::GroupBox(const QString &title, QWidget *parent) : QGroupBox(title, parent)
23 {
24 setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
25 connect(this, &QGroupBox::toggled, this,
26 [this](bool checked)
27 {
28 if (body)
29 {
30 body->setVisible(checked);
31 updateGeometry();
32 }
33 });
34 }
35} // namespace model::controls
void showEvent(QShowEvent *event) override
GroupBox(const QString &title, QWidget *parent=nullptr)
int parent