Commit bf4b16ed authored by Jochen Becher's avatar Jochen Becher

ModelEditor: Use Qt5-style connects

Change-Id: I35f284fd790713670ce31d4a802860b4d41c1ad3
Reviewed-by: default avatarTobias Hunger <tobias.hunger@theqtcompany.com>
parent 7b3aa16d
...@@ -74,8 +74,10 @@ void ConfigController::setStereotypeController(StereotypeController *stereotypeC ...@@ -74,8 +74,10 @@ void ConfigController::setStereotypeController(StereotypeController *stereotypeC
void ConfigController::readStereotypeDefinitions(const QString &path) void ConfigController::readStereotypeDefinitions(const QString &path)
{ {
StereotypeDefinitionParser parser; StereotypeDefinitionParser parser;
connect(&parser, SIGNAL(iconParsed(StereotypeIcon)), this, SLOT(onStereotypeIconParsed(StereotypeIcon))); connect(&parser, &StereotypeDefinitionParser::iconParsed,
connect(&parser, SIGNAL(toolbarParsed(Toolbar)), this, SLOT(onToolbarParsed(Toolbar))); this, &ConfigController::onStereotypeIconParsed);
connect(&parser, &StereotypeDefinitionParser::toolbarParsed,
this, &ConfigController::onToolbarParsed);
QDir dir(path); QDir dir(path);
dir.setNameFilters(QStringList() << QStringLiteral("*.def")); dir.setNameFilters(QStringList() << QStringLiteral("*.def"));
......
...@@ -53,11 +53,10 @@ public: ...@@ -53,11 +53,10 @@ public:
void readStereotypeDefinitions(const QString &path); void readStereotypeDefinitions(const QString &path);
private slots: private:
void onStereotypeIconParsed(const StereotypeIcon &stereotypeIcon); void onStereotypeIconParsed(const StereotypeIcon &stereotypeIcon);
void onToolbarParsed(const Toolbar &toolbar); void onToolbarParsed(const Toolbar &toolbar);
private:
ConfigControllerPrivate *d; ConfigControllerPrivate *d;
}; };
......
...@@ -43,7 +43,6 @@ public: ...@@ -43,7 +43,6 @@ public:
StringTextSource(); StringTextSource();
~StringTextSource(); ~StringTextSource();
public:
void setText(const QString &text); void setText(const QString &text);
int sourceId() const { return m_sourceId; } int sourceId() const { return m_sourceId; }
void setSourceId(int sourceId); void setSourceId(int sourceId);
......
...@@ -52,12 +52,10 @@ public: ...@@ -52,12 +52,10 @@ public:
QUndoStack *undoStack() const { return m_undoStack; } QUndoStack *undoStack() const { return m_undoStack; }
public slots:
void push(UndoCommand *cmd); void push(UndoCommand *cmd);
void beginMergeSequence(const QString &text); void beginMergeSequence(const QString &text);
void endMergeSequence(); void endMergeSequence();
public:
void reset(); void reset();
void doNotMerge(); void doNotMerge();
......
...@@ -350,38 +350,40 @@ void DiagramController::setModelController(ModelController *modelController) ...@@ -350,38 +350,40 @@ void DiagramController::setModelController(ModelController *modelController)
} }
if (modelController) { if (modelController) {
m_modelController = modelController; m_modelController = modelController;
connect(modelController, SIGNAL(beginResetModel()), this, SLOT(onBeginResetModel())); connect(modelController, &ModelController::beginResetModel,
connect(modelController, SIGNAL(endResetModel()), this, SLOT(onEndResetModel())); this, &DiagramController::onBeginResetModel);
connect(modelController, &ModelController::endResetModel,
connect(modelController, SIGNAL(beginUpdateObject(int,const MObject*)), this, &DiagramController::onEndResetModel);
this, SLOT(onBeginUpdateObject(int,const MObject*)));
connect(modelController, SIGNAL(endUpdateObject(int,const MObject*)), connect(modelController, &ModelController::beginUpdateObject,
this, SLOT(onEndUpdateObject(int,const MObject*))); this, &DiagramController::onBeginUpdateObject);
connect(modelController, SIGNAL(beginInsertObject(int,const MObject*)), connect(modelController, &ModelController::endUpdateObject,
this, SLOT(onBeginInsertObject(int,const MObject*))); this, &DiagramController::onEndUpdateObject);
connect(modelController, SIGNAL(endInsertObject(int,const MObject*)), connect(modelController, &ModelController::beginInsertObject,
this, SLOT(onEndInsertObject(int,const MObject*))); this, &DiagramController::onBeginInsertObject);
connect(modelController, SIGNAL(beginRemoveObject(int,const MObject*)), connect(modelController, &ModelController::endInsertObject,
this, SLOT(onBeginRemoveObject(int,const MObject*))); this, &DiagramController::onEndInsertObject);
connect(modelController, SIGNAL(endRemoveObject(int,const MObject*)), connect(modelController, &ModelController::beginRemoveObject,
this, SLOT(onEndRemoveObject(int,const MObject*))); this, &DiagramController::onBeginRemoveObject);
connect(modelController, SIGNAL(beginMoveObject(int,const MObject*)), connect(modelController, &ModelController::endRemoveObject,
this, SLOT(onBeginMoveObject(int,const MObject*))); this, &DiagramController::onEndRemoveObject);
connect(modelController, SIGNAL(endMoveObject(int,const MObject*)), connect(modelController, &ModelController::beginMoveObject,
this, SLOT(onEndMoveObject(int,const MObject*))); this, &DiagramController::onBeginMoveObject);
connect(modelController, &ModelController::endMoveObject,
connect(modelController, SIGNAL(beginUpdateRelation(int,const MObject*)), this, &DiagramController::onEndMoveObject);
this, SLOT(onBeginUpdateRelation(int,const MObject*)));
connect(modelController, SIGNAL(endUpdateRelation(int,const MObject*)), connect(modelController, &ModelController::beginUpdateRelation,
this, SLOT(onEndUpdateRelation(int,const MObject*))); this, &DiagramController::onBeginUpdateRelation);
connect(modelController, SIGNAL(beginRemoveRelation(int,const MObject*)), connect(modelController, &ModelController::endUpdateRelation,
this, SLOT(onBeginRemoveRelation(int,const MObject*))); this, &DiagramController::onEndUpdateRelation);
connect(modelController, SIGNAL(endRemoveRelation(int,const MObject*)), connect(modelController, &ModelController::beginRemoveRelation,
this, SLOT(onEndRemoveRelation(int,const MObject*))); this, &DiagramController::onBeginRemoveRelation);
connect(modelController, SIGNAL(beginMoveRelation(int,const MObject*)), connect(modelController, &ModelController::endRemoveRelation,
this, SLOT(onBeginMoveRelation(int,const MObject*))); this, &DiagramController::onEndRemoveRelation);
connect(modelController, SIGNAL(endMoveRelation(int,const MObject*)), connect(modelController, &ModelController::beginMoveRelation,
this, SLOT(onEndMoveRelation(int,const MObject*))); this, &DiagramController::onBeginMoveRelation);
connect(modelController, &ModelController::endMoveRelation,
this, &DiagramController::onEndMoveRelation);
} }
} }
......
...@@ -128,7 +128,7 @@ public: ...@@ -128,7 +128,7 @@ public:
void pasteElements(const DContainer &diagramContainer, MDiagram *diagram); void pasteElements(const DContainer &diagramContainer, MDiagram *diagram);
void deleteElements(const DSelection &diagramSelection, MDiagram *diagram); void deleteElements(const DSelection &diagramSelection, MDiagram *diagram);
private slots: private:
void onBeginResetModel(); void onBeginResetModel();
void onEndResetModel(); void onEndResetModel();
void onBeginUpdateObject(int row, const MObject *parent); void onBeginUpdateObject(int row, const MObject *parent);
...@@ -146,7 +146,6 @@ private slots: ...@@ -146,7 +146,6 @@ private slots:
void onBeginMoveRelation(int formerRow, const MObject *formerOwner); void onBeginMoveRelation(int formerRow, const MObject *formerOwner);
void onEndMoveRelation(int row, const MObject *owner); void onEndMoveRelation(int row, const MObject *owner);
private:
void deleteElements(const DSelection &diagramSelection, MDiagram *diagram, void deleteElements(const DSelection &diagramSelection, MDiagram *diagram,
const QString &commandLabel); const QString &commandLabel);
......
...@@ -108,7 +108,8 @@ DiagramSceneModel::DiagramSceneModel(QObject *parent) ...@@ -108,7 +108,8 @@ DiagramSceneModel::DiagramSceneModel(QObject *parent)
m_focusItem(0) m_focusItem(0)
{ {
m_latchController->setDiagramSceneModel(this); m_latchController->setDiagramSceneModel(this);
connect(m_graphicsScene, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged())); connect(m_graphicsScene, &QGraphicsScene::selectionChanged,
this, &DiagramSceneModel::onSelectionChanged);
// add one item at origin to force scene rect to include origin always // add one item at origin to force scene rect to include origin always
m_graphicsScene->addItem(m_originItem); m_graphicsScene->addItem(m_originItem);
...@@ -137,24 +138,26 @@ void DiagramSceneModel::setDiagramController(DiagramController *diagramControlle ...@@ -137,24 +138,26 @@ void DiagramSceneModel::setDiagramController(DiagramController *diagramControlle
} }
m_diagramController = diagramController; m_diagramController = diagramController;
if (diagramController) { if (diagramController) {
connect(m_diagramController, SIGNAL(beginResetAllDiagrams()), this, SLOT(onBeginResetAllDiagrams())); connect(m_diagramController, &DiagramController::beginResetAllDiagrams,
connect(m_diagramController, SIGNAL(endResetAllDiagrams()), this, SLOT(onEndResetAllDiagrams())); this, &DiagramSceneModel::onBeginResetAllDiagrams);
connect(m_diagramController, SIGNAL(beginResetDiagram(const MDiagram*)), connect(m_diagramController, &DiagramController::endResetAllDiagrams,
this, SLOT(onBeginResetDiagram(const MDiagram*))); this, &DiagramSceneModel::onEndResetAllDiagrams);
connect(m_diagramController, SIGNAL(endResetDiagram(const MDiagram*)), connect(m_diagramController, &DiagramController::beginResetDiagram,
this, SLOT(onEndResetDiagram(const MDiagram*))); this, &DiagramSceneModel::onBeginResetDiagram);
connect(m_diagramController, SIGNAL(beginUpdateElement(int,const MDiagram*)), connect(m_diagramController, &DiagramController::endResetDiagram,
this, SLOT(onBeginUpdateElement(int,const MDiagram*))); this, &DiagramSceneModel::onEndResetDiagram);
connect(m_diagramController, SIGNAL(endUpdateElement(int,const MDiagram*)), connect(m_diagramController, &DiagramController::beginUpdateElement,
this, SLOT(onEndUpdateElement(int,const MDiagram*))); this, &DiagramSceneModel::onBeginUpdateElement);
connect(m_diagramController, SIGNAL(beginInsertElement(int,const MDiagram*)), connect(m_diagramController, &DiagramController::endUpdateElement,
this, SLOT(onBeginInsertElement(int,const MDiagram*))); this, &DiagramSceneModel::onEndUpdateElement);
connect(m_diagramController, SIGNAL(endInsertElement(int,const MDiagram*)), connect(m_diagramController, &DiagramController::beginInsertElement,
this, SLOT(onEndInsertElement(int,const MDiagram*))); this, &DiagramSceneModel::onBeginInsertElement);
connect(m_diagramController, SIGNAL(beginRemoveElement(int,const MDiagram*)), connect(m_diagramController, &DiagramController::endInsertElement,
this, SLOT(onBeginRemoveElement(int,const MDiagram*))); this, &DiagramSceneModel::onEndInsertElement);
connect(m_diagramController, SIGNAL(endRemoveElement(int,const MDiagram*)), connect(m_diagramController, &DiagramController::beginRemoveElement,
this, SLOT(onEndRemoveElement(int,const MDiagram*))); this, &DiagramSceneModel::onBeginRemoveElement);
connect(m_diagramController, &DiagramController::endRemoveElement,
this, &DiagramSceneModel::onEndRemoveElement);
} }
} }
......
...@@ -135,7 +135,6 @@ private: ...@@ -135,7 +135,6 @@ private:
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
void mouseReleaseEventReparenting(QGraphicsSceneMouseEvent *event); void mouseReleaseEventReparenting(QGraphicsSceneMouseEvent *event);
private slots:
void onBeginResetAllDiagrams(); void onBeginResetAllDiagrams();
void onEndResetAllDiagrams(); void onEndResetAllDiagrams();
void onBeginResetDiagram(const MDiagram *diagram); void onBeginResetDiagram(const MDiagram *diagram);
...@@ -149,7 +148,6 @@ private slots: ...@@ -149,7 +148,6 @@ private slots:
void onSelectionChanged(); void onSelectionChanged();
private:
void clearGraphicsScene(); void clearGraphicsScene();
void removeExtraSceneItems(); void removeExtraSceneItems();
void addExtraSceneItems(); void addExtraSceneItems();
......
...@@ -98,10 +98,9 @@ protected: ...@@ -98,10 +98,9 @@ protected:
bool sceneEventFilter(QGraphicsItem *watched, QEvent *event); bool sceneEventFilter(QGraphicsItem *watched, QEvent *event);
private slots: private:
void onContentsChanged(); void onContentsChanged();
private:
QSizeF calcMinimumGeometry() const; QSizeF calcMinimumGeometry() const;
void updateGeometry(); void updateGeometry();
......
...@@ -96,10 +96,9 @@ protected: ...@@ -96,10 +96,9 @@ protected:
const Style *adaptedStyle(); const Style *adaptedStyle();
bool sceneEventFilter(QGraphicsItem *watched, QEvent *event); bool sceneEventFilter(QGraphicsItem *watched, QEvent *event);
private slots: private:
void onContentsChanged(); void onContentsChanged();
private:
QSizeF calcMinimumGeometry() const; QSizeF calcMinimumGeometry() const;
void updateGeometry(); void updateGeometry();
......
...@@ -88,9 +88,10 @@ void DiagramsManager::setModel(TreeModel *model) ...@@ -88,9 +88,10 @@ void DiagramsManager::setModel(TreeModel *model)
if (m_model) if (m_model)
connect(m_model, 0, this, 0); connect(m_model, 0, this, 0);
m_model = model; m_model = model;
if (model) if (model) {
connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), connect(model, &QAbstractItemModel::dataChanged,
this, SLOT(onDataChanged(QModelIndex,QModelIndex))); this, &DiagramsManager::onDataChanged);
}
} }
void DiagramsManager::setDiagramsView(DiagramsViewInterface *diagramsView) void DiagramsManager::setDiagramsView(DiagramsViewInterface *diagramsView)
...@@ -103,9 +104,10 @@ void DiagramsManager::setDiagramController(DiagramController *diagramController) ...@@ -103,9 +104,10 @@ void DiagramsManager::setDiagramController(DiagramController *diagramController)
if (m_diagramController) if (m_diagramController)
connect(m_diagramController, 0, this, 0); connect(m_diagramController, 0, this, 0);
m_diagramController = diagramController; m_diagramController = diagramController;
if (diagramController) if (diagramController) {
connect(diagramController, SIGNAL(diagramAboutToBeRemoved(const MDiagram*)), connect(diagramController, &DiagramController::diagramAboutToBeRemoved,
this, SLOT(removeDiagram(const MDiagram*))); this, &DiagramsManager::removeDiagram);
}
} }
void DiagramsManager::setDiagramSceneController(DiagramSceneController *diagramSceneController) void DiagramsManager::setDiagramSceneController(DiagramSceneController *diagramSceneController)
...@@ -132,10 +134,10 @@ DiagramSceneModel *DiagramsManager::bindDiagramSceneModel(MDiagram *diagram) ...@@ -132,10 +134,10 @@ DiagramSceneModel *DiagramsManager::bindDiagramSceneModel(MDiagram *diagram)
diagramSceneModel->setStyleController(m_styleController); diagramSceneModel->setStyleController(m_styleController);
diagramSceneModel->setStereotypeController(m_stereotypeController); diagramSceneModel->setStereotypeController(m_stereotypeController);
diagramSceneModel->setDiagram(diagram); diagramSceneModel->setDiagram(diagram);
connect(diagramSceneModel, SIGNAL(diagramSceneActivated(const MDiagram*)), connect(diagramSceneModel, &DiagramSceneModel::diagramSceneActivated,
this, SIGNAL(diagramActivated(const MDiagram*))); this, &DiagramsManager::diagramActivated);
connect(diagramSceneModel, SIGNAL(selectionHasChanged(const MDiagram*)), connect(diagramSceneModel, &DiagramSceneModel::selectionHasChanged,
this, SIGNAL(diagramSelectionChanged(const MDiagram*))); this, &DiagramsManager::diagramSelectionChanged);
ManagedDiagram *managedDiagram = new ManagedDiagram(diagramSceneModel, diagram->name()); ManagedDiagram *managedDiagram = new ManagedDiagram(diagramSceneModel, diagram->name());
m_diagramUidToManagedDiagramMap.insert(diagram->uid(), managedDiagram); m_diagramUidToManagedDiagramMap.insert(diagram->uid(), managedDiagram);
} }
......
...@@ -82,15 +82,13 @@ public: ...@@ -82,15 +82,13 @@ public:
DiagramSceneModel *diagramSceneModel(const MDiagram *diagram) const; DiagramSceneModel *diagramSceneModel(const MDiagram *diagram) const;
void unbindDiagramSceneModel(const MDiagram *diagram); void unbindDiagramSceneModel(const MDiagram *diagram);
public slots:
void openDiagram(MDiagram *diagram); void openDiagram(MDiagram *diagram);
void removeDiagram(const MDiagram *diagram); void removeDiagram(const MDiagram *diagram);
void removeAllDiagrams(); void removeAllDiagrams();
private slots: private:
void onDataChanged(const QModelIndex &topleft, const QModelIndex &bottomright); void onDataChanged(const QModelIndex &topleft, const QModelIndex &bottomright);
private:
QPointer<TreeModel> m_model; QPointer<TreeModel> m_model;
DiagramsViewInterface *m_diagramsView; DiagramsViewInterface *m_diagramsView;
DiagramController *m_diagramController; DiagramController *m_diagramController;
......
...@@ -48,8 +48,8 @@ DiagramsView::DiagramsView(QWidget *parent) ...@@ -48,8 +48,8 @@ DiagramsView::DiagramsView(QWidget *parent)
setTabsClosable(true); setTabsClosable(true);
setMovable(true); setMovable(true);
setDocumentMode(false); setDocumentMode(false);
connect(this, SIGNAL(currentChanged(int)), this, SLOT(onCurrentChanged(int))); connect(this, &QTabWidget::currentChanged, this, &DiagramsView::onCurrentChanged);
connect(this, SIGNAL(tabCloseRequested(int)), this, SLOT(onTabCloseRequested(int))); connect(this, &QTabWidget::tabCloseRequested, this, &DiagramsView::onTabCloseRequested);
} }
DiagramsView::~DiagramsView() DiagramsView::~DiagramsView()
......
...@@ -63,17 +63,15 @@ signals: ...@@ -63,17 +63,15 @@ signals:
public: public:
void setDiagramsManager(DiagramsManager *diagramsManager); void setDiagramsManager(DiagramsManager *diagramsManager);
public slots:
void openDiagram(MDiagram *diagram); void openDiagram(MDiagram *diagram);
void closeDiagram(const MDiagram *diagram); void closeDiagram(const MDiagram *diagram);
void closeAllDiagrams(); void closeAllDiagrams();
void onDiagramRenamed(const MDiagram *diagram); void onDiagramRenamed(const MDiagram *diagram);
private slots: private:
void onCurrentChanged(int tabIndex); void onCurrentChanged(int tabIndex);
void onTabCloseRequested(int tabIndex); void onTabCloseRequested(int tabIndex);
private:
MDiagram *diagram(int tabIndex) const; MDiagram *diagram(int tabIndex) const;
MDiagram *diagram(DiagramView * diagramView) const; MDiagram *diagram(DiagramView * diagramView) const;
......
...@@ -45,7 +45,7 @@ StackedDiagramsView::StackedDiagramsView(QWidget *parent) ...@@ -45,7 +45,7 @@ StackedDiagramsView::StackedDiagramsView(QWidget *parent)
: QStackedWidget(parent), : QStackedWidget(parent),
m_diagramsManager(0) m_diagramsManager(0)
{ {
connect(this, SIGNAL(currentChanged(int)), this, SLOT(onCurrentChanged(int))); connect(this, &QStackedWidget::currentChanged, this, &StackedDiagramsView::onCurrentChanged);
} }
StackedDiagramsView::~StackedDiagramsView() StackedDiagramsView::~StackedDiagramsView()
......
...@@ -62,16 +62,14 @@ signals: ...@@ -62,16 +62,14 @@ signals:
public: public:
void setDiagramsManager(DiagramsManager *diagramsManager); void setDiagramsManager(DiagramsManager *diagramsManager);
public slots:
void openDiagram(MDiagram *diagram); void openDiagram(MDiagram *diagram);
void closeDiagram(const MDiagram *diagram); void closeDiagram(const MDiagram *diagram);
void closeAllDiagrams(); void closeAllDiagrams();
void onDiagramRenamed(const MDiagram *diagram); void onDiagramRenamed(const MDiagram *diagram);
private slots: private:
void onCurrentChanged(int tabIndex); void onCurrentChanged(int tabIndex);
private:
MDiagram *diagram(int tabIndex) const; MDiagram *diagram(int tabIndex) const;
MDiagram *diagram(DiagramView * diagramView) const; MDiagram *diagram(DiagramView * diagramView) const;
......
...@@ -80,16 +80,18 @@ DocumentController::DocumentController(QObject *parent) : ...@@ -80,16 +80,18 @@ DocumentController::DocumentController(QObject *parent) :
m_diagramClipboard(new DContainer()) m_diagramClipboard(new DContainer())
{ {
// project controller // project controller
QObject::connect(m_projectController, SIGNAL(changed()), this, SIGNAL(changed())); connect(m_projectController, &ProjectController::changed, this, &DocumentController::changed);
// model controller // model controller
m_modelController->setUndoController(m_undoController); m_modelController->setUndoController(m_undoController);
QObject::connect(m_modelController, SIGNAL(modified()), m_projectController, SLOT(setModified())); connect(m_modelController, &ModelController::modified,
m_projectController, &ProjectController::setModified);
// diagram controller // diagram controller
m_diagramController->setModelController(m_modelController); m_diagramController->setModelController(m_modelController);
m_diagramController->setUndoController(m_undoController); m_diagramController->setUndoController(m_undoController);
QObject::connect(m_diagramController, SIGNAL(modified(const MDiagram*)), m_projectController, SLOT(setModified())); connect(m_diagramController, &DiagramController::modified,
m_projectController, &ProjectController::setModified);
// diagram scene controller // diagram scene controller
m_diagramSceneController->setModelController(m_modelController); m_diagramSceneController->setModelController(m_modelController);
......
...@@ -41,12 +41,12 @@ SortedTreeModel::SortedTreeModel(QObject *parent) ...@@ -41,12 +41,12 @@ SortedTreeModel::SortedTreeModel(QObject *parent)
setSortCaseSensitivity(Qt::CaseInsensitive); setSortCaseSensitivity(Qt::CaseInsensitive);
m_delayedSortTimer.setSingleShot(true); m_delayedSortTimer.setSingleShot(true);
connect(&m_delayedSortTimer, SIGNAL(timeout()), this, SLOT(onDelayedSortTimeout())); connect(&m_delayedSortTimer, &QTimer::timeout, this, &SortedTreeModel::onDelayedSortTimeout);
connect(this, SIGNAL(rowsInserted(QModelIndex,int,int)), connect(this, &QAbstractItemModel::rowsInserted,
this, SLOT(onTreeModelRowsInserted(QModelIndex,int,int))); this, &SortedTreeModel::onTreeModelRowsInserted);
connect(this, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)), connect(this, &QAbstractItemModel::dataChanged,
this, SLOT(onDataChanged(QModelIndex,QModelIndex,QVector<int>))); this, &SortedTreeModel::onDataChanged);
} }
SortedTreeModel::~SortedTreeModel() SortedTreeModel::~SortedTreeModel()
......
...@@ -54,12 +54,11 @@ public: ...@@ -54,12 +54,11 @@ public:
protected: protected:
bool lessThan(const QModelIndex &left, const QModelIndex &right) const; bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
private slots: private:
void onTreeModelRowsInserted(const QModelIndex &parent, int start, int end); void onTreeModelRowsInserted(const QModelIndex &parent, int start, int end);
void onDataChanged(const QModelIndex &, const QModelIndex &, const QVector<int> &); void onDataChanged(const QModelIndex &, const QModelIndex &, const QVector<int> &);
void onDelayedSortTimeout(); void onDelayedSortTimeout();
private:
void startDelayedSortTimer(); void startDelayedSortTimer();
TreeModel *m_treeModel; TreeModel *m_treeModel;
......
...@@ -321,8 +321,8 @@ TreeModel::TreeModel(QObject *parent) ...@@ -321,8 +321,8 @@ TreeModel::TreeModel(QObject *parent)
m_rootItem(0), m_rootItem(0),
m_busyState(NotBusy) m_busyState(NotBusy)
{ {
connect(this, SIGNAL(dataChanged(QModelIndex,QModelIndex)), connect(this, &QAbstractItemModel::dataChanged,
this, SLOT(onModelDataChanged(QModelIndex,QModelIndex))); this, &TreeModel::onModelDataChanged);
} }
TreeModel::~TreeModel() TreeModel::~TreeModel()
...@@ -339,45 +339,47 @@ void TreeModel::setModelController(ModelController *modelController) ...@@ -339,45 +339,47 @@ void TreeModel::setModelController(ModelController *modelController)
disconnect(m_modelController, 0, this, 0); disconnect(m_modelController, 0, this, 0);
m_modelController = modelController; m_modelController = modelController;
if (m_modelController) { if (m_modelController) {
connect(m_modelController, SIGNAL(beginResetModel()), this, SLOT(onBeginResetModel())); connect(m_modelController, &ModelController::beginResetModel,
connect(m_modelController, SIGNAL(endResetModel()), this, SLOT(onEndResetModel())); this, &TreeModel::onBeginResetModel);
connect(m_modelController, &ModelController::endResetModel,
connect(m_modelController, SIGNAL(beginInsertObject(int,const MObject*)), this, &TreeModel::onEndResetModel);
this, SLOT(onBeginInsertObject(int,const MObject*)));
connect(m_modelController, SIGNAL(endInsertObject(int,const MObject*)), connect(m_modelController, &ModelController::beginInsertObject,
this, SLOT(onEndInsertObject(int,const MObject*))); this, &TreeModel::onBeginInsertObject);
connect(m_modelController, SIGNAL(beginUpdateObject(int,const MObject*)), connect(m_modelController, &ModelController::endInsertObject,
this, SLOT(onBeginUpdateObject(int,const MObject*))); this, &TreeModel::onEndInsertObject);
connect(m_modelController, SIGNAL(endUpdateObject(int,const MObject*)), connect(m_modelController, &ModelController::beginUpdateObject,
this, SLOT(onEndUpdateObject(int,const MObject*))); this, &TreeModel::onBeginUpdateObject);
connect(m_modelController, SIGNAL(beginRemoveObject(int,const MObject*)), connect(m_modelController, &ModelController::endUpdateObject,
this, SLOT(onBeginRemoveObject(int,const MObject*))); this, &TreeModel::onEndUpdateObject);
connect(m_modelController, SIGNAL(endRemoveObject(int,const MObject*)), connect(m_modelController, &ModelController::beginRemoveObject,
this, SLOT(onEndRemoveObject(int,const MObject*))); this, &TreeModel::onBeginRemoveObject);
connect(m_modelController, SIGNAL(beginMoveObject(int,const MObject*)), connect(m_modelController, &ModelController::endRemoveObject,
this, SLOT(onBeginMoveObject(int,const MObject*))); this, &TreeModel::onEndRemoveObject);
connect(m_modelController, SIGNAL(endMoveObject(int,const MObject*)), connect(m_modelController, &ModelController::beginMoveObject,
this, SLOT(onEndMoveObject(int,const MObject*))); this, &TreeModel::onBeginMoveObject);
connect(m_modelController, &ModelController::endMoveObject,
connect(m_modelController, SIGNAL(beginInsertRelation(int,const MObject*)), this, &TreeModel::onEndMoveObject);
this, SLOT(onBeginInsertRelation(int,const MObject*)));
connect(m_modelController, SIGNAL(endInsertRelation(int,const MObject*)), connect(m_modelController, &ModelController::beginInsertRelation,
this, SLOT(onEndInsertRelation(int,const MObject*))); this, &TreeModel::onBeginInsertRelation);
connect(m_modelController, SIGNAL(beginUpdateRelation(int,const MObject*)), connect(m_modelController, &ModelController::endInsertRelation,
this, SLOT(onBeginUpdateRelation(int,const MObject*))); this, &TreeModel::onEndInsertRelation);
connect(m_modelController, SIGNAL(endUpdateRelation(int,const MObject*)), connect(m_modelController, &ModelController::beginUpdateRelation,
this, SLOT(onEndUpdateRelation(int,const MObject*))); this, &TreeModel::onBeginUpdateRelation);
connect(m_modelController, SIGNAL(beginRemoveRelation(int,const MObject*)), connect(m_modelController, &ModelController::endUpdateRelation,
this, SLOT(onBeginRemoveRelation(int,const MObject*))); this, &TreeModel::onEndUpdateRelation);
connect(m_modelController, SIGNAL(endRemoveRelation(int,const MObject*)), connect(m_modelController, &ModelController::beginRemoveRelation,
this, SLOT(onEndRemoveRelation(int,const MObject*))); this, &TreeModel::onBeginRemoveRelation);
connect(m_modelController, SIGNAL(beginMoveRelation(int,const MObject*)), connect(m_modelController, &ModelController::endRemoveRelation,
this, SLOT(onBeginMoveRelation(int,const MObject*))); this, &TreeModel::onEndRemoveRelation);
connect(m_modelController, SIGNAL(endMoveRelation(int,const MObject*)), connect(m_modelController, &ModelController::beginMoveRelation,
this, SLOT(onEndMoveRelation(int,const MObject*)));