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 **
6
7#include <QDoubleValidator>
8#include <QIntValidator>
9#include <utility>
10
12
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
42
44{
45 QVariant value(this->text());
46 if (value.convert(_type))
47 {
48 _algProps->SetUserProperty(_name, value);
49 }
50}
Contains properties for the visualization of objects as VtkVisPipelineItems.
void setNewValue()
This slots is automatically called when the text changed.
~VtkAlgorithmPropertyLineEdit() override
VtkAlgorithmPropertyLineEdit(const QString &contents, QString name, QVariant::Type type, VtkAlgorithmProperties *algProps, QWidget *parent=nullptr)
Constructor.