20 : QComboBox(parent), m_LastMaxIndex(0), m_LastIndex(0)
22 connect(
this, SIGNAL(currentIndexChanged(
int)),
this, SLOT(OnCurrentIndexChanged(
int)));
31 int curIndex = this->currentIndex();
36 this->setCurrentIndex(curIndex-1);
42 int curIndex = this->currentIndex();
45 if ( curIndex < this->count() - 1 )
47 this->setCurrentIndex(curIndex+1);
51 void QmitkComboBoxStepThrough::OnCurrentIndexChanged(
int newIndex)
54 if ( m_LastIndex == 0 && newIndex > 0)
58 else if ( m_LastIndex > 0 && newIndex == 0 )
63 int maxIndex = this->count() - 1;
66 if ( (m_LastIndex == maxIndex || m_LastIndex == m_LastMaxIndex) && newIndex < maxIndex)
70 else if ( m_LastIndex < maxIndex && newIndex == maxIndex )
75 m_LastIndex = newIndex;
76 m_LastMaxIndex = maxIndex;
81 QComboBox::addItem(text, userData);
84 OnCurrentIndexChanged(this->currentIndex());
89 QComboBox::addItem(icon, text, userData);
92 OnCurrentIndexChanged(this->currentIndex());
97 QComboBox::addItems(texts);
100 OnCurrentIndexChanged(this->currentIndex());
105 QComboBox::insertItem(index, text, userData);
108 OnCurrentIndexChanged(this->currentIndex());
113 QComboBox::insertItem(index, icon, text, userData);
116 OnCurrentIndexChanged(this->currentIndex());
121 QComboBox::insertItems(index, list);
124 OnCurrentIndexChanged(this->currentIndex());
void addItem(const QString &text, const QVariant &userData=QVariant())
void insertItems(int index, const QStringList &list)
void SignalReachedBegin(bool)
void SignalReachedEnd(bool)
~QmitkComboBoxStepThrough()
void OnSetPreviousIndex()
void addItems(const QStringList &texts)
QmitkComboBoxStepThrough(QWidget *parent=nullptr)
void insertItem(int index, const QString &text, const QVariant &userData=QVariant())