@@ -1,21 +1,25 | |||||
1 | #ifndef CATALOGUEEVENTSWIDGET_H |
|
1 | #ifndef SCIQLOP_CATALOGUEEVENTSWIDGET_H | |
2 | #define CATALOGUEEVENTSWIDGET_H |
|
2 | #define SCIQLOP_CATALOGUEEVENTSWIDGET_H | |
3 |
|
3 | |||
|
4 | #include <Common/spimpl.h> | |||
4 | #include <QWidget> |
|
5 | #include <QWidget> | |
5 |
|
6 | |||
6 | namespace Ui { |
|
7 | namespace Ui { | |
7 | class CatalogueEventsWidget; |
|
8 | class CatalogueEventsWidget; | |
8 | } |
|
9 | } | |
9 |
|
10 | |||
10 | class CatalogueEventsWidget : public QWidget { |
|
11 | class CatalogueEventsWidget : public QWidget { | |
11 | Q_OBJECT |
|
12 | Q_OBJECT | |
12 |
|
13 | |||
13 | public: |
|
14 | public: | |
14 | explicit CatalogueEventsWidget(QWidget *parent = 0); |
|
15 | explicit CatalogueEventsWidget(QWidget *parent = 0); | |
15 | ~CatalogueEventsWidget(); |
|
16 | virtual ~CatalogueEventsWidget(); | |
16 |
|
17 | |||
17 | private: |
|
18 | private: | |
18 | Ui::CatalogueEventsWidget *ui; |
|
19 | Ui::CatalogueEventsWidget *ui; | |
|
20 | ||||
|
21 | class CatalogueEventsWidgetPrivate; | |||
|
22 | spimpl::unique_impl_ptr<CatalogueEventsWidgetPrivate> impl; | |||
19 | }; |
|
23 | }; | |
20 |
|
24 | |||
21 | #endif // CATALOGUEEVENTSWIDGET_H |
|
25 | #endif // SCIQLOP_CATALOGUEEVENTSWIDGET_H |
@@ -1,13 +1,66 | |||||
1 | #include "Catalogue/CatalogueEventsWidget.h" |
|
1 | #include "Catalogue/CatalogueEventsWidget.h" | |
2 | #include "ui_CatalogueEventsWidget.h" |
|
2 | #include "ui_CatalogueEventsWidget.h" | |
3 |
|
3 | |||
|
4 | struct CatalogueEventsWidget::CatalogueEventsWidgetPrivate { | |||
|
5 | void addEventItem(const QStringList &data, QTableWidget *tableWidget); | |||
|
6 | ||||
|
7 | enum class Column { Event, TStart, TEnd, Tags, Product, NbColumn }; | |||
|
8 | QStringList columnNames() { return QStringList{"Event", "TStart", "TEnd", "Tags", "Product"}; } | |||
|
9 | }; | |||
|
10 | ||||
|
11 | ||||
4 | CatalogueEventsWidget::CatalogueEventsWidget(QWidget *parent) |
|
12 | CatalogueEventsWidget::CatalogueEventsWidget(QWidget *parent) | |
5 |
: QWidget(parent), |
|
13 | : QWidget(parent), | |
|
14 | ui(new Ui::CatalogueEventsWidget), | |||
|
15 | impl{spimpl::make_unique_impl<CatalogueEventsWidgetPrivate>()} | |||
6 | { |
|
16 | { | |
7 | ui->setupUi(this); |
|
17 | ui->setupUi(this); | |
|
18 | ||||
|
19 | connect(ui->btnTime, &QToolButton::clicked, [this](auto checked) { | |||
|
20 | if (checked) { | |||
|
21 | ui->btnChart->setChecked(false); | |||
|
22 | } | |||
|
23 | }); | |||
|
24 | ||||
|
25 | connect(ui->btnChart, &QToolButton::clicked, [this](auto checked) { | |||
|
26 | if (checked) { | |||
|
27 | ui->btnTime->setChecked(false); | |||
|
28 | } | |||
|
29 | }); | |||
|
30 | ||||
|
31 | Q_ASSERT(impl->columnNames().count() == (int)CatalogueEventsWidgetPrivate::Column::NbColumn); | |||
|
32 | ui->tableWidget->setColumnCount((int)CatalogueEventsWidgetPrivate::Column::NbColumn); | |||
|
33 | ui->tableWidget->setHorizontalHeaderLabels(impl->columnNames()); | |||
|
34 | ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); | |||
|
35 | ui->tableWidget->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch); | |||
|
36 | ui->tableWidget->horizontalHeader()->setSortIndicatorShown(true); | |||
|
37 | ||||
|
38 | ||||
|
39 | // test | |||
|
40 | impl->addEventItem({"Event 1", "12/12/2012 12:12", "12/12/2042 12:42", "cloud", "mfi/b_gse"}, | |||
|
41 | ui->tableWidget); | |||
|
42 | impl->addEventItem({"Event 2", "12/12/2012 12:12", "12/12/2042 12:42", "cloud", "mfi/b_gse"}, | |||
|
43 | ui->tableWidget); | |||
|
44 | impl->addEventItem({"Event 3", "12/12/2012 12:12", "12/12/2042 12:42", "cloud", "mfi/b_gse"}, | |||
|
45 | ui->tableWidget); | |||
|
46 | impl->addEventItem({"Event 4", "12/12/2012 12:12", "12/12/2042 12:42", "cloud", "mfi/b_gse"}, | |||
|
47 | ui->tableWidget); | |||
8 | } |
|
48 | } | |
9 |
|
49 | |||
10 | CatalogueEventsWidget::~CatalogueEventsWidget() |
|
50 | CatalogueEventsWidget::~CatalogueEventsWidget() | |
11 | { |
|
51 | { | |
12 | delete ui; |
|
52 | delete ui; | |
13 | } |
|
53 | } | |
|
54 | ||||
|
55 | void CatalogueEventsWidget::CatalogueEventsWidgetPrivate::addEventItem(const QStringList &data, | |||
|
56 | QTableWidget *tableWidget) | |||
|
57 | { | |||
|
58 | auto row = tableWidget->rowCount(); | |||
|
59 | tableWidget->setRowCount(row + 1); | |||
|
60 | ||||
|
61 | for (auto i = 0; i < (int)Column::NbColumn; ++i) { | |||
|
62 | auto item = new QTableWidgetItem(data.value(i)); | |||
|
63 | item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); | |||
|
64 | tableWidget->setItem(row, i, item); | |||
|
65 | } | |||
|
66 | } |
@@ -1,114 +1,139 | |||||
1 | <?xml version="1.0" encoding="UTF-8"?> |
|
1 | <?xml version="1.0" encoding="UTF-8"?> | |
2 | <ui version="4.0"> |
|
2 | <ui version="4.0"> | |
3 | <class>CatalogueEventsWidget</class> |
|
3 | <class>CatalogueEventsWidget</class> | |
4 | <widget class="QWidget" name="CatalogueEventsWidget"> |
|
4 | <widget class="QWidget" name="CatalogueEventsWidget"> | |
5 | <property name="geometry"> |
|
5 | <property name="geometry"> | |
6 | <rect> |
|
6 | <rect> | |
7 | <x>0</x> |
|
7 | <x>0</x> | |
8 | <y>0</y> |
|
8 | <y>0</y> | |
9 | <width>566</width> |
|
9 | <width>566</width> | |
10 | <height>258</height> |
|
10 | <height>258</height> | |
11 | </rect> |
|
11 | </rect> | |
12 | </property> |
|
12 | </property> | |
13 | <property name="windowTitle"> |
|
13 | <property name="windowTitle"> | |
14 | <string>Form</string> |
|
14 | <string>Form</string> | |
15 | </property> |
|
15 | </property> | |
16 | <layout class="QVBoxLayout" name="verticalLayout"> |
|
16 | <layout class="QVBoxLayout" name="verticalLayout"> | |
|
17 | <property name="leftMargin"> | |||
|
18 | <number>0</number> | |||
|
19 | </property> | |||
|
20 | <property name="topMargin"> | |||
|
21 | <number>0</number> | |||
|
22 | </property> | |||
|
23 | <property name="rightMargin"> | |||
|
24 | <number>0</number> | |||
|
25 | </property> | |||
|
26 | <property name="bottomMargin"> | |||
|
27 | <number>0</number> | |||
|
28 | </property> | |||
17 | <item> |
|
29 | <item> | |
18 | <layout class="QHBoxLayout" name="horizontalLayout"> |
|
30 | <layout class="QHBoxLayout" name="horizontalLayout"> | |
19 | <item> |
|
31 | <item> | |
20 | <widget class="QToolButton" name="btnAdd"> |
|
32 | <widget class="QToolButton" name="btnAdd"> | |
21 | <property name="text"> |
|
33 | <property name="text"> | |
22 | <string>+</string> |
|
34 | <string>+</string> | |
23 | </property> |
|
35 | </property> | |
24 | <property name="icon"> |
|
36 | <property name="icon"> | |
25 | <iconset resource="../../resources/sqpguiresources.qrc"> |
|
37 | <iconset> | |
26 | <normaloff>:/icones/add.png</normaloff>:/icones/add.png</iconset> |
|
38 | <normaloff>:/icones/add.png</normaloff>:/icones/add.png</iconset> | |
27 | </property> |
|
39 | </property> | |
28 | <property name="autoRaise"> |
|
40 | <property name="autoRaise"> | |
29 | <bool>true</bool> |
|
41 | <bool>true</bool> | |
30 | </property> |
|
42 | </property> | |
31 | </widget> |
|
43 | </widget> | |
32 | </item> |
|
44 | </item> | |
33 | <item> |
|
45 | <item> | |
34 | <widget class="QToolButton" name="btnRemove"> |
|
46 | <widget class="QToolButton" name="btnRemove"> | |
35 | <property name="text"> |
|
47 | <property name="text"> | |
36 | <string> - </string> |
|
48 | <string> - </string> | |
37 | </property> |
|
49 | </property> | |
38 | <property name="icon"> |
|
50 | <property name="icon"> | |
39 | <iconset resource="../../resources/sqpguiresources.qrc"> |
|
51 | <iconset> | |
40 | <normaloff>:/icones/remove.png</normaloff>:/icones/remove.png</iconset> |
|
52 | <normaloff>:/icones/remove.png</normaloff>:/icones/remove.png</iconset> | |
41 | </property> |
|
53 | </property> | |
42 | <property name="autoRaise"> |
|
54 | <property name="autoRaise"> | |
43 | <bool>true</bool> |
|
55 | <bool>true</bool> | |
44 | </property> |
|
56 | </property> | |
45 | </widget> |
|
57 | </widget> | |
46 | </item> |
|
58 | </item> | |
47 | <item> |
|
59 | <item> | |
48 | <widget class="Line" name="line"> |
|
60 | <widget class="Line" name="line"> | |
49 | <property name="orientation"> |
|
61 | <property name="orientation"> | |
50 | <enum>Qt::Vertical</enum> |
|
62 | <enum>Qt::Vertical</enum> | |
51 | </property> |
|
63 | </property> | |
52 | </widget> |
|
64 | </widget> | |
53 | </item> |
|
65 | </item> | |
54 | <item> |
|
66 | <item> | |
55 | <widget class="QToolButton" name="btnTime"> |
|
67 | <widget class="QToolButton" name="btnTime"> | |
56 | <property name="text"> |
|
68 | <property name="text"> | |
57 | <string>T</string> |
|
69 | <string>T</string> | |
58 | </property> |
|
70 | </property> | |
59 | <property name="icon"> |
|
71 | <property name="icon"> | |
60 | <iconset resource="../../resources/sqpguiresources.qrc"> |
|
72 | <iconset> | |
61 | <normaloff>:/icones/time.png</normaloff>:/icones/time.png</iconset> |
|
73 | <normaloff>:/icones/time.png</normaloff>:/icones/time.png</iconset> | |
62 | </property> |
|
74 | </property> | |
63 | <property name="checkable"> |
|
75 | <property name="checkable"> | |
64 | <bool>true</bool> |
|
76 | <bool>true</bool> | |
65 | </property> |
|
77 | </property> | |
66 | <property name="autoRaise"> |
|
78 | <property name="autoRaise"> | |
67 | <bool>true</bool> |
|
79 | <bool>true</bool> | |
68 | </property> |
|
80 | </property> | |
69 | </widget> |
|
81 | </widget> | |
70 | </item> |
|
82 | </item> | |
71 | <item> |
|
83 | <item> | |
72 | <widget class="QToolButton" name="btnChart"> |
|
84 | <widget class="QToolButton" name="btnChart"> | |
73 | <property name="text"> |
|
85 | <property name="text"> | |
74 | <string>G</string> |
|
86 | <string>G</string> | |
75 | </property> |
|
87 | </property> | |
76 | <property name="icon"> |
|
88 | <property name="icon"> | |
77 | <iconset resource="../../resources/sqpguiresources.qrc"> |
|
89 | <iconset> | |
78 | <normaloff>:/icones/chart.png</normaloff>:/icones/chart.png</iconset> |
|
90 | <normaloff>:/icones/chart.png</normaloff>:/icones/chart.png</iconset> | |
79 | </property> |
|
91 | </property> | |
80 | <property name="checkable"> |
|
92 | <property name="checkable"> | |
81 | <bool>true</bool> |
|
93 | <bool>true</bool> | |
82 | </property> |
|
94 | </property> | |
83 | <property name="autoRaise"> |
|
95 | <property name="autoRaise"> | |
84 | <bool>true</bool> |
|
96 | <bool>true</bool> | |
85 | </property> |
|
97 | </property> | |
86 | </widget> |
|
98 | </widget> | |
87 | </item> |
|
99 | </item> | |
88 | <item> |
|
100 | <item> | |
89 | <widget class="Line" name="line_2"> |
|
101 | <widget class="Line" name="line_2"> | |
90 | <property name="orientation"> |
|
102 | <property name="orientation"> | |
91 | <enum>Qt::Vertical</enum> |
|
103 | <enum>Qt::Vertical</enum> | |
92 | </property> |
|
104 | </property> | |
93 | </widget> |
|
105 | </widget> | |
94 | </item> |
|
106 | </item> | |
95 | <item> |
|
107 | <item> | |
96 | <widget class="QLineEdit" name="lineEdit"> |
|
108 | <widget class="QLineEdit" name="lineEdit"> | |
97 | <property name="enabled"> |
|
109 | <property name="enabled"> | |
98 | <bool>false</bool> |
|
110 | <bool>false</bool> | |
99 | </property> |
|
111 | </property> | |
100 | </widget> |
|
112 | </widget> | |
101 | </item> |
|
113 | </item> | |
102 | </layout> |
|
114 | </layout> | |
103 | </item> |
|
115 | </item> | |
104 | <item> |
|
116 | <item> | |
105 |
<widget class="QTableWidget" name="tableWidget" |
|
117 | <widget class="QTableWidget" name="tableWidget"> | |
|
118 | <property name="alternatingRowColors"> | |||
|
119 | <bool>true</bool> | |||
|
120 | </property> | |||
|
121 | <property name="selectionBehavior"> | |||
|
122 | <enum>QAbstractItemView::SelectRows</enum> | |||
|
123 | </property> | |||
|
124 | <attribute name="horizontalHeaderHighlightSections"> | |||
|
125 | <bool>false</bool> | |||
|
126 | </attribute> | |||
|
127 | <attribute name="verticalHeaderVisible"> | |||
|
128 | <bool>false</bool> | |||
|
129 | </attribute> | |||
|
130 | <attribute name="verticalHeaderDefaultSectionSize"> | |||
|
131 | <number>25</number> | |||
|
132 | </attribute> | |||
|
133 | </widget> | |||
106 | </item> |
|
134 | </item> | |
107 | </layout> |
|
135 | </layout> | |
108 | </widget> |
|
136 | </widget> | |
109 | <resources> |
|
137 | <resources/> | |
110 | <include location="../../resources/sqpguiresources.qrc"/> |
|
|||
111 | <include location="../../resources/sqpguiresources.qrc"/> |
|
|||
112 | </resources> |
|
|||
113 | <connections/> |
|
138 | <connections/> | |
114 | </ui> |
|
139 | </ui> |
General Comments 0
You need to be logged in to leave comments.
Login now