Auto status change to "Under Review"
@@ -1,6 +1,7 | |||||
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 { | |
@@ -12,10 +13,13 class CatalogueEventsWidget : public QWidget { | |||||
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 | } |
@@ -14,6 +14,18 | |||||
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> | |
@@ -22,7 +34,7 | |||||
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"> | |
@@ -36,7 +48,7 | |||||
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"> | |
@@ -57,7 +69,7 | |||||
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"> | |
@@ -74,7 +86,7 | |||||
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"> | |
@@ -102,13 +114,26 | |||||
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 3
Status change > Approved
You need to be logged in to leave comments.
Login now