2014-05-03 23:57:34 +00:00
|
|
|
#ifndef CSVSETTINGS_SPINBOX_HPP
|
|
|
|
#define CSVSETTINGS_SPINBOX_HPP
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QStringList>
|
|
|
|
#include <QSpinBox>
|
|
|
|
|
|
|
|
namespace CSVSettings
|
|
|
|
{
|
|
|
|
class SpinBox : public QSpinBox
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
QStringList mValueList;
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit SpinBox(QWidget *parent = 0);
|
|
|
|
|
2014-05-07 02:58:50 +00:00
|
|
|
///set the value displayed in the spin box
|
2014-05-03 23:57:34 +00:00
|
|
|
void setValue (const QString &value);
|
2014-05-07 02:58:50 +00:00
|
|
|
|
|
|
|
///set the stringlist that's used as a list of pre-defined values
|
|
|
|
///to be displayed as the user scrolls
|
2014-05-03 23:57:34 +00:00
|
|
|
void setValueList (const QStringList &list);
|
2014-05-07 02:58:50 +00:00
|
|
|
|
|
|
|
///returns the pre-defined value list.
|
2014-05-03 23:57:34 +00:00
|
|
|
const QStringList &valueList() const { return mValueList; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2014-05-07 02:58:50 +00:00
|
|
|
///converts an index value to corresponding text to be displayed
|
2014-05-03 23:57:34 +00:00
|
|
|
QString textFromValue (int val) const;
|
2014-05-07 02:58:50 +00:00
|
|
|
|
|
|
|
///converts a text value to a corresponding index
|
2014-05-03 23:57:34 +00:00
|
|
|
int valueFromText (const QString &text) const;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif // CSVSETTINGS_SPINBOX_HPP
|