9#include "ui_KoShadowConfigWidget.h"
21#include <klocalizedstring.h>
42 d->widget.setupUi(
this);
43 d->widget.shadowOffset->setValue(8.0);
44 d->widget.shadowBlur->setValue(8.0);
45 d->widget.shadowBlur->setMinimum(0.0);
46 d->widget.shadowAngle->setValue(315.0);
47 d->widget.shadowAngle->setMinimum(0.0);
48 d->widget.shadowAngle->setMaximum(360.0);
49 d->widget.shadowVisible->setChecked(
false);
53 d->actionShadowColor->setCurrentColor(QColor(0, 0, 0, 192));
54 d->actionShadowColor->setIcon(
koIcon(
"format-stroke-color"));
55 d->actionShadowColor->setToolTip(i18n(
"Change the color of the shadow"));
56 d->widget.shadowColor->setDefaultAction(
d->actionShadowColor);
73 d->widget.shadowColor->blockSignals(
true);
74 d->actionShadowColor->blockSignals(
true);
76 d->actionShadowColor->setCurrentColor( color );
78 d->actionShadowColor->blockSignals(
false);
79 d->widget.shadowColor->blockSignals(
false);
84 return d->actionShadowColor->currentColor();
89 qreal
length = sqrt(offset.x()*offset.x() + offset.y()*offset.y());
90 qreal angle = atan2(-offset.y(), offset.x());
95 d->widget.shadowAngle->blockSignals(
true);
96 d->widget.shadowAngle->setValue(-90 - angle * 180.0 /
M_PI);
97 d->widget.shadowAngle->blockSignals(
false);
99 d->widget.shadowOffset->blockSignals(
true);
100 d->widget.shadowOffset->changeValue(
length);
101 d->widget.shadowOffset->blockSignals(
false);
106 QPointF offset(
d->widget.shadowOffset->value(), 0);
108 m.rotate(
d->widget.shadowAngle->value() + 90);
109 return m.map(offset);
114 d->widget.shadowBlur->blockSignals(
true);
115 d->widget.shadowBlur->changeValue(blur);
116 d->widget.shadowBlur->blockSignals(
false);
121 return d->widget.shadowBlur->value();
126 d->widget.shadowVisible->blockSignals(
true);
127 d->widget.shadowVisible->setChecked(visible);
128 d->widget.shadowVisible->blockSignals(
false);
134 return d->widget.shadowVisible->isChecked();
139 d->widget.shadowAngle->setEnabled(
d->widget.shadowVisible->isChecked() );
140 d->widget.shadowBlur->setEnabled(
d->widget.shadowVisible->isChecked() );
141 d->widget.shadowColor->setEnabled(
d->widget.shadowVisible->isChecked() );
142 d->widget.shadowOffset->setEnabled(
d->widget.shadowVisible->isChecked() );
172 setEnabled(shape != 0);
205 d->widget.shadowOffset->blockSignals(
true);
206 d->widget.shadowBlur->blockSignals(
true);
207 d->widget.shadowOffset->setUnitManager(managerOffset);
208 d->widget.shadowBlur->setUnitManager(managerBlur);
209 d->widget.shadowOffset->blockSignals(
false);
210 d->widget.shadowBlur->blockSignals(
false);
215 d->widget.shadowOffset->blockSignals(
true);
216 d->widget.shadowBlur->blockSignals(
true);
217 d->widget.shadowOffset->setUnit(unit);
218 d->widget.shadowBlur->setUnit(unit);
219 d->widget.shadowOffset->blockSignals(
false);
220 d->widget.shadowBlur->blockSignals(
false);
qreal length(const QPointF &vec)
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
KisSelectedShapesProxy selectedShapesProxy
void addCommand(KUndo2Command *command) override
KoSelection * selection() override
The KisSpinBoxUnitManager class is an abstract interface for the unitspinboxes classes to manage diff...
virtual KoUnit unit() const =0
QPointer< KoCanvasResourceProvider > resourceManager
virtual KoSelectedShapesProxy * selectedShapesProxy() const =0
selectedShapesProxy() is a special interface for keeping a persistent connections to selectionChanged...
KoShape * firstSelectedShape() const
const QList< KoShape * > selectedShapes() const
The undo / redo command for setting the shape shadow.
bool isVisible() const
Returns if shadow is visible.
void setOffset(const QPointF &offset)
void setColor(const QColor &color)
void setVisible(bool visible)
Sets the shadow visibility.
KoShapeShadow * shadow() const
Returns the currently set shadow or 0 if there is no shadow set.
#define koIcon(name)
Use these macros for icons without any issues.
@ Unit
The unit of this canvas.