ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
ecvCustomDoubleValidator.h
Go to the documentation of this file.
1
// ----------------------------------------------------------------------------
2
// - CloudViewer: www.cloudViewer.org -
3
// ----------------------------------------------------------------------------
4
// Copyright (c) 2018-2024 www.cloudViewer.org
5
// SPDX-License-Identifier: MIT
6
// ----------------------------------------------------------------------------
7
8
#pragma once
9
10
// Qt
11
#include <QString>
12
#include <QValidator>
13
16
class
ccCustomDoubleValidator
:
public
QValidator {
17
Q_OBJECT
18
19
public
:
21
explicit
ccCustomDoubleValidator
(QObject* parent = 0)
22
: QValidator(parent) {}
23
24
// reimplemented from QValidator
25
State
validate
(QString& input,
int
& pos)
const
{
26
for
(
int
i = 0; i < input.size(); ++i) {
27
QChar c = input[i];
28
if
(c ==
','
) {
29
input[i] =
'.'
;
30
continue
;
31
}
else
if
(c ==
'.'
|| c ==
'-'
|| c.isDigit()) {
32
continue
;
33
}
else
{
34
return
Invalid;
35
}
36
}
37
return
Acceptable;
38
}
39
};
ccCustomDoubleValidator
Definition:
ecvCustomDoubleValidator.h:16
ccCustomDoubleValidator::ccCustomDoubleValidator
ccCustomDoubleValidator(QObject *parent=0)
Default constructor.
Definition:
ecvCustomDoubleValidator.h:21
ccCustomDoubleValidator::validate
State validate(QString &input, int &pos) const
Definition:
ecvCustomDoubleValidator.h:25
app
ecvCustomDoubleValidator.h
Generated on Wed Jan 28 2026 09:00:52 for ACloudViewer by
1.9.1