##// END OF EJS Templates
Fix move of an event in another catalogue
trabillard -
r1325:99a785298325
parent child
Show More
@@ -19,6 +19,7 public:
19
19
20 /// Returns the catalogue represented by the item
20 /// Returns the catalogue represented by the item
21 std::shared_ptr<DBCatalogue> catalogue() const;
21 std::shared_ptr<DBCatalogue> catalogue() const;
22 void replaceCatalogue(const std::shared_ptr<DBCatalogue> &catalogue);
22
23
23 private:
24 private:
24 class CatalogueTreeItemPrivate;
25 class CatalogueTreeItemPrivate;
@@ -133,6 +133,7 CatalogueSideBarWidget::CatalogueSideBarWidget(QWidget *parent)
133 connect(impl->m_TreeModel, &CatalogueTreeModel::itemDropped,
133 connect(impl->m_TreeModel, &CatalogueTreeModel::itemDropped,
134 [this](auto index, auto mimeData, auto action) {
134 [this](auto index, auto mimeData, auto action) {
135 auto item = impl->m_TreeModel->item(index);
135 auto item = impl->m_TreeModel->item(index);
136
136 if (item && item->type() == CATALOGUE_ITEM_TYPE) {
137 if (item && item->type() == CATALOGUE_ITEM_TYPE) {
137 auto catalogue = static_cast<CatalogueTreeItem *>(item)->catalogue();
138 auto catalogue = static_cast<CatalogueTreeItem *>(item)->catalogue();
138 this->setCatalogueChanges(catalogue, true);
139 this->setCatalogueChanges(catalogue, true);
@@ -144,9 +145,12 CatalogueSideBarWidget::CatalogueSideBarWidget(QWidget *parent)
144 mimeData->data(MIME_TYPE_SOURCE_CATALOGUE_LIST));
145 mimeData->data(MIME_TYPE_SOURCE_CATALOGUE_LIST));
145 for (auto catalogue : sourceCatalogues) {
146 for (auto catalogue : sourceCatalogues) {
146 if (auto catalogueItem = impl->getCatalogueItem(catalogue)) {
147 if (auto catalogueItem = impl->getCatalogueItem(catalogue)) {
148 catalogueItem->replaceCatalogue(catalogue);
147 this->setCatalogueChanges(catalogue, true);
149 this->setCatalogueChanges(catalogue, true);
148 }
150 }
149 }
151 }
152
153 this->emitSelection();
150 }
154 }
151 });
155 });
152
156
@@ -124,3 +124,8 std::shared_ptr<DBCatalogue> CatalogueTreeItem::catalogue() const
124 {
124 {
125 return impl->m_Catalogue;
125 return impl->m_Catalogue;
126 }
126 }
127
128 void CatalogueTreeItem::replaceCatalogue(const std::shared_ptr<DBCatalogue> &catalogue)
129 {
130 impl->m_Catalogue = catalogue;
131 }
General Comments 0
You need to be logged in to leave comments. Login now