OGS
VtkAlgorithmPropertyLineEdit.cpp
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2
// SPDX-License-Identifier: BSD-3-Clause
3
4
// ** INCLUDES **
5
#include "
VtkAlgorithmPropertyLineEdit.h
"
6
7
#include <QDoubleValidator>
8
#include <QIntValidator>
9
#include <utility>
10
11
#include "
VtkAlgorithmProperties.h
"
12
13
VtkAlgorithmPropertyLineEdit::VtkAlgorithmPropertyLineEdit
(
14
const
QString& contents,
15
QString name,
16
QVariant::Type type,
17
VtkAlgorithmProperties
* algProps,
18
QWidget* parent
/*= 0*/
)
19
: QLineEdit(contents, parent),
20
_name
(std::move(name)),
21
_algProps
(algProps),
22
_type
(type)
23
{
24
switch
(
_type
)
25
{
26
case
QVariant::Double:
27
this->setValidator(
new
QDoubleValidator(
this
));
28
break
;
29
30
case
QVariant::Int:
31
this->setValidator(
new
QIntValidator(
this
));
32
break
;
33
34
default
:
35
break
;
36
}
37
38
connect(
this
, SIGNAL(editingFinished()),
this
, SLOT(
setNewValue
()));
39
}
40
41
VtkAlgorithmPropertyLineEdit::~VtkAlgorithmPropertyLineEdit
() =
default
;
42
43
void
VtkAlgorithmPropertyLineEdit::setNewValue
()
44
{
45
QVariant value(this->text());
46
if
(value.convert(
_type
))
47
{
48
_algProps
->SetUserProperty(
_name
, value);
49
}
50
}
VtkAlgorithmProperties.h
VtkAlgorithmPropertyLineEdit.h
VtkAlgorithmProperties
Contains properties for the visualization of objects as VtkVisPipelineItems.
Definition
VtkAlgorithmProperties.h:127
VtkAlgorithmPropertyLineEdit::_algProps
VtkAlgorithmProperties * _algProps
Definition
VtkAlgorithmPropertyLineEdit.h:34
VtkAlgorithmPropertyLineEdit::setNewValue
void setNewValue()
This slots is automatically called when the text changed.
Definition
VtkAlgorithmPropertyLineEdit.cpp:43
VtkAlgorithmPropertyLineEdit::~VtkAlgorithmPropertyLineEdit
~VtkAlgorithmPropertyLineEdit() override
VtkAlgorithmPropertyLineEdit::_name
const QString _name
Definition
VtkAlgorithmPropertyLineEdit.h:33
VtkAlgorithmPropertyLineEdit::_type
QVariant::Type _type
Definition
VtkAlgorithmPropertyLineEdit.h:35
VtkAlgorithmPropertyLineEdit::VtkAlgorithmPropertyLineEdit
VtkAlgorithmPropertyLineEdit(const QString &contents, QString name, QVariant::Type type, VtkAlgorithmProperties *algProps, QWidget *parent=nullptr)
Constructor.
Definition
VtkAlgorithmPropertyLineEdit.cpp:13
Applications
DataExplorer
VtkVis
VtkAlgorithmPropertyLineEdit.cpp
Generated by
1.14.0