##// END OF EJS Templates
Events
trabillard -
r1136:b6c6d61c12e3
parent child
Show More
@@ -1,6 +1,7
1 #ifndef CATALOGUEEVENTSWIDGET_H
2 #define CATALOGUEEVENTSWIDGET_H
1 #ifndef SCIQLOP_CATALOGUEEVENTSWIDGET_H
2 #define SCIQLOP_CATALOGUEEVENTSWIDGET_H
3 3
4 #include <Common/spimpl.h>
4 5 #include <QWidget>
5 6
6 7 namespace Ui {
@@ -12,10 +13,13 class CatalogueEventsWidget : public QWidget {
12 13
13 14 public:
14 15 explicit CatalogueEventsWidget(QWidget *parent = 0);
15 ~CatalogueEventsWidget();
16 virtual ~CatalogueEventsWidget();
16 17
17 18 private:
18 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 1 #include "Catalogue/CatalogueEventsWidget.h"
2 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 12 CatalogueEventsWidget::CatalogueEventsWidget(QWidget *parent)
5 : QWidget(parent), ui(new Ui::CatalogueEventsWidget)
13 : QWidget(parent),
14 ui(new Ui::CatalogueEventsWidget),
15 impl{spimpl::make_unique_impl<CatalogueEventsWidgetPrivate>()}
6 16 {
7 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 50 CatalogueEventsWidget::~CatalogueEventsWidget()
11 51 {
12 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 14 <string>Form</string>
15 15 </property>
16 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 29 <item>
18 30 <layout class="QHBoxLayout" name="horizontalLayout">
19 31 <item>
@@ -22,7 +34,7
22 34 <string>+</string>
23 35 </property>
24 36 <property name="icon">
25 <iconset resource="../../resources/sqpguiresources.qrc">
37 <iconset>
26 38 <normaloff>:/icones/add.png</normaloff>:/icones/add.png</iconset>
27 39 </property>
28 40 <property name="autoRaise">
@@ -36,7 +48,7
36 48 <string> - </string>
37 49 </property>
38 50 <property name="icon">
39 <iconset resource="../../resources/sqpguiresources.qrc">
51 <iconset>
40 52 <normaloff>:/icones/remove.png</normaloff>:/icones/remove.png</iconset>
41 53 </property>
42 54 <property name="autoRaise">
@@ -57,7 +69,7
57 69 <string>T</string>
58 70 </property>
59 71 <property name="icon">
60 <iconset resource="../../resources/sqpguiresources.qrc">
72 <iconset>
61 73 <normaloff>:/icones/time.png</normaloff>:/icones/time.png</iconset>
62 74 </property>
63 75 <property name="checkable">
@@ -74,7 +86,7
74 86 <string>G</string>
75 87 </property>
76 88 <property name="icon">
77 <iconset resource="../../resources/sqpguiresources.qrc">
89 <iconset>
78 90 <normaloff>:/icones/chart.png</normaloff>:/icones/chart.png</iconset>
79 91 </property>
80 92 <property name="checkable">
@@ -102,13 +114,26
102 114 </layout>
103 115 </item>
104 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 134 </item>
107 135 </layout>
108 136 </widget>
109 <resources>
110 <include location="../../resources/sqpguiresources.qrc"/>
111 <include location="../../resources/sqpguiresources.qrc"/>
112 </resources>
137 <resources/>
113 138 <connections/>
114 139 </ui>
General Comments 3
Under Review
author

Auto status change to "Under Review"

Approved

Status change > Approved

You need to be logged in to leave comments. Login now