@@ -15,7 +15,7 class CatalogueEventsWidget : public QWidget { | |||||
15 | Q_OBJECT |
|
15 | Q_OBJECT | |
16 |
|
16 | |||
17 | signals: |
|
17 | signals: | |
18 | void eventSelected(const DBEvent &event); |
|
18 | void eventsSelected(const QVector<DBEvent> &event); | |
19 |
|
19 | |||
20 | public: |
|
20 | public: | |
21 | explicit CatalogueEventsWidget(QWidget *parent = 0); |
|
21 | explicit CatalogueEventsWidget(QWidget *parent = 0); |
@@ -42,17 +42,22 CatalogueEventsWidget::CatalogueEventsWidget(QWidget *parent) | |||||
42 | }); |
|
42 | }); | |
43 |
|
43 | |||
44 | connect(ui->tableView, &QTableView::clicked, [this](auto index) { |
|
44 | connect(ui->tableView, &QTableView::clicked, [this](auto index) { | |
45 | auto event = impl->m_Model->getEvent(index.row()); |
|
45 | QVector<DBEvent> events; | |
46 | emit this->eventSelected(event); |
|
46 | for (auto rowIndex : ui->tableView->selectionModel()->selectedRows()) { | |
|
47 | events << impl->m_Model->getEvent(rowIndex.row()); | |||
|
48 | } | |||
|
49 | ||||
|
50 | emit this->eventsSelected(events); | |||
47 | }); |
|
51 | }); | |
48 |
|
52 | |||
49 |
connect(ui->tableView->selectionModel(), &QItemSelectionModel:: |
|
53 | connect(ui->tableView->selectionModel(), &QItemSelectionModel::selectionChanged, [this]() { | |
50 | [this](auto current, auto previous) { |
|
54 | QVector<DBEvent> events; | |
51 | if (current.isValid() && current.row() >= 0) { |
|
55 | for (auto rowIndex : ui->tableView->selectionModel()->selectedRows()) { | |
52 |
|
|
56 | events << impl->m_Model->getEvent(rowIndex.row()); | |
53 | emit this->eventSelected(event); |
|
57 | } | |
54 | } |
|
58 | ||
55 | }); |
|
59 | emit this->eventsSelected(events); | |
|
60 | }); | |||
56 |
|
61 | |||
57 | connect(ui->tableView->selectionModel(), &QItemSelectionModel::selectionChanged, [this]() { |
|
62 | connect(ui->tableView->selectionModel(), &QItemSelectionModel::selectionChanged, [this]() { | |
58 | auto isNotMultiSelection = ui->tableView->selectionModel()->selectedRows().count() <= 1; |
|
63 | auto isNotMultiSelection = ui->tableView->selectionModel()->selectedRows().count() <= 1; |
@@ -15,8 +15,14 CatalogueExplorer::CatalogueExplorer(QWidget *parent) | |||||
15 | ui->events->populateWithCatalogue(catalogue); |
|
15 | ui->events->populateWithCatalogue(catalogue); | |
16 | }); |
|
16 | }); | |
17 |
|
17 | |||
18 | connect(ui->events, &CatalogueEventsWidget::eventSelected, |
|
18 | connect(ui->events, &CatalogueEventsWidget::eventsSelected, [this](auto events) { | |
19 | [this](auto event) { ui->inspector->setEvent(event); }); |
|
19 | if (events.count() == 1) { | |
|
20 | ui->inspector->setEvent(events.first()); | |||
|
21 | } | |||
|
22 | else { | |||
|
23 | ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); | |||
|
24 | } | |||
|
25 | }); | |||
20 | } |
|
26 | } | |
21 |
|
27 | |||
22 | CatalogueExplorer::~CatalogueExplorer() |
|
28 | CatalogueExplorer::~CatalogueExplorer() |
General Comments 0
You need to be logged in to leave comments.
Login now