Krita Source Code Documentation
Loading...
Searching...
No Matches
KDcrawIface::RComboBox Class Reference

#include <rcombobox.h>

+ Inheritance diagram for KDcrawIface::RComboBox:

Public Slots

void slotReset ()
 

Signals

void activated (int)
 
void currentIndexChanged (int)
 
void reset ()
 

Public Member Functions

void addItem (const QString &t, int index=-1)
 
QComboBox * combo () const
 
int currentIndex () const
 
int defaultIndex () const
 
void insertItem (int index, const QString &t)
 
 Private ()
 
 RComboBox (QWidget *const parent=0)
 
void setCurrentIndex (int d)
 
void setDefaultIndex (int d)
 
 ~RComboBox () override
 

Public Attributes

QComboBox * combo
 
int defaultIndex
 
QToolButton * resetButton
 

Private Slots

void slotCurrentIndexChanged (int)
 
void slotItemActivated (int)
 

Private Attributes

Private *const d
 
- Private Attributes inherited from Private
KisCanvas2canvas
 
int displayedFrame
 
int intendedFrame
 

Additional Inherited Members

- Private Member Functions inherited from Private
 Private (KisCanvas2 *c)
 

Detailed Description

Definition at line 45 of file rcombobox.cpp.

Constructor & Destructor Documentation

◆ RComboBox()

KDcrawIface::RComboBox::RComboBox ( QWidget *const parent = 0)

Definition at line 64 of file rcombobox.cpp.

65 : QWidget(parent), d(new Private)
66{
67 QHBoxLayout* const hlay = new QHBoxLayout(this);
68 d->combo = new QComboBox(this);
69 d->resetButton = new QToolButton(this);
70 d->resetButton->setAutoRaise(true);
71 d->resetButton->setFocusPolicy(Qt::NoFocus);
72 d->resetButton->setIcon(KisIconUtils::loadIcon("document-revert").pixmap(16, 16));
73 d->resetButton->setToolTip(i18nc("@info:tooltip", "Reset to default value"));
74
75 hlay->addWidget(d->combo);
76 hlay->addWidget(d->resetButton);
77 hlay->setStretchFactor(d->combo, 10);
78 hlay->setContentsMargins(0, 0, 0, 0);
79 hlay->setSpacing(QApplication::style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing));
80
81 // -------------------------------------------------------------
82
83 connect(d->resetButton, &QToolButton::clicked,
85
86 connect(d->combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated),
88
89 connect(d->combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
91}
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
Private *const d
Definition rcombobox.h:81
void slotCurrentIndexChanged(int)
QIcon loadIcon(const QString &name)

References connect(), d, KisIconUtils::loadIcon(), slotCurrentIndexChanged(), slotItemActivated(), and slotReset().

◆ ~RComboBox()

KDcrawIface::RComboBox::~RComboBox ( )
override

Definition at line 93 of file rcombobox.cpp.

94{
95 delete d;
96}

References d.

Member Function Documentation

◆ activated

void KDcrawIface::RComboBox::activated ( int )
signal

◆ addItem()

void KDcrawIface::RComboBox::addItem ( const QString & t,
int index = -1 )

Definition at line 103 of file rcombobox.cpp.

104{
105 d->combo->addItem(t, index);
106}

References d.

◆ combo()

QComboBox * KDcrawIface::RComboBox::combo ( ) const

◆ currentIndex()

int KDcrawIface::RComboBox::currentIndex ( ) const

Definition at line 113 of file rcombobox.cpp.

114{
115 return d->combo->currentIndex();
116}

References d.

◆ currentIndexChanged

void KDcrawIface::RComboBox::currentIndexChanged ( int )
signal

◆ defaultIndex()

int KDcrawIface::RComboBox::defaultIndex ( ) const

◆ insertItem()

void KDcrawIface::RComboBox::insertItem ( int index,
const QString & t )

Definition at line 108 of file rcombobox.cpp.

109{
110 d->combo->insertItem(index, t);
111}

References d.

◆ Private()

KDcrawIface::RComboBox::Private ( )
inline

Definition at line 50 of file rcombobox.cpp.

51 {
52 defaultIndex = 0;
53 resetButton = 0;
54 combo = 0;
55 }
QToolButton * resetButton
Definition rcombobox.cpp:59

◆ reset

void KDcrawIface::RComboBox::reset ( )
signal

◆ setCurrentIndex()

void KDcrawIface::RComboBox::setCurrentIndex ( int d)

Definition at line 118 of file rcombobox.cpp.

119{
120 d->combo->setCurrentIndex(v);
121}
qreal v

References d, and v.

◆ setDefaultIndex()

void KDcrawIface::RComboBox::setDefaultIndex ( int d)

Definition at line 128 of file rcombobox.cpp.

129{
130 d->defaultIndex = v;
131 d->combo->setCurrentIndex(d->defaultIndex);
133}

References d, slotItemActivated(), and v.

◆ slotCurrentIndexChanged

void KDcrawIface::RComboBox::slotCurrentIndexChanged ( int v)
privateslot

Definition at line 149 of file rcombobox.cpp.

150{
151 d->resetButton->setEnabled(v != d->defaultIndex);
152 Q_EMIT currentIndexChanged(v);
153}
void currentIndexChanged(int)

References currentIndexChanged(), d, and v.

◆ slotItemActivated

void KDcrawIface::RComboBox::slotItemActivated ( int v)
privateslot

Definition at line 143 of file rcombobox.cpp.

144{
145 d->resetButton->setEnabled(v != d->defaultIndex);
146 Q_EMIT activated(v);
147}

References activated(), d, and v.

◆ slotReset

void KDcrawIface::RComboBox::slotReset ( )
slot

Definition at line 135 of file rcombobox.cpp.

136{
137 d->combo->setCurrentIndex(d->defaultIndex);
138 d->resetButton->setEnabled(false);
139 slotItemActivated(d->defaultIndex);
140 Q_EMIT reset();
141}

References d, reset(), and slotItemActivated().

Member Data Documentation

◆ combo

QComboBox * KDcrawIface::RComboBox::combo

Definition at line 61 of file rcombobox.cpp.

◆ d

Private* const KDcrawIface::RComboBox::d
private

Definition at line 81 of file rcombobox.h.

◆ defaultIndex

int KDcrawIface::RComboBox::defaultIndex

Definition at line 57 of file rcombobox.cpp.

◆ resetButton

QToolButton* KDcrawIface::RComboBox::resetButton

Definition at line 59 of file rcombobox.cpp.


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