16 : QComboBox(parent), m_LastMaxIndex(0), m_LastIndex(0)
18 connect(
this, SIGNAL(currentIndexChanged(
int)),
this, SLOT(OnCurrentIndexChanged(
int)));
27 int curIndex = this->currentIndex();
32 this->setCurrentIndex(curIndex-1);
38 int curIndex = this->currentIndex();
41 if ( curIndex < this->count() - 1 )
43 this->setCurrentIndex(curIndex+1);
47void QmitkComboBoxStepThrough::OnCurrentIndexChanged(
int newIndex)
50 if ( m_LastIndex == 0 && newIndex > 0)
54 else if ( m_LastIndex > 0 && newIndex == 0 )
59 int maxIndex = this->count() - 1;
62 if ( (m_LastIndex == maxIndex || m_LastIndex == m_LastMaxIndex) && newIndex < maxIndex)
66 else if ( m_LastIndex < maxIndex && newIndex == maxIndex )
71 m_LastIndex = newIndex;
72 m_LastMaxIndex = maxIndex;
77 QComboBox::addItem(text, userData);
80 OnCurrentIndexChanged(this->currentIndex());
85 QComboBox::addItem(icon, text, userData);
88 OnCurrentIndexChanged(this->currentIndex());
93 QComboBox::addItems(texts);
96 OnCurrentIndexChanged(this->currentIndex());
101 QComboBox::insertItem(index, text, userData);
104 OnCurrentIndexChanged(this->currentIndex());
109 QComboBox::insertItem(index, icon, text, userData);
112 OnCurrentIndexChanged(this->currentIndex());
117 QComboBox::insertItems(index, list);
120 OnCurrentIndexChanged(this->currentIndex());
void SignalReachedBegin(bool)
void OnSetPreviousIndex()
QmitkComboBoxStepThrough(QWidget *parent=nullptr)
void SignalReachedEnd(bool)
void addItem(const QString &text, const QVariant &userData=QVariant())
void insertItem(int index, const QString &text, const QVariant &userData=QVariant())
void insertItems(int index, const QStringList &list)
~QmitkComboBoxStepThrough() override
void addItems(const QStringList &texts)