mirror of
https://github.com/Sani7/remote-ui.git
synced 2026-10-27 06:01:14 +01:00
Move
Updated submodule client/qwt
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
#ifndef _HEXSPINBOX_H_
|
||||
#define _HEXSPINBOX_H_
|
||||
|
||||
#include <QSpinBox>
|
||||
#include <QLineEdit>
|
||||
#include <QRegularExpressionValidator>
|
||||
|
||||
// NOTE: Since QSpinBox uses int as the storage type, the effective editing range
|
||||
// is +/- 0x7FFF FFFF, so it can't handle a full unsigned int.
|
||||
// QDoubleSpinBox would be a more suitable base class if a wider range is needed.
|
||||
class HexSpinBox : public QSpinBox
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
HexSpinBox(QWidget *parent = nullptr,
|
||||
bool showPrefix = false,
|
||||
const QString &format = QStringLiteral("%X"));
|
||||
|
||||
public slots:
|
||||
void setShowPrefix(bool show);
|
||||
void setFormat(const QString &text);
|
||||
|
||||
protected:
|
||||
QValidator::State validate(QString &text, int &pos) const override;
|
||||
int valueFromText(const QString &text) const override;
|
||||
QString textFromValue(int value) const override;
|
||||
|
||||
private:
|
||||
QRegularExpressionValidator *validator;
|
||||
QString format;
|
||||
};
|
||||
|
||||
#endif // _HEXSPINBOX_H_
|
||||
Reference in New Issue
Block a user