Krita Source Code Documentation
Loading...
Searching...
No Matches
KisPaintOpOption Class Reference

#include <kis_paintop_option.h>

+ Inheritance diagram for KisPaintOpOption:

Classes

struct  Private
 

Public Types

using OptionalLodLimitationsReader = std::optional<lager::reader<KisPaintopLodLimitations>>
 
enum  PaintopCategory {
  GENERAL , COLOR , TEXTURE , FILTER ,
  MASKING_BRUSH
}
 

Signals

void sigCheckedChanged (bool value)
 
void sigEnabledChanged (bool value)
 
void sigSettingChanged ()
 

Public Member Functions

KisPaintOpOption::PaintopCategory category () const
 
QWidget * configurationPage () const
 
OptionalLodLimitationsReader effectiveLodLimitations () const
 
virtual bool isCheckable () const
 
virtual bool isChecked () const
 
bool isEnabled () const
 
bool isLocked () const
 
 KisPaintOpOption (const QString &label, KisPaintOpOption::PaintopCategory category, bool checked)
 
 KisPaintOpOption (const QString &label, KisPaintOpOption::PaintopCategory category, lager::cursor< bool > checkedCursor)
 
 KisPaintOpOption (const QString &label, KisPaintOpOption::PaintopCategory category, lager::cursor< bool > checkedCursor, lager::reader< bool > externallyEnabledLink)
 
QString label () const
 
virtual void lodLimitations (KisPaintopLodLimitations *l) const
 
virtual void setCanvasResourcesInterface (KoCanvasResourcesInterfaceSP canvasResourcesInterface)
 
virtual void setChecked (bool checked)
 
virtual void setImage (KisImageWSP image)
 
void setLocked (bool value)
 
virtual void setNode (KisNodeWSP node)
 
virtual void setResourcesInterface (KisResourcesInterfaceSP resourcesInterface)
 
void startReadOptionSetting (const KisPropertiesConfigurationSP setting)
 
void startWriteOptionSetting (KisPropertiesConfigurationSP setting) const
 
 ~KisPaintOpOption () override
 

Protected Slots

void emitCheckedChanged (bool checked)
 
void emitEnabledChanged (bool enabled)
 
void emitSettingChanged ()
 

Protected Member Functions

KoCanvasResourcesInterfaceSP canvasResourcesInterface () const
 
virtual OptionalLodLimitationsReader lodLimitationsReader () const
 
virtual void readOptionSetting (const KisPropertiesConfigurationSP setting)
 
KisResourcesInterfaceSP resourcesInterface () const
 
void setConfigurationPage (QWidget *page)
 
virtual void writeOptionSetting (KisPropertiesConfigurationSP setting) const
 

Protected Attributes

bool m_checkable {false}
 
bool m_locked {false}
 

Private Member Functions

void slotEnablePageWidget (bool value)
 

Private Attributes

Private *const m_d
 

Detailed Description

Base interface for paintop options. A paintop option can be enabled/disabled, has a configuration page (for example, a curve), a user-visible name and can be serialized and deserialized into KisPaintOpPresets

Because KisPaintOpOption classes create a QWidget in their constructor (the configuration page) you CANNOT create those objects in a KisPaintOp. KisPaintOps are created in non-gui threads.

Options are disabled by default.

Definition at line 37 of file kis_paintop_option.h.

Member Typedef Documentation

◆ OptionalLodLimitationsReader

Definition at line 42 of file kis_paintop_option.h.

Member Enumeration Documentation

◆ PaintopCategory

Enumerator
GENERAL 
COLOR 
TEXTURE 
FILTER 
MASKING_BRUSH 

Definition at line 44 of file kis_paintop_option.h.

Constructor & Destructor Documentation

◆ KisPaintOpOption() [1/3]

KisPaintOpOption::KisPaintOpOption ( const QString & label,
KisPaintOpOption::PaintopCategory category,
bool checked )

Definition at line 42 of file kis_paintop_option.cpp.

43 : m_checkable(true)
44 , m_d(new Private())
45
46{
47 m_d->label = label;
48 m_d->checkedFallback.set(checked);
50 m_d->externallyEnabledReader = lager::make_constant(true);
53 m_d->pageEnabledReader.bind(std::bind(&KisPaintOpOption::slotEnablePageWidget, this, std::placeholders::_1));
54 m_d->checkedCursor.bind(std::bind(&KisPaintOpOption::sigCheckedChanged, this, std::placeholders::_1));
55 m_d->externallyEnabledReader.bind(std::bind(&KisPaintOpOption::sigEnabledChanged, this, std::placeholders::_1));
56
57}
void sigEnabledChanged(bool value)
KisPaintOpOption::PaintopCategory category() const
void sigCheckedChanged(bool value)
void slotEnablePageWidget(bool value)
lager::reader< bool > pageEnabledReader
lager::reader< bool > externallyEnabledReader
KisPaintOpOption::PaintopCategory category
lager::cursor< bool > checkedCursor
lager::state< bool, lager::automatic_tag > checkedFallback

References KisPaintOpOption::Private::category, category(), KisPaintOpOption::Private::checkedCursor, KisPaintOpOption::Private::checkedFallback, KisPaintOpOption::Private::externallyEnabledReader, KisPaintOpOption::Private::label, label(), m_d, KisPaintOpOption::Private::pageEnabledReader, sigCheckedChanged(), sigEnabledChanged(), and slotEnablePageWidget().

◆ KisPaintOpOption() [2/3]

KisPaintOpOption::KisPaintOpOption ( const QString & label,
KisPaintOpOption::PaintopCategory category,
lager::cursor< bool > checkedCursor )

Definition at line 59 of file kis_paintop_option.cpp.

61 : KisPaintOpOption(label, category, checkedCursor, lager::make_constant(true))
62{
63
64}
KisPaintOpOption(const QString &label, KisPaintOpOption::PaintopCategory category, bool checked)

◆ KisPaintOpOption() [3/3]

KisPaintOpOption::KisPaintOpOption ( const QString & label,
KisPaintOpOption::PaintopCategory category,
lager::cursor< bool > checkedCursor,
lager::reader< bool > externallyEnabledLink )

◆ ~KisPaintOpOption()

KisPaintOpOption::~KisPaintOpOption ( )
override

Definition at line 82 of file kis_paintop_option.cpp.

83{
84 delete m_d;
85}

References m_d.

Member Function Documentation

◆ canvasResourcesInterface()

KoCanvasResourcesInterfaceSP KisPaintOpOption::canvasResourcesInterface ( ) const
protected

Definition at line 204 of file kis_paintop_option.cpp.

205{
207}
KoCanvasResourcesInterfaceSP canvasResourcesInterface

References KisPaintOpOption::Private::canvasResourcesInterface, and m_d.

◆ category()

KisPaintOpOption::PaintopCategory KisPaintOpOption::category ( ) const

Definition at line 153 of file kis_paintop_option.cpp.

154{
155 return m_d->category;
156}

References KisPaintOpOption::Private::category, and m_d.

◆ configurationPage()

QWidget * KisPaintOpOption::configurationPage ( ) const

Definition at line 222 of file kis_paintop_option.cpp.

223{
224 return m_d->configurationPage;
225}

References KisPaintOpOption::Private::configurationPage, and m_d.

◆ effectiveLodLimitations()

KisPaintOpOption::OptionalLodLimitationsReader KisPaintOpOption::effectiveLodLimitations ( ) const

Definition at line 133 of file kis_paintop_option.cpp.

134{
136
137 if (reader) {
138 reader = lager::with(m_d->pageEnabledReader, *reader)
139 .map([](bool enabled, const KisPaintopLodLimitations &l) {
140 return enabled ? l : KisPaintopLodLimitations();
141 });
142 }
143
144 return reader;
145}
std::optional< lager::reader< KisPaintopLodLimitations > > OptionalLodLimitationsReader
virtual OptionalLodLimitationsReader lodLimitationsReader() const

References lodLimitationsReader(), m_d, and KisPaintOpOption::Private::pageEnabledReader.

◆ emitCheckedChanged

void KisPaintOpOption::emitCheckedChanged ( bool checked)
protectedslot

◆ emitEnabledChanged

void KisPaintOpOption::emitEnabledChanged ( bool enabled)
protectedslot

◆ emitSettingChanged

void KisPaintOpOption::emitSettingChanged ( )
protectedslot

◆ isCheckable()

bool KisPaintOpOption::isCheckable ( ) const
virtual

Reimplemented in KisCurveOptionWidget.

Definition at line 163 of file kis_paintop_option.cpp.

163 {
164 return m_checkable;
165}

References m_checkable.

◆ isChecked()

bool KisPaintOpOption::isChecked ( ) const
virtual

Definition at line 158 of file kis_paintop_option.cpp.

159{
160 return m_d->checkedCursor.get();
161}

References KisPaintOpOption::Private::checkedCursor, and m_d.

◆ isEnabled()

bool KisPaintOpOption::isEnabled ( ) const

Definition at line 174 of file kis_paintop_option.cpp.

175{
176 return m_d->externallyEnabledReader.get();
177}

References KisPaintOpOption::Private::externallyEnabledReader, and m_d.

◆ isLocked()

bool KisPaintOpOption::isLocked ( ) const

Definition at line 239 of file kis_paintop_option.cpp.

240{
241 return m_locked;
242}

References m_locked.

◆ label()

QString KisPaintOpOption::label ( ) const

Definition at line 244 of file kis_paintop_option.cpp.

245{
246 return m_d->label;
247}

References KisPaintOpOption::Private::label, and m_d.

◆ lodLimitations()

void KisPaintOpOption::lodLimitations ( KisPaintopLodLimitations * l) const
virtual

Reimplemented in KisMaskingBrushOption.

Definition at line 128 of file kis_paintop_option.cpp.

129{
130 Q_UNUSED(l);
131}

◆ lodLimitationsReader()

KisPaintOpOption::OptionalLodLimitationsReader KisPaintOpOption::lodLimitationsReader ( ) const
protectedvirtual

Reimplemented in KisSmudgeOverlayModeOptionWidget, KisBrushOptionWidget, KisSizeOptionWidget, KisTextureOptionWidget, and MyPaintCurveOptionWidget.

Definition at line 147 of file kis_paintop_option.cpp.

148{
149 // no limitations by default
150 return std::nullopt;
151}

◆ readOptionSetting()

◆ resourcesInterface()

KisResourcesInterfaceSP KisPaintOpOption::resourcesInterface ( ) const
protected

Definition at line 199 of file kis_paintop_option.cpp.

200{
201 return m_d->resourcesInterface;
202}
KisResourcesInterfaceSP resourcesInterface

References m_d, and KisPaintOpOption::Private::resourcesInterface.

◆ setCanvasResourcesInterface()

void KisPaintOpOption::setCanvasResourcesInterface ( KoCanvasResourcesInterfaceSP canvasResourcesInterface)
virtual

◆ setChecked()

void KisPaintOpOption::setChecked ( bool checked)
virtual

Definition at line 167 of file kis_paintop_option.cpp.

168{
169 m_d->checkedCursor.set(checked);
170
172}

References KisPaintOpOption::Private::checkedCursor, emitSettingChanged(), and m_d.

◆ setConfigurationPage()

void KisPaintOpOption::setConfigurationPage ( QWidget * page)
protected

Definition at line 209 of file kis_paintop_option.cpp.

210{
211 if (m_d->configurationPage && !m_d->checkedCursor.get()) {
212 m_d->configurationPage->setEnabled(true);
213 }
214
215 m_d->configurationPage = page;
216
217 if (m_d->configurationPage) {
218 m_d->configurationPage->setEnabled(m_d->checkedCursor.get());
219 }
220}

References KisPaintOpOption::Private::checkedCursor, KisPaintOpOption::Private::configurationPage, and m_d.

◆ setImage()

void KisPaintOpOption::setImage ( KisImageWSP image)
virtual

Reimplement this to use the image in the option widget

Reimplemented in KisBrushOptionWidget, KisFilterOptionWidget, and KisMaskingBrushOption.

Definition at line 179 of file kis_paintop_option.cpp.

180{
181 Q_UNUSED(image);
182}

◆ setLocked()

void KisPaintOpOption::setLocked ( bool value)

Definition at line 234 of file kis_paintop_option.cpp.

235{
236 m_locked = value;
237}
float value(const T *src, size_t ch)

References m_locked, and value().

◆ setNode()

void KisPaintOpOption::setNode ( KisNodeWSP node)
virtual

Reimplemented in KisFilterOptionWidget.

Definition at line 184 of file kis_paintop_option.cpp.

185{
186 Q_UNUSED(node);
187}

◆ setResourcesInterface()

void KisPaintOpOption::setResourcesInterface ( KisResourcesInterfaceSP resourcesInterface)
virtual

Definition at line 189 of file kis_paintop_option.cpp.

190{
192}
KisResourcesInterfaceSP resourcesInterface() const

References m_d, KisPaintOpOption::Private::resourcesInterface, and resourcesInterface().

◆ sigCheckedChanged

void KisPaintOpOption::sigCheckedChanged ( bool value)
signal

Q_EMIT this whenever a checked state of the option has changed. It as always emitted before sigSettingChanged()

◆ sigEnabledChanged

void KisPaintOpOption::sigEnabledChanged ( bool value)
signal

◆ sigSettingChanged

void KisPaintOpOption::sigSettingChanged ( )
signal

Q_EMIT this whenever a setting has changed. It will update the preview

◆ slotEnablePageWidget()

void KisPaintOpOption::slotEnablePageWidget ( bool value)
private

Definition at line 227 of file kis_paintop_option.cpp.

228{
229 if (m_d->configurationPage) {
230 m_d->configurationPage->setEnabled(value);
231 }
232}

References KisPaintOpOption::Private::configurationPage, m_d, and value().

◆ startReadOptionSetting()

void KisPaintOpOption::startReadOptionSetting ( const KisPropertiesConfigurationSP setting)

Definition at line 114 of file kis_paintop_option.cpp.

115{
116 m_d->updatesBlocked = true;
117 readOptionSetting(setting);
118 m_d->updatesBlocked = false;
119}
virtual void readOptionSetting(const KisPropertiesConfigurationSP setting)

References m_d, readOptionSetting(), and KisPaintOpOption::Private::updatesBlocked.

◆ startWriteOptionSetting()

void KisPaintOpOption::startWriteOptionSetting ( KisPropertiesConfigurationSP setting) const

Definition at line 121 of file kis_paintop_option.cpp.

122{
123 m_d->isWritingSettings = true;
124 writeOptionSetting(setting);
125 m_d->isWritingSettings = false;
126}
virtual void writeOptionSetting(KisPropertiesConfigurationSP setting) const

References KisPaintOpOption::Private::isWritingSettings, m_d, and writeOptionSetting().

◆ writeOptionSetting()

Member Data Documentation

◆ m_checkable

bool KisPaintOpOption::m_checkable {false}
protected

Definition at line 135 of file kis_paintop_option.h.

135{false};

◆ m_d

Private* const KisPaintOpOption::m_d
private

Definition at line 141 of file kis_paintop_option.h.

◆ m_locked

bool KisPaintOpOption::m_locked {false}
protected

Definition at line 136 of file kis_paintop_option.h.

136{false};

The documentation for this class was generated from the following files: