@@ -12,7 +12,7 class CatalogueEventsWidget : public QWidget { | |||
|
12 | 12 | Q_OBJECT |
|
13 | 13 | |
|
14 | 14 | signals: |
|
15 | void eventSelected(); | |
|
15 | void eventSelected(const QString &event); | |
|
16 | 16 | |
|
17 | 17 | public: |
|
18 | 18 | explicit CatalogueEventsWidget(QWidget *parent = 0); |
@@ -19,6 +19,9 public: | |||
|
19 | 19 | |
|
20 | 20 | Page currentPage() const; |
|
21 | 21 | |
|
22 | void setEvent(const QString &event); | |
|
23 | void setCatalogue(const QString &catalogue); | |
|
24 | ||
|
22 | 25 | public slots: |
|
23 | 26 | void showPage(Page page); |
|
24 | 27 |
@@ -1,6 +1,8 | |||
|
1 | 1 | #include "Catalogue/CatalogueEventsWidget.h" |
|
2 | 2 | #include "ui_CatalogueEventsWidget.h" |
|
3 | 3 | |
|
4 | #include <QtDebug> | |
|
5 | ||
|
4 | 6 | struct CatalogueEventsWidget::CatalogueEventsWidgetPrivate { |
|
5 | 7 | void addEventItem(const QStringList &data, QTableWidget *tableWidget); |
|
6 | 8 | |
@@ -28,8 +30,25 CatalogueEventsWidget::CatalogueEventsWidget(QWidget *parent) | |||
|
28 | 30 | } |
|
29 | 31 | }); |
|
30 | 32 | |
|
31 | connect(ui->tableWidget, &QTableWidget::cellClicked, | |
|
32 | [this](auto row, auto column) { emit this->eventSelected(); }); | |
|
33 | connect(ui->tableWidget, &QTableWidget::cellClicked, [this](auto row, auto column) { | |
|
34 | auto event = ui->tableWidget->item(row, 0)->text(); | |
|
35 | emit this->eventSelected(event); | |
|
36 | }); | |
|
37 | ||
|
38 | connect(ui->tableWidget, &QTableWidget::currentItemChanged, | |
|
39 | [this](auto current, auto previous) { | |
|
40 | if (current && current->row() >= 0) { | |
|
41 | auto event = ui->tableWidget->item(current->row(), 0)->text(); | |
|
42 | emit this->eventSelected(event); | |
|
43 | } | |
|
44 | }); | |
|
45 | ||
|
46 | connect(ui->tableWidget, &QTableWidget::itemSelectionChanged, [this]() { | |
|
47 | auto selection = ui->tableWidget->selectedRanges(); | |
|
48 | auto isSingleSelection = selection.count() == 1 && selection.first().rowCount() == 1; | |
|
49 | ui->btnChart->setEnabled(isSingleSelection); | |
|
50 | ui->btnTime->setEnabled(isSingleSelection); | |
|
51 | }); | |
|
33 | 52 | |
|
34 | 53 | Q_ASSERT(impl->columnNames().count() == (int)CatalogueEventsWidgetPrivate::Column::NbColumn); |
|
35 | 54 | ui->tableWidget->setColumnCount((int)CatalogueEventsWidgetPrivate::Column::NbColumn); |
@@ -8,12 +8,12 CatalogueExplorer::CatalogueExplorer(QWidget *parent) | |||
|
8 | 8 | ui->setupUi(this); |
|
9 | 9 | |
|
10 | 10 | connect(ui->catalogues, &CatalogueSideBarWidget::catalogueSelected, [this](auto name) { |
|
11 | ui->inspector->showPage(CatalogueInspectorWidget::Page::CatalogueProperties); | |
|
11 | ui->inspector->setEvent(name); | |
|
12 | 12 | ui->events->populateWithCatalogue(name); |
|
13 | 13 | }); |
|
14 | 14 | |
|
15 | 15 | connect(ui->events, &CatalogueEventsWidget::eventSelected, |
|
16 |
[this]() { ui->inspector->s |
|
|
16 | [this](auto name) { ui->inspector->setCatalogue(name); }); | |
|
17 | 17 | } |
|
18 | 18 | |
|
19 | 19 | CatalogueExplorer::~CatalogueExplorer() |
@@ -22,3 +22,15 CatalogueInspectorWidget::Page CatalogueInspectorWidget::currentPage() const | |||
|
22 | 22 | { |
|
23 | 23 | return static_cast<Page>(ui->stackedWidget->currentIndex()); |
|
24 | 24 | } |
|
25 | ||
|
26 | void CatalogueInspectorWidget::setEvent(const QString &event) | |
|
27 | { | |
|
28 | showPage(Page::EventProperties); | |
|
29 | ui->leEventName->setText(event); | |
|
30 | } | |
|
31 | ||
|
32 | void CatalogueInspectorWidget::setCatalogue(const QString &catalogue) | |
|
33 | { | |
|
34 | showPage(Page::CatalogueProperties); | |
|
35 | ui->leCatalogueName->setText(catalogue); | |
|
36 | } |
@@ -21,7 +21,7 CatalogueSideBarWidget::CatalogueSideBarWidget(QWidget *parent) | |||
|
21 | 21 | ui->setupUi(this); |
|
22 | 22 | impl->configureTreeWidget(ui->treeWidget); |
|
23 | 23 | |
|
24 | connect(ui->treeWidget, &QTreeWidget::itemClicked, [this](auto item) { | |
|
24 | auto emitSelection = [this](auto item) { | |
|
25 | 25 | switch (item->type()) { |
|
26 | 26 | case CATALOGUE_ITEM_TYPE: |
|
27 | 27 | emit this->catalogueSelected(item->text(0)); |
@@ -36,7 +36,10 CatalogueSideBarWidget::CatalogueSideBarWidget(QWidget *parent) | |||
|
36 | 36 | default: |
|
37 | 37 | break; |
|
38 | 38 | } |
|
39 |
} |
|
|
39 | }; | |
|
40 | ||
|
41 | connect(ui->treeWidget, &QTreeWidget::itemClicked, emitSelection); | |
|
42 | connect(ui->treeWidget, &QTreeWidget::currentItemChanged, emitSelection); | |
|
40 | 43 | } |
|
41 | 44 | |
|
42 | 45 | CatalogueSideBarWidget::~CatalogueSideBarWidget() |
@@ -53,7 +53,7 | |||
|
53 | 53 | <item> |
|
54 | 54 | <widget class="QStackedWidget" name="stackedWidget"> |
|
55 | 55 | <property name="currentIndex"> |
|
56 |
<number> |
|
|
56 | <number>1</number> | |
|
57 | 57 | </property> |
|
58 | 58 | <widget class="QWidget" name="emptyPage"/> |
|
59 | 59 | <widget class="QWidget" name="catalogueInspectorPage"> |
@@ -66,7 +66,7 | |||
|
66 | 66 | </widget> |
|
67 | 67 | </item> |
|
68 | 68 | <item row="1" column="1"> |
|
69 |
<widget class="QLineEdit" name="l |
|
|
69 | <widget class="QLineEdit" name="leCatalogueName"/> | |
|
70 | 70 | </item> |
|
71 | 71 | <item row="2" column="0"> |
|
72 | 72 | <widget class="QLabel" name="label_8"> |
@@ -76,7 +76,7 | |||
|
76 | 76 | </widget> |
|
77 | 77 | </item> |
|
78 | 78 | <item row="2" column="1"> |
|
79 |
<widget class="QLineEdit" name="l |
|
|
79 | <widget class="QLineEdit" name="leCatalogueAuthor"> | |
|
80 | 80 | <property name="text"> |
|
81 | 81 | <string/> |
|
82 | 82 | </property> |
@@ -114,7 +114,7 | |||
|
114 | 114 | <widget class="QWidget" name="eventInspectorPage"> |
|
115 | 115 | <layout class="QGridLayout" name="gridLayout"> |
|
116 | 116 | <item row="5" column="1"> |
|
117 |
<widget class="QDateTimeEdit" name="dateTimeEd |
|
|
117 | <widget class="QDateTimeEdit" name="dateTimeEventTEnd"/> | |
|
118 | 118 | </item> |
|
119 | 119 | <item row="4" column="0"> |
|
120 | 120 | <widget class="QLabel" name="label_4"> |
@@ -138,7 +138,7 | |||
|
138 | 138 | </widget> |
|
139 | 139 | </item> |
|
140 | 140 | <item row="3" column="1"> |
|
141 |
<widget class="QLineEdit" name="l |
|
|
141 | <widget class="QLineEdit" name="leEventProduct"/> | |
|
142 | 142 | </item> |
|
143 | 143 | <item row="5" column="0"> |
|
144 | 144 | <widget class="QLabel" name="label_5"> |
@@ -148,7 +148,7 | |||
|
148 | 148 | </widget> |
|
149 | 149 | </item> |
|
150 | 150 | <item row="4" column="1"> |
|
151 |
<widget class="QDateTimeEdit" name="dateTimeE |
|
|
151 | <widget class="QDateTimeEdit" name="dateTimeEventTStart"/> | |
|
152 | 152 | </item> |
|
153 | 153 | <item row="2" column="0"> |
|
154 | 154 | <widget class="QLabel" name="label_2"> |
@@ -158,7 +158,7 | |||
|
158 | 158 | </widget> |
|
159 | 159 | </item> |
|
160 | 160 | <item row="1" column="1"> |
|
161 |
<widget class="QLineEdit" name="l |
|
|
161 | <widget class="QLineEdit" name="leEventName"/> | |
|
162 | 162 | </item> |
|
163 | 163 | <item row="1" column="0"> |
|
164 | 164 | <widget class="QLabel" name="label"> |
@@ -168,10 +168,10 | |||
|
168 | 168 | </widget> |
|
169 | 169 | </item> |
|
170 | 170 | <item row="2" column="1"> |
|
171 |
<widget class="QLineEdit" name="l |
|
|
171 | <widget class="QLineEdit" name="leEventMission"/> | |
|
172 | 172 | </item> |
|
173 | 173 | <item row="6" column="1"> |
|
174 |
<widget class="QLineEdit" name="l |
|
|
174 | <widget class="QLineEdit" name="leEventTags"/> | |
|
175 | 175 | </item> |
|
176 | 176 | <item row="7" column="1"> |
|
177 | 177 | <spacer name="verticalSpacer"> |
General Comments 0
You need to be logged in to leave comments.
Login now