QtPdCom  1.3.3
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 class TableModel;
38 
39 /****************************************************************************/
40 
43 class QTPDCOM_PUBLIC TableColumn: public QObject
44 {
45  Q_OBJECT
46 
47  public:
48  TableColumn(const QString & = QString(), QObject *parent = nullptr);
49  ~TableColumn();
50 
51  void setHeader(const QString &);
52  const QString &getHeader() const;
53 
54  void setVariable(
55  PdCom::Variable,
57  double = 1.0,
58  double = 0.0);
59  void setVariable(
60  PdCom::Process *,
61  const QString &,
63  double = 1.0,
64  double = 0.0);
65  void clearVariable();
66  void clearData();
67 
68  quint32 getDecimals() const;
69  void setDecimals(quint32);
70 
73  double getLowerLimit() const;
74  void setLowerLimit(double);
75 
76  double getUpperLimit() const;
77  void setUpperLimit(double);
78 
79  unsigned int getRows() const;
80 
81  QVariant data(unsigned int, int) const;
82  QVariant headerData(int) const;
83  Qt::ItemFlags flags(unsigned int) const;
84  bool setData(unsigned int, const QString &, int);
85  void setEnabled(bool, int = -1);
86 
87  bool isEditing() const;
88  bool isEnabled() const;
89  void commit();
90  void revert();
91 
92  void setHighlightRow(int);
93 
94  void setHighlightColor(QColor);
95  void setDisabledColor(QColor);
96 
99  struct Exception
100  {
103  Exception(const QString &msg):
104  msg(msg)
105  {}
106  QString msg;
107  };
108 
109  enum Roles {
110  HighlightRole = Qt::UserRole + 1,
116  UpperLimitRole
117  };
118  Q_ENUM(Roles);
119 
120  signals:
121  void dimensionChanged();
122  void headerChanged();
123  void valueChanged();
124 
125  private:
126  class Q_DECL_HIDDEN Impl;
127  std::unique_ptr<Impl> impl;
128 
129  friend class TableModel;
130 };
131 
132 /****************************************************************************/
133 
134 } // namespace QtPdCom
135 
136 #endif
Table Column.
Definition: TableColumn.h:43
Exception type.
Definition: TableColumn.h:99
Transmission mode for subscriptions.
Definition: Transmission.h:77
Definition: TableColumn.h:115
Definition: BroadcastModel.h:32
Exception(const QString &msg)
Constructor.
Definition: TableColumn.h:103
Table model.
Definition: TableModel.h:42
#define QTPDCOM_PUBLIC
Definition: Export.h:30
std::unique_ptr< Impl > impl
Definition: TableColumn.h:127
Definition: TableColumn.h:113
Definition: TableColumn.h:114
Roles
Definition: TableColumn.h:109
Definition: TableColumn.h:112
QString msg
Exception message.
Definition: TableColumn.h:106
constexpr struct QtPdCom::event_mode_tag event_mode
element is not valid due to columncount < nelem
Definition: TableColumn.h:111