Removed unused HexInput class.
This commit is contained in:
parent
26b72fedc7
commit
2c5923dc79
2 changed files with 0 additions and 45 deletions
|
|
@ -4349,36 +4349,4 @@ void MaskedInputField::onCursorPositionChanged(int oldPosition, int position) {
|
||||||
_oldcursor = position;
|
_oldcursor = position;
|
||||||
}
|
}
|
||||||
|
|
||||||
HexInput::HexInput(
|
|
||||||
QWidget *parent,
|
|
||||||
const style::InputField &st,
|
|
||||||
rpl::producer<QString> placeholder,
|
|
||||||
const QString &val)
|
|
||||||
: MaskedInputField(parent, st, std::move(placeholder), val) {
|
|
||||||
if (!QRegularExpression("^[a-fA-F0-9]+$").match(val).hasMatch()) {
|
|
||||||
setText(QString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void HexInput::correctValue(
|
|
||||||
const QString &was,
|
|
||||||
int wasCursor,
|
|
||||||
QString &now,
|
|
||||||
int &nowCursor) {
|
|
||||||
QString newText;
|
|
||||||
newText.reserve(now.size());
|
|
||||||
auto newPos = nowCursor;
|
|
||||||
for (auto i = 0, l = int(now.size()); i < l; ++i) {
|
|
||||||
const auto ch = now[i];
|
|
||||||
if ((ch >= '0' && ch <= '9')
|
|
||||||
|| (ch >= 'a' && ch <= 'f')
|
|
||||||
|| (ch >= 'A' && ch <= 'F')) {
|
|
||||||
newText.append(ch);
|
|
||||||
} else if (i < nowCursor) {
|
|
||||||
--newPos;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
setCorrectedText(now, nowCursor, newText, newPos);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
|
||||||
|
|
@ -718,17 +718,4 @@ private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class HexInput : public MaskedInputField {
|
|
||||||
public:
|
|
||||||
HexInput(QWidget *parent, const style::InputField &st, rpl::producer<QString> placeholder, const QString &val);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void correctValue(
|
|
||||||
const QString &was,
|
|
||||||
int wasCursor,
|
|
||||||
QString &now,
|
|
||||||
int &nowCursor) override;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue