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

#include <kis_wdg_edge_detection.h>

+ Inheritance diagram for KisWdgEdgeDetection:

Public Member Functions

KisPropertiesConfigurationSP configuration () const override
 
 KisWdgEdgeDetection (QWidget *parent)
 
void setConfiguration (const KisPropertiesConfigurationSP config) override
 
 ~KisWdgEdgeDetection ()
 
- Public Member Functions inherited from KisConfigWidget
virtual KoCanvasResourcesInterfaceSP canvasResourcesInterface () const
 
virtual void setCanvasResourcesInterface (KoCanvasResourcesInterfaceSP canvasResourcesInterface)
 
virtual void setView (KisViewManager *view)
 
 ~KisConfigWidget () override
 

Private Slots

void aspectLockChanged (bool v)
 
void horizontalRadiusChanged (qreal r)
 
void verticalRadiusChanged (qreal r)
 

Private Attributes

QStringList m_output
 
QStringList m_output_translatable
 
QStringList m_types
 
QStringList m_types_translatable
 
Ui_WidgetEdgeDetection * ui
 

Additional Inherited Members

- Signals inherited from KisConfigWidget
void sigConfigurationItemChanged ()
 
void sigConfigurationUpdated ()
 
void sigDropLockedConfig (KisPropertiesConfigurationSP p)
 
void sigSaveLockedConfig (KisPropertiesConfigurationSP p)
 
- Protected Member Functions inherited from KisConfigWidget
 KisConfigWidget (QWidget *parent=0, Qt::WindowFlags f=Qt::WindowFlags(), int delay=200)
 

Detailed Description

Definition at line 16 of file kis_wdg_edge_detection.h.

Constructor & Destructor Documentation

◆ KisWdgEdgeDetection()

KisWdgEdgeDetection::KisWdgEdgeDetection ( QWidget * parent)
explicit

Definition at line 12 of file kis_wdg_edge_detection.cpp.

12 :
13 KisConfigWidget(parent),
14 ui(new Ui_WidgetEdgeDetection)
15{
16 ui->setupUi(this);
17
18 m_types << "prewitt"<< "sobol"<< "simple";
19 m_types_translatable << i18n("Prewitt") << i18n("Sobel") << i18n("Simple");
20 m_output << "pythagorean" << "xGrowth" << "xFall" << "yGrowth" << "yFall" << "radian";
21 m_output_translatable << i18n("All sides")
22 << i18n("Top Edge")
23 << i18n("Bottom Edge")
24 << i18n("Right Edge")
25 << i18n("Left Edge")
26 << i18n("Direction in Radians");
27
28 ui->cmbType->addItems(m_types_translatable);
29 ui->cmbOutput->addItems(m_output_translatable);
30
31 ui->btnAspect->setKeepAspectRatio(false);
32 ui->sldHorizontalRadius->setRange(1.0, 100.0, 2);
33 ui->sldHorizontalRadius->setSingleStep(0.01);
34 ui->sldHorizontalRadius->setPrefix(i18n("Horizontal Radius:"));
35 connect(ui->sldHorizontalRadius, SIGNAL(valueChanged(qreal)), this, SLOT(horizontalRadiusChanged(qreal)));
36
37 ui->sldVerticalRadius->setRange(1.0, 100.0, 2);
38 ui->sldVerticalRadius->setSingleStep(0.01);
39 ui->sldVerticalRadius->setPrefix(i18n("Vertical Radius:"));
40 connect(ui->sldVerticalRadius, SIGNAL(valueChanged(qreal)), this, SLOT(verticalRadiusChanged(qreal)));
41
42
43 connect(ui->btnAspect, SIGNAL(keepAspectRatioChanged(bool)), this, SLOT(aspectLockChanged(bool)));
44 connect(ui->cmbType, SIGNAL(currentIndexChanged(int)), this, SIGNAL(sigConfigurationItemChanged()));
45 connect(ui->cmbOutput, SIGNAL(currentIndexChanged(int)), this, SIGNAL(sigConfigurationItemChanged()));
46 connect(ui->sldHorizontalRadius, SIGNAL(valueChanged(qreal)), this, SIGNAL(sigConfigurationItemChanged()));
47 connect(ui->sldVerticalRadius, SIGNAL(valueChanged(qreal)), this, SIGNAL(sigConfigurationItemChanged()));
48 connect(ui->chkTransparent, SIGNAL(clicked()), this, SIGNAL(sigConfigurationItemChanged()));
49}
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
void sigConfigurationItemChanged()
KisConfigWidget(QWidget *parent=0, Qt::WindowFlags f=Qt::WindowFlags(), int delay=200)
Ui_WidgetEdgeDetection * ui

References aspectLockChanged(), connect(), horizontalRadiusChanged(), m_output, m_output_translatable, m_types, m_types_translatable, KisConfigWidget::sigConfigurationItemChanged(), ui, and verticalRadiusChanged().

◆ ~KisWdgEdgeDetection()

KisWdgEdgeDetection::~KisWdgEdgeDetection ( )

Definition at line 51 of file kis_wdg_edge_detection.cpp.

52{
53 delete ui;
54}

References ui.

Member Function Documentation

◆ aspectLockChanged

void KisWdgEdgeDetection::aspectLockChanged ( bool v)
privateslot

Definition at line 114 of file kis_wdg_edge_detection.cpp.

115{
116 if (v) {
117 ui->sldVerticalRadius->setValue( ui->sldHorizontalRadius->value() );
118 }
119}
qreal v

References ui, and v.

◆ configuration()

KisPropertiesConfigurationSP KisWdgEdgeDetection::configuration ( ) const
overridevirtual
Returns
the configuration

Implements KisConfigWidget.

Definition at line 56 of file kis_wdg_edge_detection.cpp.

57{
59 config->setProperty("horizRadius", ui->sldHorizontalRadius->value());
60 config->setProperty("vertRadius", ui->sldVerticalRadius->value());
61 config->setProperty("type", m_types.at(ui->cmbType->currentIndex()));
62 config->setProperty("output", m_output.at(ui->cmbOutput->currentIndex()));
63 config->setProperty("lockAspect", ui->btnAspect->keepAspectRatio());
64 config->setProperty("transparency", ui->chkTransparent->isChecked());
65
66 return config;
67}
static KisResourcesInterfaceSP instance()

References KisGlobalResourcesInterface::instance(), m_output, m_types, and ui.

◆ horizontalRadiusChanged

void KisWdgEdgeDetection::horizontalRadiusChanged ( qreal r)
privateslot

Definition at line 88 of file kis_wdg_edge_detection.cpp.

89{
90 ui->sldHorizontalRadius->blockSignals(true);
91 ui->sldHorizontalRadius->setValue(r);
92 ui->sldHorizontalRadius->blockSignals(false);
93
94 if (ui->btnAspect->keepAspectRatio()) {
95 ui->sldVerticalRadius->blockSignals(true);
96 ui->sldVerticalRadius->setValue(r);
97 ui->sldVerticalRadius->blockSignals(false);
98 }
99}

References ui.

◆ setConfiguration()

void KisWdgEdgeDetection::setConfiguration ( const KisPropertiesConfigurationSP config)
overridevirtual
Parameters
configthe configuration for this configuration widget.

Implements KisConfigWidget.

Definition at line 69 of file kis_wdg_edge_detection.cpp.

70{
71 ui->sldHorizontalRadius->setValue(config->getFloat("horizRadius", 1.0));
72 ui->sldVerticalRadius->setValue(config->getFloat("vertRadius", 1.0));
73 int index = 0;
74 if (m_types.contains(config->getString("type", "prewitt"))){
75 index = m_types.indexOf(config->getString("type", "prewitt"));
76 }
77 ui->cmbType->setCurrentIndex(index);
78 index = 0;
79 if (m_output.contains(config->getString("output", "pythagorean"))){
80 index = m_output.indexOf(config->getString("output", "pythagorean"));
81 }
82 ui->cmbOutput->setCurrentIndex(index);
83 ui->chkTransparent->setChecked(config->getBool("transparency", false));
84 ui->btnAspect->setKeepAspectRatio(config->getBool("lockAspect", false));
85
86}

References m_output, m_types, and ui.

◆ verticalRadiusChanged

void KisWdgEdgeDetection::verticalRadiusChanged ( qreal r)
privateslot

Definition at line 101 of file kis_wdg_edge_detection.cpp.

102{
103 ui->sldVerticalRadius->blockSignals(true);
104 ui->sldVerticalRadius->setValue(r);
105 ui->sldVerticalRadius->blockSignals(false);
106
107 if (ui->btnAspect->keepAspectRatio()) {
108 ui->sldHorizontalRadius->blockSignals(true);
109 ui->sldHorizontalRadius->setValue(r);
110 ui->sldHorizontalRadius->blockSignals(false);
111 }
112}

References ui.

Member Data Documentation

◆ m_output

QStringList KisWdgEdgeDetection::m_output
private

Definition at line 31 of file kis_wdg_edge_detection.h.

◆ m_output_translatable

QStringList KisWdgEdgeDetection::m_output_translatable
private

Definition at line 32 of file kis_wdg_edge_detection.h.

◆ m_types

QStringList KisWdgEdgeDetection::m_types
private

Definition at line 29 of file kis_wdg_edge_detection.h.

◆ m_types_translatable

QStringList KisWdgEdgeDetection::m_types_translatable
private

Definition at line 30 of file kis_wdg_edge_detection.h.

◆ ui

Ui_WidgetEdgeDetection* KisWdgEdgeDetection::ui
private

Definition at line 28 of file kis_wdg_edge_detection.h.


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