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
qdesigner_appearanceoptions.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
"qdesigner_appearanceoptions.h"
6
#
include
"ui_qdesigner_appearanceoptions.h"
7
8
#
include
"qdesigner_settings.h"
9
#
include
"qdesigner_toolwindow.h"
10
11
#
include
<
QtDesigner
/
abstractformeditor
.
h
>
12
#
include
<
QtCore
/
qtimer
.
h
>
13
#
include
<
QtCore
/
qdebug
.
h
>
14
15
QT_BEGIN_NAMESPACE
16
17
// ---------------- AppearanceOptions
18
void
AppearanceOptions
::
toSettings
(
QDesignerSettings
&settings)
const
19
{
20
settings
.
setUiMode
(
uiMode
)
;
21
settings
.
setToolWindowFont
(toolWindowFontSettings);
22
}
23
24
void
AppearanceOptions
::
fromSettings
(
const
QDesignerSettings
&settings)
25
{
26
uiMode
= settings
.
uiMode
(
)
;
27
toolWindowFontSettings = settings.toolWindowFont();
28
}
29
30
// ---------------- QDesignerAppearanceOptionsWidget
31
QDesignerAppearanceOptionsWidget
::QDesignerAppearanceOptionsWidget(
QWidget
*parent) :
32
QWidget(parent),
33
m_ui(
new
QT_PREPEND_NAMESPACE(Ui)::AppearanceOptionsWidget)
34
{
35
m_ui->setupUi(
this
);
36
37
m_ui->m_uiModeCombo->addItem(tr(
"Docked Window"
), QVariant(
DockedMode
));
38
m_ui->m_uiModeCombo->addItem(tr(
"Multiple Top-Level Windows"
), QVariant(
TopLevelMode
));
39
connect(m_ui->m_uiModeCombo, &QComboBox::currentIndexChanged,
40
this
, &QDesignerAppearanceOptionsWidget::slotUiModeComboChanged);
41
42
m_ui->m_fontPanel->setCheckable(
true
);
43
m_ui->m_fontPanel->setTitle(tr(
"Toolwindow Font"
));
44
45
}
46
47
QDesignerAppearanceOptionsWidget
::~
QDesignerAppearanceOptionsWidget
()
48
{
49
delete
m_ui;
50
}
51
52
UIMode
QDesignerAppearanceOptionsWidget
::uiMode()
const
53
{
54
return
static_cast
<
UIMode
>(m_ui->m_uiModeCombo->itemData(m_ui->m_uiModeCombo->currentIndex()).toInt());
55
}
56
57
AppearanceOptions
QDesignerAppearanceOptionsWidget
::
appearanceOptions
()
const
58
{
59
AppearanceOptions
rc;
60
rc
.
uiMode
= uiMode();
61
rc.toolWindowFontSettings.m_font = m_ui->m_fontPanel->selectedFont();
62
rc.toolWindowFontSettings.m_useFont = m_ui->m_fontPanel->isChecked();
63
rc.toolWindowFontSettings.m_writingSystem = m_ui->m_fontPanel->writingSystem();
64
return
rc;
65
}
66
67
void
QDesignerAppearanceOptionsWidget
::
setAppearanceOptions
(
const
AppearanceOptions
&ao)
68
{
69
m_initialUIMode = ao
.
uiMode
;
70
m_ui->m_uiModeCombo->setCurrentIndex(m_ui->m_uiModeCombo->findData(QVariant(ao
.
uiMode
)));
71
m_ui->m_fontPanel->setWritingSystem(ao.toolWindowFontSettings.m_writingSystem);
72
m_ui->m_fontPanel->setSelectedFont(ao.toolWindowFontSettings.m_font);
73
m_ui->m_fontPanel->setChecked(ao.toolWindowFontSettings.m_useFont);
74
}
75
76
void
QDesignerAppearanceOptionsWidget
::slotUiModeComboChanged()
77
{
78
emit uiModeChanged(m_initialUIMode != uiMode());
79
}
80
81
// ----------- QDesignerAppearanceOptionsPage
82
QDesignerAppearanceOptionsPage
::QDesignerAppearanceOptionsPage(QDesignerFormEditorInterface *core) :
83
m_core(core)
84
{
85
}
86
87
QString
QDesignerAppearanceOptionsPage
::
name
()
const
88
{
89
//: Tab in preferences dialog
90
return
QCoreApplication::translate(
"QDesignerAppearanceOptionsPage"
,
"Appearance"
);
91
}
92
93
QWidget
*
QDesignerAppearanceOptionsPage
::createPage(
QWidget
*parent)
94
{
95
m_widget =
new
QDesignerAppearanceOptionsWidget(parent);
96
m_initialOptions.fromSettings(QDesignerSettings(m_core));
97
m_widget->setAppearanceOptions(m_initialOptions);
98
return
m_widget;
99
}
100
101
void
QDesignerAppearanceOptionsPage
::
apply
()
102
{
103
if
(m_widget) {
104
const
AppearanceOptions
newOptions = m_widget->appearanceOptions();
105
if
(newOptions != m_initialOptions) {
106
QDesignerSettings
settings
(
m_core
)
;
107
newOptions
.
toSettings
(
settings
)
;
108
m_initialOptions = newOptions;
109
emit settingsChanged();
110
}
111
}
112
}
113
114
void
QDesignerAppearanceOptionsPage
::
finish
()
115
{
116
}
117
118
QT_END_NAMESPACE
QDesignerAppearanceOptionsPage
Definition
qdesigner_appearanceoptions.h:72
QDesignerAppearanceOptionsPage::name
QString name() const override
Definition
qdesigner_appearanceoptions.cpp:87
QDesignerAppearanceOptionsPage::apply
void apply() override
Definition
qdesigner_appearanceoptions.cpp:101
QDesignerAppearanceOptionsPage::finish
void finish() override
Definition
qdesigner_appearanceoptions.cpp:114
QDesignerAppearanceOptionsWidget
Definition
qdesigner_appearanceoptions.h:47
QDesignerAppearanceOptionsWidget::~QDesignerAppearanceOptionsWidget
~QDesignerAppearanceOptionsWidget() override
Definition
qdesigner_appearanceoptions.cpp:47
QDesignerAppearanceOptionsWidget::setAppearanceOptions
void setAppearanceOptions(const AppearanceOptions &ao)
Definition
qdesigner_appearanceoptions.cpp:67
QDesignerAppearanceOptionsWidget::appearanceOptions
AppearanceOptions appearanceOptions() const
Definition
qdesigner_appearanceoptions.cpp:57
QDesignerSettings
Definition
qdesigner_settings.h:22
QDesignerSettings::setToolWindowFont
void setToolWindowFont(const ToolWindowFontSettings &fontSettings)
Definition
qdesigner_settings.cpp:189
QDesignerSettings::setUiMode
void setUiMode(UIMode mode)
Definition
qdesigner_settings.cpp:174
QDesignerSettings::uiMode
UIMode uiMode() const
Definition
qdesigner_settings.cpp:182
QDesignerSettings::QDesignerSettings
QDesignerSettings(QDesignerFormEditorInterface *core)
Definition
qdesigner_settings.cpp:40
QPainter::QWidget
friend class QWidget
Definition
qpainter.h:432
UIMode
UIMode
Definition
designer_enums.h:9
TopLevelMode
@ TopLevelMode
Definition
designer_enums.h:11
DockedMode
@ DockedMode
Definition
designer_enums.h:12
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
AppearanceOptions
Definition
qdesigner_appearanceoptions.h:29
AppearanceOptions::toSettings
void toSettings(QDesignerSettings &) const
Definition
qdesigner_appearanceoptions.cpp:18
AppearanceOptions::fromSettings
void fromSettings(const QDesignerSettings &)
Definition
qdesigner_appearanceoptions.cpp:24
AppearanceOptions::uiMode
UIMode uiMode
Definition
qdesigner_appearanceoptions.h:33
qttools
src
designer
src
designer
qdesigner_appearanceoptions.cpp
Generated on
for Qt by
1.18.0