1/*
2 This file is part of the KDE project
3 SPDX-FileCopyrightText: 2007 Matthias Kretz <kretz@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.0-only
6*/
7
8#ifndef PAGED_KPAGEDIALOG_P_H
9#define PAGED_KPAGEDIALOG_P_H
10
11#include "kpagedialog.h"
12#include <QAbstractItemView>
13#include <QDialogButtonBox>
14#include <QLayout>
15
16class KPageDialogPrivate
17{
18 Q_DECLARE_PUBLIC(KPageDialog)
19public:
20 KPageDialogPrivate(KPageDialog *qq)
21 : q_ptr(qq)
22 , mPageWidget(nullptr)
23 , mButtonBox(nullptr)
24 {
25 }
26
27 virtual ~KPageDialogPrivate()
28 {
29 }
30
31 KPageDialog *const q_ptr;
32 KPageWidget *mPageWidget;
33 QDialogButtonBox *mButtonBox;
34
35 void init()
36 {
37 Q_Q(KPageDialog);
38 delete q->layout();
39
40 QVBoxLayout *layout = new QVBoxLayout(q);
41 layout->setContentsMargins(left: 0, top: 0, right: 0, bottom: 0);
42
43 if (mPageWidget) {
44 q->connect(sender: mPageWidget, signal: &KPageWidget::currentPageChanged, context: q, slot: &KPageDialog::currentPageChanged);
45 q->connect(sender: mPageWidget, signal: &KPageWidget::pageRemoved, context: q, slot: &KPageDialog::pageRemoved);
46 layout->addWidget(mPageWidget);
47 } else {
48 layout->addStretch();
49 }
50
51 if (mButtonBox) {
52 q->connect(sender: mButtonBox, signal: &QDialogButtonBox::accepted, context: q, slot: &QDialog::accept);
53 q->connect(sender: mButtonBox, signal: &QDialogButtonBox::rejected, context: q, slot: &QDialog::reject);
54 if (mPageWidget) {
55 mPageWidget->setPageFooter(mButtonBox);
56 } else {
57 layout->addWidget(mButtonBox);
58 }
59 }
60 }
61};
62
63#endif // PAGED_KPAGEDIALOG_P_H
64

source code of kwidgetsaddons/src/kpagedialog_p.h