Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
preferencesdialog.cpp
Go to the documentation of this file.
1
// Copyright (C) 2016 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
// Qt-Security score:significant reason:default
4
5
#
include
"preferencesdialog.h"
6
#
include
"ui_preferencesdialog.h"
7
#
include
"qdesigner_appearanceoptions.h"
8
9
#
include
<
QtDesigner
/
abstractoptionspage
.
h
>
10
#
include
<
QtDesigner
/
abstractformeditor
.
h
>
11
12
#
include
<
QtWidgets
/
qfiledialog
.
h
>
13
#
include
<
QtWidgets
/
qpushbutton
.
h
>
14
15
QT_BEGIN_NAMESPACE
16
17
PreferencesDialog
::
PreferencesDialog
(
QDesignerFormEditorInterface
*
core
,
QWidget
*
parentWidget
) :
18
QDialog(parentWidget),
19
m_ui(
new
QT_PREPEND_NAMESPACE(Ui)::PreferencesDialog())
20
{
21
m_ui->setupUi(
this
);
22
23
m_optionsPages = core->optionsPages();
24
25
m_ui->m_optionTabWidget->clear();
26
for
(QDesignerOptionsPageInterface *optionsPage : std::as_const(m_optionsPages)) {
27
QWidget *page = optionsPage->createPage(
this
);
28
m_ui->m_optionTabWidget->addTab(page, optionsPage->name());
29
if
(
auto
*appearanceWidget = qobject_cast<QDesignerAppearanceOptionsWidget *>(page))
30
connect(appearanceWidget, &QDesignerAppearanceOptionsWidget::uiModeChanged,
31
this
, &PreferencesDialog::slotUiModeChanged);
32
}
33
34
connect(m_ui->m_dialogButtonBox, &QDialogButtonBox::rejected,
this
, &PreferencesDialog::slotRejected);
35
connect(m_ui->m_dialogButtonBox, &QDialogButtonBox::accepted,
this
, &PreferencesDialog::slotAccepted);
36
connect(applyButton(), &QAbstractButton::clicked,
this
, &PreferencesDialog::slotApply);
37
}
38
39
PreferencesDialog
::~
PreferencesDialog
()
40
{
41
delete
m_ui;
42
}
43
44
QPushButton *
PreferencesDialog
::applyButton()
const
45
{
46
return
m_ui->m_dialogButtonBox->button(QDialogButtonBox::Apply);
47
}
48
49
void
PreferencesDialog
::slotApply()
50
{
51
for
(QDesignerOptionsPageInterface *optionsPage : std::as_const(m_optionsPages))
52
optionsPage->apply();
53
}
54
55
void
PreferencesDialog
::slotAccepted()
56
{
57
slotApply();
58
closeOptionPages();
59
accept();
60
}
61
62
void
PreferencesDialog
::slotRejected()
63
{
64
closeOptionPages();
65
reject();
66
}
67
68
void
PreferencesDialog
::slotUiModeChanged(
bool
modified)
69
{
70
// Cannot "apply" a ui mode change (destroy the dialogs parent)
71
applyButton()->setEnabled(!modified);
72
}
73
74
void
PreferencesDialog
::closeOptionPages()
75
{
76
for
(QDesignerOptionsPageInterface *optionsPage : std::as_const(m_optionsPages))
77
optionsPage->finish();
78
}
79
80
QT_END_NAMESPACE
PreferencesDialog
Definition
preferencesdialog.h:20
PreferencesDialog::~PreferencesDialog
~PreferencesDialog() override
Definition
preferencesdialog.cpp:39
QDesignerFormEditorInterface
The QDesignerFormEditorInterface class allows you to access Qt Widgets Designer's various components.
Definition
abstractformeditor.h:43
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qttools
src
designer
src
designer
preferencesdialog.cpp
Generated on
for Qt by
1.18.0