pqLinkedObjectQTextEdit.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-FileCopyrightText: Copyright (c) Sandia Corporation
3 // SPDX-License-Identifier: BSD-3-Clause
4 
5 #ifndef pqLinkedObjectQTextEdit_h
6 #define pqLinkedObjectQTextEdit_h
7 
9 
10 class QTextEdit;
11 
17 {
21  pqLinkedObjectQTextEdit() = delete;
22 
26  explicit pqLinkedObjectQTextEdit(QTextEdit& textEdit) noexcept
27  : TextEdit(textEdit)
28  {
29  }
30 
34  explicit pqLinkedObjectQTextEdit(const pqLinkedObjectQTextEdit& other) noexcept
36  , TextEdit(other.TextEdit)
37  {
38  if (other.isLinked())
39  {
40  this->link(this->ConnectedTo);
41  }
42  }
43 
47  ~pqLinkedObjectQTextEdit() noexcept override { this->unlink(); }
48 
53  std::unique_ptr<pqLinkedObjectInterface> clone() const override
54  {
55  return std::unique_ptr<pqLinkedObjectQTextEdit>(new pqLinkedObjectQTextEdit(*this));
56  }
57 
62  void link(pqLinkedObjectInterface* other) override;
63 
67  void unlink() override;
68 
72  void setText(const QString& txt) override;
73 
77  QString getText() const override;
78 
82  QObject* getLinked() const noexcept override;
83 
87  QString getName() const override;
88 
89  QTextEdit& TextEdit;
90 };
91 
92 #endif // pqLinkedObjectQTextEdit_h
virtual void unlink()=0
Unlinks the objects.
virtual QString getName() const =0
Returns the linked QObject name.
pqLinkedObjectQTextEdit(const pqLinkedObjectQTextEdit &other) noexcept
Copy constructor.
The interface to a linked Qt text widget.
#define PQCORE_EXPORT
Definition: pqCoreModule.h:15
virtual QString getText() const =0
Returns the current buffer associated with this widget.
pqLinkedObjectInterface()=default
Default constructor.
pqLinkedObjectQTextEdit(QTextEdit &textEdit) noexcept
Constructor that takes the QTextEdit as parameter.
virtual void setText(const QString &txt)=0
Updates the object text.
std::unique_ptr< pqLinkedObjectInterface > clone() const override
Constructs a new instance of pqLinkedObjectQTextEdit using the default copy constructor of this class...
virtual void link(pqLinkedObjectInterface *other)=0
Link this object to the other.
~pqLinkedObjectQTextEdit() noexcept override
Destructor that unlink this object on deletion.
pqLinkedObjectQTextEdit implements the pqLinkedObjectInterface for a QTextEdit
virtual QObject * getLinked() const noexcept=0
Returns the linked QOBject.