##// END OF EJS Templates
Events
trabillard -
r1101:b6c6d61c12e3
parent child
Show More
@@ -1,21 +1,25
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 {
7 8 class CatalogueEventsWidget;
8 9 }
9 10
10 11 class CatalogueEventsWidget : public QWidget {
11 12 Q_OBJECT
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 }
@@ -1,114 +1,139
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 2 <ui version="4.0">
3 3 <class>CatalogueEventsWidget</class>
4 4 <widget class="QWidget" name="CatalogueEventsWidget">
5 5 <property name="geometry">
6 6 <rect>
7 7 <x>0</x>
8 8 <y>0</y>
9 9 <width>566</width>
10 10 <height>258</height>
11 11 </rect>
12 12 </property>
13 13 <property name="windowTitle">
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>
20 32 <widget class="QToolButton" name="btnAdd">
21 33 <property name="text">
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">
29 41 <bool>true</bool>
30 42 </property>
31 43 </widget>
32 44 </item>
33 45 <item>
34 46 <widget class="QToolButton" name="btnRemove">
35 47 <property name="text">
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">
43 55 <bool>true</bool>
44 56 </property>
45 57 </widget>
46 58 </item>
47 59 <item>
48 60 <widget class="Line" name="line">
49 61 <property name="orientation">
50 62 <enum>Qt::Vertical</enum>
51 63 </property>
52 64 </widget>
53 65 </item>
54 66 <item>
55 67 <widget class="QToolButton" name="btnTime">
56 68 <property name="text">
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">
64 76 <bool>true</bool>
65 77 </property>
66 78 <property name="autoRaise">
67 79 <bool>true</bool>
68 80 </property>
69 81 </widget>
70 82 </item>
71 83 <item>
72 84 <widget class="QToolButton" name="btnChart">
73 85 <property name="text">
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">
81 93 <bool>true</bool>
82 94 </property>
83 95 <property name="autoRaise">
84 96 <bool>true</bool>
85 97 </property>
86 98 </widget>
87 99 </item>
88 100 <item>
89 101 <widget class="Line" name="line_2">
90 102 <property name="orientation">
91 103 <enum>Qt::Vertical</enum>
92 104 </property>
93 105 </widget>
94 106 </item>
95 107 <item>
96 108 <widget class="QLineEdit" name="lineEdit">
97 109 <property name="enabled">
98 110 <bool>false</bool>
99 111 </property>
100 112 </widget>
101 113 </item>
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 0
You need to be logged in to leave comments. Login now