Krita Source Code Documentation
Loading...
Searching...
No Matches
KisStandardUniformPropertiesFactory Namespace Reference

Functions

static const KoID angle ("angle", ki18n("Angle"))
 
KisUniformPaintOpPropertySP createProperty (const KoID &id, KisPaintOpSettingsRestrictedSP settings, KisPaintOpPresetUpdateProxy *updateProxy)
 
KisUniformPaintOpPropertySP createProperty (const QString &id, KisPaintOpSettingsRestrictedSP settings, KisPaintOpPresetUpdateProxy *updateProxy)
 
static const KoID flow ("flow", ki18n("Flow"))
 
static const KoID opacity ("opacity", ki18n("Opacity"))
 
static const KoID size ("size", ki18n("Size"))
 
static const KoID spacing ("spacing", ki18n("Spacing"))
 

Function Documentation

◆ angle()

static const KoID KisStandardUniformPropertiesFactory::angle ( "angle" ,
ki18n("Angle")  )
static

◆ createProperty() [1/2]

KisUniformPaintOpPropertySP KisStandardUniformPropertiesFactory::createProperty ( const KoID & id,
KisPaintOpSettingsRestrictedSP settings,
KisPaintOpPresetUpdateProxy * updateProxy )

Overload of createProperty(const QString &id, ...)

Definition at line 18 of file kis_standard_uniform_properties_factory.cpp.

21{
22 return createProperty(id.id(), settings, updateProxy);
23}
KisUniformPaintOpPropertySP createProperty(const KoID &id, KisPaintOpSettingsRestrictedSP settings, KisPaintOpPresetUpdateProxy *updateProxy)

References createProperty().

◆ createProperty() [2/2]

KisUniformPaintOpPropertySP KisStandardUniformPropertiesFactory::createProperty ( const QString & id,
KisPaintOpSettingsRestrictedSP settings,
KisPaintOpPresetUpdateProxy * updateProxy )

Factory for creating standard uniform properties. Right now it supports only size, opacity and flow.

Definition at line 25 of file kis_standard_uniform_properties_factory.cpp.

28{
30
31
32 if (id == size.id()) {
34 new KisDoubleSliderBasedPaintOpPropertyCallback(KisDoubleSliderBasedPaintOpPropertyCallback::Double, KoID("size", i18n("Size")), settings, 0);
35
36 prop->setRange(0, KisImageConfig(true).maxBrushSize());
37 prop->setDecimals(2);
38 prop->setSingleStep(1);
39 prop->setExponentRatio(3.0);
40 prop->setSuffix(i18n(" px"));
41
42 prop->setReadCallback(
44 prop->setValue(prop->settings()->paintOpSize());
45 });
46 prop->setWriteCallback(
48 prop->settings()->setPaintOpSize(prop->value().toReal());
49 });
50
51 QObject::connect(updateProxy, SIGNAL(sigSettingsChanged()), prop, SLOT(requestReadValue()));
52 prop->requestReadValue();
53 result = toQShared(prop);
54 } else if (id == opacity.id()) {
56 new KisDoubleSliderBasedPaintOpPropertyCallback(KisDoubleSliderBasedPaintOpPropertyCallback::Double, opacity, settings, 0);
57
58 prop->setRange(0.0, 1.0);
59 prop->setSingleStep(0.01);
60
61 prop->setReadCallback(
63 prop->setValue(prop->settings()->paintOpOpacity());
64 });
65 prop->setWriteCallback(
67 prop->settings()->setPaintOpOpacity(prop->value().toReal());
68 });
69
70 QObject::connect(updateProxy, SIGNAL(sigSettingsChanged()), prop, SLOT(requestReadValue()));
71 prop->requestReadValue();
72 result = toQShared(prop);
73 } else if (id == flow.id()) {
75 new KisDoubleSliderBasedPaintOpPropertyCallback(KisDoubleSliderBasedPaintOpPropertyCallback::Double, flow, settings, 0);
76
77 prop->setRange(0.0, 1.0);
78 prop->setSingleStep(0.01);
79
80 prop->setReadCallback(
82 prop->setValue(prop->settings()->paintOpFlow());
83 });
84 prop->setWriteCallback(
86 prop->settings()->setPaintOpFlow(prop->value().toReal());
87 });
88
89 QObject::connect(updateProxy, SIGNAL(sigSettingsChanged()), prop, SLOT(requestReadValue()));
90 prop->requestReadValue();
91 result = toQShared(prop);
92 } else if (id == angle.id()) {
93 qFatal("Not implemented");
94 } else if (id == spacing.id()) {
95 qFatal("Not implemented");
96 }
97
98 if (!result) {
99 KIS_SAFE_ASSERT_RECOVER_NOOP(0 && "Unknown Uniform property id!");
100 }
101
102 return result;
103}
void setValue(const QVariant &value)
KisPaintOpSettingsSP settings() const
Definition KoID.h:30
#define KIS_SAFE_ASSERT_RECOVER_NOOP(cond)
Definition kis_assert.h:130
QSharedPointer< T > toQShared(T *ptr)
KisCallbackBasedPaintopProperty< KisSliderBasedPaintOpProperty< qreal > > KisDoubleSliderBasedPaintOpPropertyCallback

References angle(), flow(), KoID::id(), KIS_SAFE_ASSERT_RECOVER_NOOP, opacity(), KisCallbackBasedPaintopProperty< ParentClass >::setReadCallback(), KisCallbackBasedPaintopProperty< ParentClass >::setWriteCallback(), size(), spacing(), and toQShared().

◆ flow()

static const KoID KisStandardUniformPropertiesFactory::flow ( "flow" ,
ki18n("Flow")  )
static

◆ opacity()

static const KoID KisStandardUniformPropertiesFactory::opacity ( "opacity" ,
ki18n("Opacity")  )
static

◆ size()

static const KoID KisStandardUniformPropertiesFactory::size ( "size" ,
ki18n("Size")  )
static

◆ spacing()

static const KoID KisStandardUniformPropertiesFactory::spacing ( "spacing" ,
ki18n("Spacing")  )
static