QtPdCom  1.0.0
TableColumn.h
Go to the documentation of this file.
1 /*****************************************************************************
2  *
3  * Copyright (C) 2012-2022 Florian Pose <fp@igh.de>
4  * 2013 Dr. Wilhelm Hagemeister <hm@igh-essen.com>
5  *
6  * This file is part of the QtPdCom library.
7  *
8  * The QtPdCom library is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or (at your
11  * option) any later version.
12  *
13  * The QtPdCom library is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
16  * License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with the QtPdCom Library. If not, see <http://www.gnu.org/licenses/>.
20  *
21  ****************************************************************************/
22 
23 #ifndef QTPDCOM_TABLECOLUMN_H
24 #define QTPDCOM_TABLECOLUMN_H
25 
26 #include "Transmission.h"
27 #include "Export.h"
28 
29 #include <pdcom5/Process.h>
30 
31 #include <QColor>
32 #include <QObject>
33 #include <QString>
34 
35 namespace QtPdCom {
36 
37 /****************************************************************************/
38 
42  public QObject
43 {
44  Q_OBJECT
45 
46  public:
47  TableColumn(const QString & = QString(), QObject *parent = nullptr);
48  ~TableColumn();
49 
50  void setHeader(const QString &);
51  const QString &getHeader() const;
52 
53  void setVariable(PdCom::Variable,
54  const Transmission & = QtPdCom::event_mode, double = 1.0,
55  double = 0.0);
56  void setVariable(PdCom::Process *, const QString &,
58  double = 1.0, double = 0.0);
59  void clearVariable();
60  void clearData();
61 
62  quint32 getDecimals() const;
63  void setDecimals(quint32);
64 
65  unsigned int getRows() const;
66 
67  QVariant data(unsigned int, int) const;
68  QVariant headerData(int) const;
69  Qt::ItemFlags flags(unsigned int) const;
70  bool setData(unsigned int, const QString &, int);
71  void setEnabled(bool, int = -1);
72 
73  bool isEditing() const;
74  bool isEnabled() const;
75  void commit();
76  void revert();
77 
78  void setHighlightRow(int);
79 
80  void setHighlightColor(QColor);
81  void setDisabledColor(QColor);
82 
85  struct Exception {
88  Exception(const QString &msg): msg(msg) {}
89  QString msg;
90  };
91 
92  signals:
93  void dimensionChanged();
94  void headerChanged();
95  void valueChanged();
96 
97  private:
98  class Q_DECL_HIDDEN Impl;
99  std::unique_ptr<Impl> impl;
100 };
101 
102 /****************************************************************************/
103 
104 } // namespace
105 
106 #endif
Definition: TableColumn.cpp:40
Table Column.
Definition: TableColumn.h:41
Exception type.
Definition: TableColumn.h:85
Transmission mode for subscriptions.
Definition: Transmission.h:77
Definition: Message.h:31
Exception(const QString &msg)
Constructor.
Definition: TableColumn.h:88
#define QTPDCOM_PUBLIC
Definition: Export.h:30
std::unique_ptr< Impl > impl
Definition: TableColumn.h:99
QString msg
Exception message.
Definition: TableColumn.h:89
constexpr struct QtPdCom::event_mode_tag event_mode