pqLinkedObjectInterface.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 pqLinkedObjectInterface_h
6 #define pqLinkedObjectInterface_h
7 
8 #include <pqCoreModule.h>
9 
10 #include <QMetaObject>
11 #include <QString>
12 
13 #include <memory>
14 
22 {
26  pqLinkedObjectInterface() = default;
27 
31  explicit pqLinkedObjectInterface(const pqLinkedObjectInterface&) = default;
32 
36  virtual ~pqLinkedObjectInterface() noexcept = default;
37 
41  virtual std::unique_ptr<pqLinkedObjectInterface> clone() const = 0;
42 
47  virtual void link(pqLinkedObjectInterface* other) = 0;
48 
52  virtual void unlink() = 0;
53 
57  enum class QtSignalState : bool
58  {
59  On = true,
60  Off = false
61  };
62 
66  virtual void setText(const QString& txt) = 0;
67 
71  virtual QString getText() const = 0;
72 
76  virtual QObject* getLinked() const noexcept = 0;
77 
81  virtual QString getName() const = 0;
82 
86  bool isLinked() const noexcept { return this->ConnectedTo != nullptr; }
87 
88 protected:
89  pqLinkedObjectInterface* ConnectedTo = nullptr;
90  QMetaObject::Connection Connection;
91  bool SettingText = false;
92 };
93 
94 #endif // pqLinkedObjectInterface_h
bool isLinked() const noexcept
Returns true if this object is connected to another one.
The interface to a linked Qt text widget.
#define PQCORE_EXPORT
Definition: pqCoreModule.h:15
QtSignalState
Used to trigger on and off an object signal.
QMetaObject::Connection Connection
#define const
Definition: zconf.h:238