Skip to content
Snippets Groups Projects
Commit b03ae68d authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

repair just enough to get it compiled

parent d797c253
No related branches found
No related tags found
2 merge requests!2395corrections,!2394WIP Mask list refactored according to new std
......@@ -354,7 +354,7 @@ const MasksSet* Data2DItem::masksSet() const
MasksQModel* Data2DItem::getOrCreateModel()
{
if (!m_model)
m_model = std::make_unique<MasksQModel>(new MasksSet);
m_model = std::make_unique<MasksQModel>(nullptr, new MasksSet);
return m_model.get();
}
......@@ -407,7 +407,7 @@ const MasksSet* Data2DItem::projectionsSet() const
MasksQModel* Data2DItem::getOrCreateProjectionModel()
{
if (!m_proj_model)
m_proj_model = std::make_unique<MasksQModel>(new MasksSet);
m_proj_model = std::make_unique<MasksQModel>(nullptr, new MasksSet);
return m_proj_model.get();
}
......
......@@ -20,8 +20,9 @@
// Implementation of MasksQModel is based on the Qt source code for QStringListModel
MasksQModel::MasksQModel(MasksSet* set)
: m_masks(set)
MasksQModel::MasksQModel(QObject* parent, MasksSet* set)
: QAbstractListModel(parent) // parent needed to ensure end of life
, m_masks(set)
{
}
......@@ -86,7 +87,7 @@ QModelIndex MasksQModel::pushItem(MaskItem* t)
}
//! Move mask to a given row
void MasksQModel::moveMask(int from_row, int to_row)
void MasksQModel::moveMask(int /*from_row*/, int /*to_row*/)
{
/*
emit QAbstractListModel::beginMoveRows(m_masks->rootIndex, from_row, from_row,
......
......@@ -28,7 +28,7 @@ class OverlayItem;
class MasksQModel : public QAbstractListModel {
public:
MasksQModel(MasksSet* set);
MasksQModel(QObject* parent, MasksSet* set);
~MasksQModel();
int rowCount(const QModelIndex&) const override;
......
......@@ -13,9 +13,9 @@
// ************************************************************************************************
#include "GUI/View/Data/MasksQListView.h"
#include "GUI/Model/Files/MasksSet.h"
#include "GUI/Model/Mask/MasksQModel.h"
#include "GUI/Model/Mask/MasksSet.h"
#include "GUI/Model/Project/ProjectDocument.h"
#include "GUI/View/Data/MasksQModel.h"
#include "GUI/View/Widget/ListItemDelegate.h"
MasksQListView::MasksQListView(MasksQModel* model)
......@@ -26,14 +26,14 @@ MasksQListView::MasksQListView(MasksQModel* model)
setItemDelegate(new ListItemDelegate(this));
setModel(model);
connect(this, &QListView::clicked, [this](const QModelIndex& qi) {
gDoc->masksModifier()->setCurrentIndex(qi.row());
emit gDoc->masks()->setChanged();
connect(this, &QListView::clicked, [this, set = model->set()](const QModelIndex& qi) {
set->setCurrentIndex(qi.row());
emit set->setChanged();
});
disconnect(gDoc->masks(), &MasksSet::setChanged, nullptr, nullptr);
connect(gDoc->masks(), &MasksSet::setChanged, [this, model] {
setCurrentIndex(model->index(gDoc->masks()->currentIndex(), 0));
disconnect(model->set(), &MasksSet::setChanged, nullptr, nullptr);
connect(model->set(), &MasksSet::setChanged, [this, set = model->set()] {
setCurrentIndex(this->model()->index(set->currentIndex(), 0));
repaint();
});
}
......@@ -44,7 +44,7 @@ void addSpinBox(MaskItem* mask, QFormLayout* layout, DoubleProperty& property)
MasksPanel::MasksPanel()
: m_qlistmodel(new MasksQListModel(this))
: m_qlistmodel(new MasksQModel(this, nullptr))
, m_qlistview(new MasksQListView(m_qlistmodel))
, m_current_mask_item(nullptr)
{
......
......@@ -46,7 +46,7 @@ private:
std::function<void(bool)> setter);
MasksQModel* m_qlistmodel;
MaskQListView* m_qlistview;
MasksQListView* m_qlistview;
QFormLayout* m_editor_layout;
MaskItem* m_current_mask_item; //!< the mask item whose properties shall be edited
bool m_keep_selection = false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment