File indexing completed on 2025-02-02 14:20:06
0001 /* 0002 This file is part of the KDE project 0003 SPDX-FileCopyrightText: 2007 Matthias Kretz <kretz@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.0-only 0006 */ 0007 0008 #ifndef PAGED_KPAGEDIALOG_P_H 0009 #define PAGED_KPAGEDIALOG_P_H 0010 0011 #include "kpagedialog.h" 0012 #include <QAbstractItemView> 0013 #include <QDialogButtonBox> 0014 #include <QLayout> 0015 0016 class KPageDialogPrivate 0017 { 0018 Q_DECLARE_PUBLIC(KPageDialog) 0019 public: 0020 KPageDialogPrivate(KPageDialog *qq) 0021 : q_ptr(qq) 0022 , mPageWidget(nullptr) 0023 , mButtonBox(nullptr) 0024 { 0025 } 0026 0027 virtual ~KPageDialogPrivate() 0028 { 0029 } 0030 0031 KPageDialog *const q_ptr; 0032 KPageWidget *mPageWidget; 0033 QDialogButtonBox *mButtonBox; 0034 0035 void init() 0036 { 0037 Q_Q(KPageDialog); 0038 delete q->layout(); 0039 0040 QVBoxLayout *layout = new QVBoxLayout(q); 0041 layout->setContentsMargins(0, 0, 0, 0); 0042 0043 if (mPageWidget) { 0044 q->connect(mPageWidget, &KPageWidget::currentPageChanged, q, &KPageDialog::currentPageChanged); 0045 q->connect(mPageWidget, &KPageWidget::pageRemoved, q, &KPageDialog::pageRemoved); 0046 layout->addWidget(mPageWidget); 0047 } else { 0048 layout->addStretch(); 0049 } 0050 0051 if (mButtonBox) { 0052 q->connect(mButtonBox, &QDialogButtonBox::accepted, q, &QDialog::accept); 0053 q->connect(mButtonBox, &QDialogButtonBox::rejected, q, &QDialog::reject); 0054 if (mPageWidget) { 0055 mPageWidget->setPageFooter(mButtonBox); 0056 } else { 0057 layout->addWidget(mButtonBox); 0058 } 0059 } 0060 } 0061 }; 0062 0063 #endif // PAGED_KPAGEDIALOG_P_H