32 bool defaultCollapsed =
false, QWidget* parent =
nullptr)
33 : QWidget(parent), settingsKey_(settingsKey), defaultCollapsed_(defaultCollapsed)
35 QVBoxLayout* mainLayout =
new QVBoxLayout(
this);
36 mainLayout->setContentsMargins(0, 0, 0, 0);
37 mainLayout->setSpacing(0);
40 headerWidget_ =
new QWidget(
this);
41 headerWidget_->setCursor(Qt::PointingHandCursor);
42 QHBoxLayout* headerLayout =
new QHBoxLayout(headerWidget_);
43 headerLayout->setContentsMargins(16, 6, 16, 6);
44 headerLayout->setSpacing(6);
46 arrowLabel_ =
new QLabel(headerWidget_);
47 arrowLabel_->setFixedWidth(14);
49 titleLabel_ =
new QLabel(title, headerWidget_);
51 headerLayout->addWidget(arrowLabel_);
52 headerLayout->addWidget(titleLabel_, 1);
54 mainLayout->addWidget(headerWidget_);
57 contentWidget_ =
new QWidget(
this);
58 contentLayout_ =
new QVBoxLayout(contentWidget_);
59 contentLayout_->setContentsMargins(0, 0, 0, 0);
60 contentLayout_->setSpacing(0);
62 mainLayout->addWidget(contentWidget_);
65 animation_ =
new QPropertyAnimation(
this,
"contentHeight",
this);
66 animation_->setDuration(150);
67 animation_->setEasingCurve(QEasingCurve::OutCubic);
70 headerWidget_->installEventFilter(
this);
74 collapsed_ = settings.value(settingsKey_, defaultCollapsed_).toBool();
77 contentWidget_->setVisible(!collapsed_);