15 #include <QDialogButtonBox>
17 #include <QHBoxLayout>
19 #include <QListWidget>
20 #include <QListWidgetItem>
21 #include <QPushButton>
23 #include <QSizePolicy>
24 #include <QStackedWidget>
25 #include <QVBoxLayout>
26 #include "../../util/btassert.h"
27 #include "../../util/btconnect.h"
28 #include "../messagedialog.h"
35 listWidget.setFixedWidth(
36 listWidget.visualItemRect(listWidget.item(0)).width()
37 + listWidget.frameWidth() * 2);
57 if (m_ownsListWidgetItem)
58 delete m_listWidgetItem;
62 { m_listWidgetItem->setText(headerText); }
66 Qt::WindowFlags
const flags)
71 QHBoxLayout *
const mainLayout =
new QHBoxLayout(
this);
82 auto *
const pageLayout =
new QVBoxLayout;
84 mainLayout->addLayout(pageLayout);
90 m_pageWidget->setSizePolicy(QSizePolicy::MinimumExpanding,
91 QSizePolicy::MinimumExpanding);
95 buttonBoxRuler->setGeometry(QRect(1, 1, 1, 3));
96 buttonBoxRuler->setFrameShape(QFrame::HLine);
97 buttonBoxRuler->setFrameShadow(QFrame::Sunken);
98 buttonBoxRuler->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
99 pageLayout->addWidget(buttonBoxRuler);
102 auto *
const bbox =
new QDialogButtonBox(
this);
103 BT_CONNECT(bbox->addButton(QDialogButtonBox::Ok),
104 &QPushButton::clicked,
105 [
this] { save(); close(); });
106 BT_CONNECT(bbox->addButton(QDialogButtonBox::Apply),
107 &QPushButton::clicked,
109 BT_CONNECT(bbox->addButton(QDialogButtonBox::Cancel),
110 &QPushButton::clicked,
113 pageLayout->addWidget(bbox);
bool m_ownsListWidgetItem
void setHeaderText(QString const &headerText)
QListWidgetItem *const m_listWidgetItem
Page(QIcon const &icon, QWidget *const parent=nullptr)
~Page() noexcept override
void addPage(Page *const pageWidget)
Adds the page to this dialog, taking ownership.
QListWidget *const m_contentsList
QStackedWidget *const m_pageWidget
void signalSettingsChanged()
BtConfigDialog(QWidget *const parent=nullptr, Qt::WindowFlags const flags=Qt::WindowFlags())
void resizeListWidget(QListWidget &listWidget)
void prepareDialogBox(QDialogButtonBox *box)