• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdegraphics API Reference
  • KDE Home
  • Contact Us
 

libs/libkdcraw/libkdcraw

  • sources
  • kde-4.14
  • kdegraphics
  • libs
  • libkdcraw
  • libkdcraw
rcombobox.cpp
Go to the documentation of this file.
1 
27 #include "rcombobox.moc"
28 
29 // Qt includes
30 
31 #include <QToolButton>
32 
33 // KDE includes
34 
35 #include <kdialog.h>
36 #include <klocale.h>
37 #include <kiconloader.h>
38 
39 namespace KDcrawIface
40 {
41 
42 class RComboBox::Private
43 {
44 
45 public:
46 
47  Private()
48  {
49  defaultIndex = 0;
50  resetButton = 0;
51  combo = 0;
52  }
53 
54  int defaultIndex;
55 
56  QToolButton* resetButton;
57 
58  KComboBox* combo;
59 };
60 
61 RComboBox::RComboBox(QWidget* const parent)
62  : KHBox(parent), d(new Private)
63 {
64  d->combo = new KComboBox(this);
65  d->resetButton = new QToolButton(this);
66  d->resetButton->setAutoRaise(true);
67  d->resetButton->setFocusPolicy(Qt::NoFocus);
68  d->resetButton->setIcon(SmallIcon("document-revert"));
69  d->resetButton->setToolTip(i18nc("@info:tooltip", "Reset to default value"));
70 
71  setStretchFactor(d->combo, 10);
72  setMargin(0);
73  setSpacing(KDialog::spacingHint());
74 
75  // -------------------------------------------------------------
76 
77  connect(d->resetButton, SIGNAL(clicked()),
78  this, SLOT(slotReset()));
79 
80  connect(d->combo, SIGNAL(activated(int)),
81  this, SLOT(slotItemActivated(int)));
82 
83  connect(d->combo, SIGNAL(currentIndexChanged(int)),
84  this, SLOT(slotCurrentIndexChanged(int)));
85 }
86 
87 RComboBox::~RComboBox()
88 {
89  delete d;
90 }
91 
92 KComboBox* RComboBox::combo() const
93 {
94  return d->combo;
95 }
96 
97 void RComboBox::addItem(const QString& t, int index)
98 {
99  d->combo->addItem(t, index);
100 }
101 
102 void RComboBox::insertItem(int index, const QString& t)
103 {
104  d->combo->insertItem(index, t);
105 }
106 
107 int RComboBox::currentIndex() const
108 {
109  return d->combo->currentIndex();
110 }
111 
112 void RComboBox::setCurrentIndex(int v)
113 {
114  d->combo->setCurrentIndex(v);
115 }
116 
117 int RComboBox::defaultIndex() const
118 {
119  return d->defaultIndex;
120 }
121 
122 void RComboBox::setDefaultIndex(int v)
123 {
124  d->defaultIndex = v;
125  d->combo->setCurrentIndex(d->defaultIndex);
126  slotItemActivated(v);
127 }
128 
129 void RComboBox::slotReset()
130 {
131  d->combo->setCurrentIndex(d->defaultIndex);
132  d->resetButton->setEnabled(false);
133  slotItemActivated(d->defaultIndex);
134  emit reset();
135 }
136 
137 void RComboBox::slotItemActivated(int v)
138 {
139  d->resetButton->setEnabled(v != d->defaultIndex);
140  emit activated(v);
141 }
142 
143 void RComboBox::slotCurrentIndexChanged(int v)
144 {
145  d->resetButton->setEnabled(v != d->defaultIndex);
146  emit currentIndexChanged(v);
147 }
148 
149 } // namespace KDcrawIface
KDcrawIface::RComboBox::addItem
void addItem(const QString &t, int index=-1)
Definition: rcombobox.cpp:97
QWidget
KDcrawIface::RComboBox::defaultIndex
int defaultIndex() const
Definition: rcombobox.cpp:117
KDcrawIface::RComboBox::RComboBox
RComboBox(QWidget *const parent=0)
Definition: rcombobox.cpp:61
KDcrawIface::RComboBox::currentIndexChanged
void currentIndexChanged(int)
KDcrawIface::RComboBox::setCurrentIndex
void setCurrentIndex(int d)
Definition: rcombobox.cpp:112
QString
KDcrawIface::RComboBox::~RComboBox
~RComboBox()
Definition: rcombobox.cpp:87
QToolButton
KDcrawIface::RComboBox::setDefaultIndex
void setDefaultIndex(int d)
Definition: rcombobox.cpp:122
KDcrawIface::RComboBox::activated
void activated(int)
KDcrawIface::RComboBox::reset
void reset()
KDcrawIface::RComboBox::currentIndex
int currentIndex() const
Definition: rcombobox.cpp:107
KDcrawIface::RComboBox::insertItem
void insertItem(int index, const QString &t)
Definition: rcombobox.cpp:102
KHBox
KDcrawIface::RComboBox::combo
KComboBox * combo() const
Definition: rcombobox.cpp:92
KDcrawIface::RComboBox::slotReset
void slotReset()
Definition: rcombobox.cpp:129
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:19:36 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

libs/libkdcraw/libkdcraw

Skip menu "libs/libkdcraw/libkdcraw"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdegraphics API Reference

Skip menu "kdegraphics API Reference"
  •     libkdcraw
  •     libkexiv2
  •     libkipi
  •     libksane
  • okular

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal