OpenHantek
datagrid.h
1 // SPDX-License-Identifier: GPL-2.0+
2 
3 #pragma once
4 
5 #include <QGroupBox>
6 #include <QPalette>
7 
8 class QPushButton;
9 class QButtonGroup;
10 class QLabel;
11 class QGridLayout;
12 
13 class DataGrid : public QGroupBox
14 {
15  Q_OBJECT
16 public:
17  explicit DataGrid(QWidget *parent = nullptr);
18 
19  struct CursorInfo {
20  QPalette palette;
21  QPushButton *selector;
22  QPushButton *shape;
23  QLabel *deltaXLabel;
24  QLabel *deltaYLabel;
25 
26  CursorInfo();
27  void configure(const QString &text, const QColor &bgColor, const QColor &fgColor);
28  };
29 
30  unsigned addItem(const QString &text, const QColor &fgColor);
31  void setBackgroundColor(const QColor &bgColor);
32  void configureItem(unsigned index, const QColor &fgColor);
33  void updateInfo(unsigned index, bool visible, const QString &strShape = QString(),
34  const QString &strX = QString(), const QString &strY = QString());
35 
36 signals:
37  void itemSelected(unsigned index);
38  void itemUpdated(unsigned index);
39 
40 public slots:
41  void selectItem(unsigned index);
42 
43 private:
44  QColor backgroundColor;
45  QButtonGroup *cursorsSelectorGroup;
46  QGridLayout *cursorsLayout;
47  std::vector<CursorInfo> items;
48 };
QPalette palette
The widget&#39;s palette.
Definition: datagrid.h:20
QLabel * deltaXLabel
The horizontal distance between cursors.
Definition: datagrid.h:23
Definition: datagrid.h:13
QPushButton * shape
The cursor shape.
Definition: datagrid.h:22
QLabel * deltaYLabel
The vertical distance between cursors.
Definition: datagrid.h:24
Definition: datagrid.h:19
QPushButton * selector
The name of the channel.
Definition: datagrid.h:21