29 #ifndef SODA_LIST_SPINBOX_H 30 #define SODA_LIST_SPINBOX_H 33 #include <QAbstractSpinBox> 38 #include <boost/format.hpp> 69 setAccelerated(
false);
75 setValue(values[cur_index]);
76 setMinimum(values[0]);
77 setMaximum(values[values.size() - 1]);
78 cur_index = values.size() - 1;
83 std::cerr << boost::format(
"stepBy(%d) -> cur_index = %d\n") % steps % cur_index;
84 if(cur_index < 0) cur_index = 0;
85 if(cur_index >= ((
int) values.size())) cur_index = values.size() - 1;
86 std::cerr << boost::format(
"\tvalues[%d] = %d\n") % cur_index % values[cur_index];
87 setValue(values[cur_index]);
88 std::cerr << boost::format(
"\tnew value = %d\n") % value();
93 if(values.empty())
return StepEnabled(StepNone);
95 if(cur_index > 0) ret |= StepDownEnabled;
96 if((cur_index + 1) < ((int) values.size())) ret |= StepUpEnabled;
ListSpinbox(std::vector< int > vals)
StepEnabled stepEnabled() const
std::vector< int > values
void keyPressEvent(QKeyEvent *event)
ListSpinbox(QWidget *parent=0)
NoEditSpinbox(QWidget *parent=0)
void setValues(std::vector< int > vals)