Krita Source Code Documentation
Loading...
Searching...
No Matches
SpiralShapeConfigWidget.cpp
Go to the documentation of this file.
1/* This file is part of the KDE project
2 * SPDX-FileCopyrightText: 2007 Rob Buis <buis@kde.org>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
9#include <klocalizedstring.h>
10
12{
13 widget.setupUi(this);
14
15 widget.spiralType->clear();
16 widget.spiralType->addItem(i18n("Curve"));
17 widget.spiralType->addItem(i18n("Line"));
18
19 widget.fade->setMinimum(0.0);
20 widget.fade->setMaximum(1.0);
21
22 widget.clockWise->clear();
23 widget.clockWise->addItem(i18n("Clockwise"));
24 widget.clockWise->addItem(i18n("Anticlockwise"));
25
26 connect(widget.spiralType, SIGNAL(currentIndexChanged(int)), this, SIGNAL(propertyChanged()));
27 connect(widget.clockWise, SIGNAL(currentIndexChanged(int)), this, SIGNAL(propertyChanged()));
28 connect(widget.fade, SIGNAL(editingFinished()), this, SIGNAL(propertyChanged()));
29}
30
32{
33 m_spiral = dynamic_cast<SpiralShape *>(shape);
34 if (!m_spiral) {
35 return;
36 }
37
38 widget.spiralType->blockSignals(true);
39 widget.clockWise->blockSignals(true);
40 widget.fade->blockSignals(true);
41
42 widget.spiralType->setCurrentIndex(m_spiral->type());
43 widget.clockWise->setCurrentIndex(m_spiral->clockWise() ? 0 : 1);
44 widget.fade->setValue(m_spiral->fade());
45
46 widget.spiralType->blockSignals(false);
47 widget.clockWise->blockSignals(false);
48 widget.fade->blockSignals(false);
49}
50
52{
53 if (!m_spiral) {
54 return;
55 }
56
57 m_spiral->setType(static_cast<SpiralShape::SpiralType>(widget.spiralType->currentIndex()));
58 m_spiral->setClockWise(widget.clockWise->currentIndex() == 0);
59 m_spiral->setFade(widget.fade->value());
60}
61
63{
64 if (!m_spiral) {
65 return 0;
66 }
67 SpiralShape::SpiralType type = static_cast<SpiralShape::SpiralType>(widget.spiralType->currentIndex());
68 return new SpiralShapeConfigCommand(m_spiral, type, (widget.clockWise->currentIndex() == 0), widget.fade->value());
69}
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
void propertyChanged()
is emitted after one of the config options has changed
The undo / redo command for configuring a spiral shape.
void save() override
reimplemented
Ui::SpiralShapeConfigWidget widget
void open(KoShape *shape) override
reimplemented
KUndo2Command * createCommand() override
reimplemented
SpiralType
the possible spiral types
Definition SpiralShape.h:22
void setType(SpiralType type)
bool clockWise() const
void setClockWise(bool clockwise)
qreal fade() const
Returns the actual fade parameter.
SpiralType type() const
Returns the actual spiral type.
void setFade(qreal fade)