Krita Source Code Documentation
Loading...
Searching...
No Matches
KarbonCalligraphyOptionWidget.h
Go to the documentation of this file.
1
/* This file is part of the KDE project
2
SPDX-FileCopyrightText: 2008 Fela Winkelmolen <fela.kde@gmail.com>
3
4
SPDX-License-Identifier: LGPL-2.0-or-later
5
*/
6
7
#ifndef KARBONCALLIGRAPHYOPTIONWIDGET_H
8
#define KARBONCALLIGRAPHYOPTIONWIDGET_H
9
10
#include <QWidget>
11
#include <QMap>
12
13
class
KComboBox;
14
class
QCheckBox;
15
class
QDoubleSpinBox;
16
class
QToolButton;
17
class
KisAngleSelector
;
18
19
class
KarbonCalligraphyOptionWidget
:
public
QWidget
20
{
21
Q_OBJECT
22
public
:
23
explicit
KarbonCalligraphyOptionWidget
();
24
~KarbonCalligraphyOptionWidget
()
override
;
25
26
// emits all signals with the appropriate values
27
// called once the signals are connected inside KarbonCalligraphyTool
28
// to make sure all parameters are uptodate
29
void
emitAll
();
30
31
Q_SIGNALS:
32
// all the following signals Q_EMIT user friendly values, not the internal
33
// values which are instead computed directly by KarbonCalligraphyTool
34
void
usePathChanged
(
bool
);
35
void
usePressureChanged
(
bool
);
36
void
useAngleChanged
(
bool
);
37
void
widthChanged
(
double
);
38
void
thinningChanged
(
double
);
39
void
angleChanged
(
int
);
40
void
fixationChanged
(
double
);
41
void
capsChanged
(
double
);
42
void
massChanged
(
double
);
43
void
dragChanged
(
double
);
44
45
public
Q_SLOTS:
46
// needed for the shortcuts
47
void
increaseWidth
();
48
void
decreaseWidth
();
49
void
increaseAngle
();
50
void
decreaseAngle
();
51
52
private
Q_SLOTS:
53
void
loadProfile
(
const
QString &name);
54
void
toggleUseAngle
(
bool
checked);
55
void
updateCurrentProfile
();
56
void
saveProfileAs
();
57
void
removeProfile
();
58
59
void
setUsePathEnabled
(
bool
enabled);
60
61
void
on_m_angleBox_angleChanged
(qreal angle);
62
63
private
:
64
// TODO: maybe make it a hash?? <QString, QVariant>
65
// is it needed al all??
66
struct
Profile
{
67
QString
name
;
68
int
index
;
// index in the config file
69
bool
usePath
;
70
bool
usePressure
;
71
bool
useAngle
;
72
qreal
width
;
73
qreal
thinning
;
74
int
angle
;
75
qreal
fixation
;
76
qreal
caps
;
77
qreal
mass
;
78
qreal
drag
;
79
};
80
81
// convenience functions:
82
83
// connects signals and slots
84
void
createConnections
();
85
86
// if they aren't already added adds the default profiles
87
// called by the ctor
88
void
addDefaultProfiles
();
89
90
// load the profiles from the configuration file
91
void
loadProfiles
();
92
93
// loads the profile set as current profile in the configuration file
94
void
loadCurrentProfile
();
95
96
// save a new profile using the values of the input boxes
97
// if a profile with the same name already exists it will be overwritten
98
void
saveProfile
(
const
QString &name);
99
100
// removes the profile from the configuration file, from profiles
101
// and from the combobox.
102
// if the profile doesn't exist the function does nothing
103
void
removeProfile
(
const
QString &name);
104
105
// returns the position inside profiles of a certain profile
106
// returns -1 if the profile is not found
107
int
profilePosition
(
const
QString &profileName);
108
109
private
:
110
typedef
QMap<QString, Profile *>
ProfileMap
;
111
ProfileMap
m_profiles
;
112
113
KComboBox *
m_comboBox
;
114
QCheckBox *
m_usePath
;
115
QCheckBox *
m_usePressure
;
116
QCheckBox *
m_useAngle
;
117
QDoubleSpinBox *
m_widthBox
;
118
QDoubleSpinBox *
m_thinningBox
;
119
KisAngleSelector
*
m_angleBox
;
120
QDoubleSpinBox *
m_capsBox
;
121
QDoubleSpinBox *
m_fixationBox
;
122
QDoubleSpinBox *
m_massBox
;
123
QDoubleSpinBox *
m_dragBox
;
124
125
QToolButton *
m_saveButton
;
126
QToolButton *
m_removeButton
;
127
128
// when true updateCurrentProfile() doesn't do anything
129
bool
m_changingProfile
;
130
};
131
132
#endif
// KARBONCALLIGRAPHYOPTIONWIDGET_H
KarbonCalligraphyOptionWidget
Definition
KarbonCalligraphyOptionWidget.h:20
KarbonCalligraphyOptionWidget::increaseAngle
void increaseAngle()
Definition
KarbonCalligraphyOptionWidget.cpp:265
KarbonCalligraphyOptionWidget::usePressureChanged
void usePressureChanged(bool)
KarbonCalligraphyOptionWidget::m_removeButton
QToolButton * m_removeButton
Definition
KarbonCalligraphyOptionWidget.h:126
KarbonCalligraphyOptionWidget::ProfileMap
QMap< QString, Profile * > ProfileMap
Definition
KarbonCalligraphyOptionWidget.h:110
KarbonCalligraphyOptionWidget::saveProfile
void saveProfile(const QString &name)
Definition
KarbonCalligraphyOptionWidget.cpp:467
KarbonCalligraphyOptionWidget::m_changingProfile
bool m_changingProfile
Definition
KarbonCalligraphyOptionWidget.h:129
KarbonCalligraphyOptionWidget::updateCurrentProfile
void updateCurrentProfile()
Definition
KarbonCalligraphyOptionWidget.cpp:194
KarbonCalligraphyOptionWidget::m_capsBox
QDoubleSpinBox * m_capsBox
Definition
KarbonCalligraphyOptionWidget.h:120
KarbonCalligraphyOptionWidget::saveProfileAs
void saveProfileAs()
Definition
KarbonCalligraphyOptionWidget.cpp:201
KarbonCalligraphyOptionWidget::m_widthBox
QDoubleSpinBox * m_widthBox
Definition
KarbonCalligraphyOptionWidget.h:117
KarbonCalligraphyOptionWidget::emitAll
void emitAll()
Definition
KarbonCalligraphyOptionWidget.cpp:160
KarbonCalligraphyOptionWidget::angleChanged
void angleChanged(int)
KarbonCalligraphyOptionWidget::m_thinningBox
QDoubleSpinBox * m_thinningBox
Definition
KarbonCalligraphyOptionWidget.h:118
KarbonCalligraphyOptionWidget::decreaseAngle
void decreaseAngle()
Definition
KarbonCalligraphyOptionWidget.cpp:270
KarbonCalligraphyOptionWidget::m_massBox
QDoubleSpinBox * m_massBox
Definition
KarbonCalligraphyOptionWidget.h:122
KarbonCalligraphyOptionWidget::m_dragBox
QDoubleSpinBox * m_dragBox
Definition
KarbonCalligraphyOptionWidget.h:123
KarbonCalligraphyOptionWidget::m_usePath
QCheckBox * m_usePath
Definition
KarbonCalligraphyOptionWidget.h:114
KarbonCalligraphyOptionWidget::capsChanged
void capsChanged(double)
KarbonCalligraphyOptionWidget::m_comboBox
KComboBox * m_comboBox
Definition
KarbonCalligraphyOptionWidget.h:113
KarbonCalligraphyOptionWidget::KarbonCalligraphyOptionWidget
KarbonCalligraphyOptionWidget()
Definition
KarbonCalligraphyOptionWidget.cpp:49
KarbonCalligraphyOptionWidget::m_useAngle
QCheckBox * m_useAngle
Definition
KarbonCalligraphyOptionWidget.h:116
KarbonCalligraphyOptionWidget::m_fixationBox
QDoubleSpinBox * m_fixationBox
Definition
KarbonCalligraphyOptionWidget.h:121
KarbonCalligraphyOptionWidget::m_usePressure
QCheckBox * m_usePressure
Definition
KarbonCalligraphyOptionWidget.h:115
KarbonCalligraphyOptionWidget::usePathChanged
void usePathChanged(bool)
KarbonCalligraphyOptionWidget::fixationChanged
void fixationChanged(double)
KarbonCalligraphyOptionWidget::profilePosition
int profilePosition(const QString &profileName)
Definition
KarbonCalligraphyOptionWidget.cpp:589
KarbonCalligraphyOptionWidget::toggleUseAngle
void toggleUseAngle(bool checked)
Definition
KarbonCalligraphyOptionWidget.cpp:250
KarbonCalligraphyOptionWidget::loadProfiles
void loadProfiles()
Definition
KarbonCalligraphyOptionWidget.cpp:395
KarbonCalligraphyOptionWidget::removeProfile
void removeProfile()
Definition
KarbonCalligraphyOptionWidget.cpp:245
KarbonCalligraphyOptionWidget::~KarbonCalligraphyOptionWidget
~KarbonCalligraphyOptionWidget() override
Definition
KarbonCalligraphyOptionWidget.cpp:155
KarbonCalligraphyOptionWidget::addDefaultProfiles
void addDefaultProfiles()
Definition
KarbonCalligraphyOptionWidget.cpp:353
KarbonCalligraphyOptionWidget::m_saveButton
QToolButton * m_saveButton
Definition
KarbonCalligraphyOptionWidget.h:125
KarbonCalligraphyOptionWidget::createConnections
void createConnections()
Definition
KarbonCalligraphyOptionWidget.cpp:279
KarbonCalligraphyOptionWidget::m_profiles
ProfileMap m_profiles
Definition
KarbonCalligraphyOptionWidget.h:111
KarbonCalligraphyOptionWidget::decreaseWidth
void decreaseWidth()
Definition
KarbonCalligraphyOptionWidget.cpp:260
KarbonCalligraphyOptionWidget::dragChanged
void dragChanged(double)
KarbonCalligraphyOptionWidget::loadCurrentProfile
void loadCurrentProfile()
Definition
KarbonCalligraphyOptionWidget.cpp:437
KarbonCalligraphyOptionWidget::widthChanged
void widthChanged(double)
KarbonCalligraphyOptionWidget::setUsePathEnabled
void setUsePathEnabled(bool enabled)
Definition
KarbonCalligraphyOptionWidget.cpp:603
KarbonCalligraphyOptionWidget::loadProfile
void loadProfile(const QString &name)
Definition
KarbonCalligraphyOptionWidget.cpp:174
KarbonCalligraphyOptionWidget::m_angleBox
KisAngleSelector * m_angleBox
Definition
KarbonCalligraphyOptionWidget.h:119
KarbonCalligraphyOptionWidget::on_m_angleBox_angleChanged
void on_m_angleBox_angleChanged(qreal angle)
Definition
KarbonCalligraphyOptionWidget.cpp:608
KarbonCalligraphyOptionWidget::increaseWidth
void increaseWidth()
Definition
KarbonCalligraphyOptionWidget.cpp:255
KarbonCalligraphyOptionWidget::thinningChanged
void thinningChanged(double)
KarbonCalligraphyOptionWidget::massChanged
void massChanged(double)
KarbonCalligraphyOptionWidget::useAngleChanged
void useAngleChanged(bool)
KisAngleSelector
A widget with several options to select an angle.
Definition
KisAngleSelector.h:61
KarbonCalligraphyOptionWidget::Profile
Definition
KarbonCalligraphyOptionWidget.h:66
KarbonCalligraphyOptionWidget::Profile::drag
qreal drag
Definition
KarbonCalligraphyOptionWidget.h:78
KarbonCalligraphyOptionWidget::Profile::usePath
bool usePath
Definition
KarbonCalligraphyOptionWidget.h:69
KarbonCalligraphyOptionWidget::Profile::useAngle
bool useAngle
Definition
KarbonCalligraphyOptionWidget.h:71
KarbonCalligraphyOptionWidget::Profile::angle
int angle
Definition
KarbonCalligraphyOptionWidget.h:74
KarbonCalligraphyOptionWidget::Profile::fixation
qreal fixation
Definition
KarbonCalligraphyOptionWidget.h:75
KarbonCalligraphyOptionWidget::Profile::name
QString name
Definition
KarbonCalligraphyOptionWidget.h:67
KarbonCalligraphyOptionWidget::Profile::thinning
qreal thinning
Definition
KarbonCalligraphyOptionWidget.h:73
KarbonCalligraphyOptionWidget::Profile::usePressure
bool usePressure
Definition
KarbonCalligraphyOptionWidget.h:70
KarbonCalligraphyOptionWidget::Profile::width
qreal width
Definition
KarbonCalligraphyOptionWidget.h:72
KarbonCalligraphyOptionWidget::Profile::index
int index
Definition
KarbonCalligraphyOptionWidget.h:68
KarbonCalligraphyOptionWidget::Profile::mass
qreal mass
Definition
KarbonCalligraphyOptionWidget.h:77
KarbonCalligraphyOptionWidget::Profile::caps
qreal caps
Definition
KarbonCalligraphyOptionWidget.h:76
plugins
tools
karbonplugins
tools
CalligraphyTool
KarbonCalligraphyOptionWidget.h
Generated at
2025-11-04 02:30:02+01:00
from
Krita
branch
master
, commit
c9dde2e79561a8aea4a7e8d9ac99c98a7bac9e52