OGS
VtkAlgorithmPropertyLineEdit Class Reference

Detailed Description

This QLineEdit sets a user property on the given VtkAlgorithmProperties object automatically.

Definition at line 25 of file VtkAlgorithmPropertyLineEdit.h.

#include <VtkAlgorithmPropertyLineEdit.h>

Inheritance diagram for VtkAlgorithmPropertyLineEdit:
[legend]
Collaboration diagram for VtkAlgorithmPropertyLineEdit:
[legend]

Public Member Functions

 VtkAlgorithmPropertyLineEdit (const QString &contents, QString name, QVariant::Type type, VtkAlgorithmProperties *algProps, QWidget *parent=nullptr)
 Constructor. More...
 
 ~VtkAlgorithmPropertyLineEdit () override
 

Private Slots

void setNewValue ()
 This slots is automatically called when the text changed. More...
 

Private Attributes

const QString _name
 
VtkAlgorithmProperties_algProps
 
QVariant::Type _type
 

Constructor & Destructor Documentation

◆ VtkAlgorithmPropertyLineEdit()

VtkAlgorithmPropertyLineEdit::VtkAlgorithmPropertyLineEdit ( const QString &  contents,
QString  name,
QVariant::Type  type,
VtkAlgorithmProperties algProps,
QWidget *  parent = nullptr 
)

Constructor.

Parameters
contentsThe initial text.
nameThe name of the user property to set.
typeThe type of the property.
algPropsThe VtkAlgorithmProperties object.
parentThe parent widget.

Definition at line 24 of file VtkAlgorithmPropertyLineEdit.cpp.

30  : QLineEdit(contents, parent),
31  _name(std::move(name)),
32  _algProps(algProps),
33  _type(type)
34 {
35  switch (_type)
36  {
37  case QVariant::Double:
38  this->setValidator(new QDoubleValidator(this));
39  break;
40 
41  case QVariant::Int:
42  this->setValidator(new QIntValidator(this));
43  break;
44 
45  default:
46  break;
47  }
48 
49  connect(this, SIGNAL(editingFinished()), this, SLOT(setNewValue()));
50 }
void setNewValue()
This slots is automatically called when the text changed.

References _type, and setNewValue().

◆ ~VtkAlgorithmPropertyLineEdit()

VtkAlgorithmPropertyLineEdit::~VtkAlgorithmPropertyLineEdit ( )
overridedefault

Member Function Documentation

◆ setNewValue

void VtkAlgorithmPropertyLineEdit::setNewValue ( )
privateslot

This slots is automatically called when the text changed.

Definition at line 54 of file VtkAlgorithmPropertyLineEdit.cpp.

55 {
56  QVariant value(this->text());
57  if (value.convert(_type))
58  {
60  }
61 }
virtual void SetUserProperty(QString name, QVariant value)
Sets a user property. This should be implemented by subclasses.

References _algProps, _name, _type, and VtkAlgorithmProperties::SetUserProperty().

Referenced by VtkAlgorithmPropertyLineEdit().

Member Data Documentation

◆ _algProps

VtkAlgorithmProperties* VtkAlgorithmPropertyLineEdit::_algProps
private

Definition at line 45 of file VtkAlgorithmPropertyLineEdit.h.

Referenced by setNewValue().

◆ _name

const QString VtkAlgorithmPropertyLineEdit::_name
private

Definition at line 44 of file VtkAlgorithmPropertyLineEdit.h.

Referenced by setNewValue().

◆ _type

QVariant::Type VtkAlgorithmPropertyLineEdit::_type
private

Definition at line 46 of file VtkAlgorithmPropertyLineEdit.h.

Referenced by VtkAlgorithmPropertyLineEdit(), and setNewValue().


The documentation for this class was generated from the following files: