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

#include <kis_uniform_paintop_property_widget.h>

+ Inheritance diagram for KisUniformPaintOpPropertyComboBox:

Public Member Functions

 KisUniformPaintOpPropertyComboBox (KisUniformPaintOpPropertySP property, QWidget *parent)
 
void setValue (const QVariant &value) override
 
- Public Member Functions inherited from KisUniformPaintOpPropertyWidget
 KisUniformPaintOpPropertyWidget (KisUniformPaintOpPropertySP property, QWidget *parent)
 
void slotThemeChanged (QPalette pal)
 
 ~KisUniformPaintOpPropertyWidget () override
 

Private Slots

void slotComboBoxChanged (int value)
 

Private Attributes

QComboBox * m_comboBox
 

Additional Inherited Members

- Signals inherited from KisUniformPaintOpPropertyWidget
void valueChanged (const QVariant &value)
 
- Protected Slots inherited from KisUniformPaintOpPropertyWidget
- Protected Member Functions inherited from KisUniformPaintOpPropertyWidget
KisUniformPaintOpPropertySP property () const
 

Detailed Description

Definition at line 89 of file kis_uniform_paintop_property_widget.h.

Constructor & Destructor Documentation

◆ KisUniformPaintOpPropertyComboBox()

KisUniformPaintOpPropertyComboBox::KisUniformPaintOpPropertyComboBox ( KisUniformPaintOpPropertySP property,
QWidget * parent )

Definition at line 243 of file kis_uniform_paintop_property_widget.cpp.

245{
246 QVBoxLayout *layout = new QVBoxLayout(this);
247
248 KisComboBasedPaintOpProperty *comboProperty =
249 dynamic_cast<KisComboBasedPaintOpProperty*>(property.data());
250 KIS_ASSERT_RECOVER_RETURN(comboProperty);
251
252 const QList<QString> items = comboProperty->items();
253 const QList<QIcon> icons = comboProperty->icons();
254
255 m_comboBox = new QComboBox(this);
256
257 KIS_SAFE_ASSERT_RECOVER_RETURN(icons.isEmpty() ||
258 items.size() == icons.size());
259
260 if (!icons.isEmpty()) {
261 auto itemIt = items.constBegin();
262 auto iconIt = icons.constBegin();
263
264 while (itemIt != items.constEnd() &&
265 iconIt != icons.constEnd()) {
266
267 m_comboBox->addItem(*iconIt, *itemIt);
268
269 ++itemIt;
270 ++iconIt;
271 }
272 } else {
273 Q_FOREACH (const QString &item, items) {
274 m_comboBox->addItem(item);
275 }
276 }
277
278 m_comboBox->setCurrentIndex(property->value().toInt());
279 connect(m_comboBox, SIGNAL(currentIndexChanged(int)), SLOT(slotComboBoxChanged(int)));
280
281 layout->addWidget(m_comboBox);
282}
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
KisUniformPaintOpPropertyWidget(KisUniformPaintOpPropertySP property, QWidget *parent)
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
Definition kis_assert.h:128
#define KIS_ASSERT_RECOVER_RETURN(cond)
Definition kis_assert.h:75

References connect(), KisComboBasedPaintOpProperty::icons(), KisComboBasedPaintOpProperty::items(), KIS_ASSERT_RECOVER_RETURN, KIS_SAFE_ASSERT_RECOVER_RETURN, m_comboBox, KisUniformPaintOpPropertyWidget::property(), and slotComboBoxChanged().

Member Function Documentation

◆ setValue()

void KisUniformPaintOpPropertyComboBox::setValue ( const QVariant & value)
overridevirtual

Implements KisUniformPaintOpPropertyWidget.

Definition at line 284 of file kis_uniform_paintop_property_widget.cpp.

285{
286 m_comboBox->setCurrentIndex(value.toInt());
287}
float value(const T *src, size_t ch)

References m_comboBox, and value().

◆ slotComboBoxChanged

void KisUniformPaintOpPropertyComboBox::slotComboBoxChanged ( int value)
privateslot

Definition at line 289 of file kis_uniform_paintop_property_widget.cpp.

290{
291 Q_EMIT valueChanged(value);
292}
void valueChanged(const QVariant &value)

References value(), and KisUniformPaintOpPropertyWidget::valueChanged().

Member Data Documentation

◆ m_comboBox

QComboBox* KisUniformPaintOpPropertyComboBox::m_comboBox
private

Definition at line 101 of file kis_uniform_paintop_property_widget.h.


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