ModelEditor: Use Qt5-style connects

Change-Id: I35f284fd790713670ce31d4a802860b4d41c1ad3
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
Jochen Becher
2015-11-21 18:50:29 +01:00
parent 7b3aa16dc6
commit bf4b16ed5f
30 changed files with 254 additions and 237 deletions

View File

@@ -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"));

View File

@@ -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;
}; };

View File

@@ -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);

View File

@@ -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();

View File

@@ -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,
this, &DiagramController::onEndResetModel);
connect(modelController, SIGNAL(beginUpdateObject(int,const MObject*)), connect(modelController, &ModelController::beginUpdateObject,
this, SLOT(onBeginUpdateObject(int,const MObject*))); this, &DiagramController::onBeginUpdateObject);
connect(modelController, SIGNAL(endUpdateObject(int,const MObject*)), connect(modelController, &ModelController::endUpdateObject,
this, SLOT(onEndUpdateObject(int,const MObject*))); this, &DiagramController::onEndUpdateObject);
connect(modelController, SIGNAL(beginInsertObject(int,const MObject*)), connect(modelController, &ModelController::beginInsertObject,
this, SLOT(onBeginInsertObject(int,const MObject*))); this, &DiagramController::onBeginInsertObject);
connect(modelController, SIGNAL(endInsertObject(int,const MObject*)), connect(modelController, &ModelController::endInsertObject,
this, SLOT(onEndInsertObject(int,const MObject*))); this, &DiagramController::onEndInsertObject);
connect(modelController, SIGNAL(beginRemoveObject(int,const MObject*)), connect(modelController, &ModelController::beginRemoveObject,
this, SLOT(onBeginRemoveObject(int,const MObject*))); this, &DiagramController::onBeginRemoveObject);
connect(modelController, SIGNAL(endRemoveObject(int,const MObject*)), connect(modelController, &ModelController::endRemoveObject,
this, SLOT(onEndRemoveObject(int,const MObject*))); this, &DiagramController::onEndRemoveObject);
connect(modelController, SIGNAL(beginMoveObject(int,const MObject*)), connect(modelController, &ModelController::beginMoveObject,
this, SLOT(onBeginMoveObject(int,const MObject*))); this, &DiagramController::onBeginMoveObject);
connect(modelController, SIGNAL(endMoveObject(int,const MObject*)), connect(modelController, &ModelController::endMoveObject,
this, SLOT(onEndMoveObject(int,const MObject*))); this, &DiagramController::onEndMoveObject);
connect(modelController, SIGNAL(beginUpdateRelation(int,const MObject*)), connect(modelController, &ModelController::beginUpdateRelation,
this, SLOT(onBeginUpdateRelation(int,const MObject*))); this, &DiagramController::onBeginUpdateRelation);
connect(modelController, SIGNAL(endUpdateRelation(int,const MObject*)), connect(modelController, &ModelController::endUpdateRelation,
this, SLOT(onEndUpdateRelation(int,const MObject*))); this, &DiagramController::onEndUpdateRelation);
connect(modelController, SIGNAL(beginRemoveRelation(int,const MObject*)), connect(modelController, &ModelController::beginRemoveRelation,
this, SLOT(onBeginRemoveRelation(int,const MObject*))); this, &DiagramController::onBeginRemoveRelation);
connect(modelController, SIGNAL(endRemoveRelation(int,const MObject*)), connect(modelController, &ModelController::endRemoveRelation,
this, SLOT(onEndRemoveRelation(int,const MObject*))); this, &DiagramController::onEndRemoveRelation);
connect(modelController, SIGNAL(beginMoveRelation(int,const MObject*)), connect(modelController, &ModelController::beginMoveRelation,
this, SLOT(onBeginMoveRelation(int,const MObject*))); this, &DiagramController::onBeginMoveRelation);
connect(modelController, SIGNAL(endMoveRelation(int,const MObject*)), connect(modelController, &ModelController::endMoveRelation,
this, SLOT(onEndMoveRelation(int,const MObject*))); this, &DiagramController::onEndMoveRelation);
} }
} }

View File

@@ -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:
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);

View File

@@ -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
} }
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);
} }
} }

View File

@@ -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:
void onSelectionChanged(); void onSelectionChanged();
private:
void clearGraphicsScene(); void clearGraphicsScene();
void removeExtraSceneItems(); void removeExtraSceneItems();
void addExtraSceneItems(); void addExtraSceneItems();

View File

@@ -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();

View File

@@ -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();

View File

@@ -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)
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)
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);
} }

View File

@@ -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;

View File

@@ -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()

View File

@@ -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;

View File

@@ -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()

View File

@@ -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;

View File

@@ -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);

View File

@@ -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()

View File

@@ -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;

View File

@@ -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)
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,
this, &TreeModel::onEndResetModel);
connect(m_modelController, SIGNAL(beginInsertObject(int,const MObject*)), connect(m_modelController, &ModelController::beginInsertObject,
this, SLOT(onBeginInsertObject(int,const MObject*))); this, &TreeModel::onBeginInsertObject);
connect(m_modelController, SIGNAL(endInsertObject(int,const MObject*)), connect(m_modelController, &ModelController::endInsertObject,
this, SLOT(onEndInsertObject(int,const MObject*))); this, &TreeModel::onEndInsertObject);
connect(m_modelController, SIGNAL(beginUpdateObject(int,const MObject*)), connect(m_modelController, &ModelController::beginUpdateObject,
this, SLOT(onBeginUpdateObject(int,const MObject*))); this, &TreeModel::onBeginUpdateObject);
connect(m_modelController, SIGNAL(endUpdateObject(int,const MObject*)), connect(m_modelController, &ModelController::endUpdateObject,
this, SLOT(onEndUpdateObject(int,const MObject*))); this, &TreeModel::onEndUpdateObject);
connect(m_modelController, SIGNAL(beginRemoveObject(int,const MObject*)), connect(m_modelController, &ModelController::beginRemoveObject,
this, SLOT(onBeginRemoveObject(int,const MObject*))); this, &TreeModel::onBeginRemoveObject);
connect(m_modelController, SIGNAL(endRemoveObject(int,const MObject*)), connect(m_modelController, &ModelController::endRemoveObject,
this, SLOT(onEndRemoveObject(int,const MObject*))); this, &TreeModel::onEndRemoveObject);
connect(m_modelController, SIGNAL(beginMoveObject(int,const MObject*)), connect(m_modelController, &ModelController::beginMoveObject,
this, SLOT(onBeginMoveObject(int,const MObject*))); this, &TreeModel::onBeginMoveObject);
connect(m_modelController, SIGNAL(endMoveObject(int,const MObject*)), connect(m_modelController, &ModelController::endMoveObject,
this, SLOT(onEndMoveObject(int,const MObject*))); this, &TreeModel::onEndMoveObject);
connect(m_modelController, SIGNAL(beginInsertRelation(int,const MObject*)), connect(m_modelController, &ModelController::beginInsertRelation,
this, SLOT(onBeginInsertRelation(int,const MObject*))); this, &TreeModel::onBeginInsertRelation);
connect(m_modelController, SIGNAL(endInsertRelation(int,const MObject*)), connect(m_modelController, &ModelController::endInsertRelation,
this, SLOT(onEndInsertRelation(int,const MObject*))); this, &TreeModel::onEndInsertRelation);
connect(m_modelController, SIGNAL(beginUpdateRelation(int,const MObject*)), connect(m_modelController, &ModelController::beginUpdateRelation,
this, SLOT(onBeginUpdateRelation(int,const MObject*))); this, &TreeModel::onBeginUpdateRelation);
connect(m_modelController, SIGNAL(endUpdateRelation(int,const MObject*)), connect(m_modelController, &ModelController::endUpdateRelation,
this, SLOT(onEndUpdateRelation(int,const MObject*))); this, &TreeModel::onEndUpdateRelation);
connect(m_modelController, SIGNAL(beginRemoveRelation(int,const MObject*)), connect(m_modelController, &ModelController::beginRemoveRelation,
this, SLOT(onBeginRemoveRelation(int,const MObject*))); this, &TreeModel::onBeginRemoveRelation);
connect(m_modelController, SIGNAL(endRemoveRelation(int,const MObject*)), connect(m_modelController, &ModelController::endRemoveRelation,
this, SLOT(onEndRemoveRelation(int,const MObject*))); this, &TreeModel::onEndRemoveRelation);
connect(m_modelController, SIGNAL(beginMoveRelation(int,const MObject*)), connect(m_modelController, &ModelController::beginMoveRelation,
this, SLOT(onBeginMoveRelation(int,const MObject*))); this, &TreeModel::onBeginMoveRelation);
connect(m_modelController, SIGNAL(endMoveRelation(int,const MObject*)), connect(m_modelController, &ModelController::endMoveRelation,
this, SLOT(onEndMoveRelation(int,const MObject*))); this, &TreeModel::onEndMoveRelation);
connect(m_modelController, SIGNAL(relationEndChanged(MRelation*,MObject*)), connect(m_modelController, &ModelController::relationEndChanged,
this, SLOT(onRelationEndChanged(MRelation*,MObject*))); this, &TreeModel::onRelationEndChanged);
} }
} }
} }

View File

@@ -91,7 +91,7 @@ public:
Qt::DropActions supportedDropActions() const; Qt::DropActions supportedDropActions() const;
QStringList mimeTypes() const; QStringList mimeTypes() const;
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);
@@ -113,7 +113,6 @@ private slots:
void onRelationEndChanged(MRelation *relation, MObject *endObject); void onRelationEndChanged(MRelation *relation, MObject *endObject);
void onModelDataChanged(const QModelIndex &topleft, const QModelIndex &bottomright); void onModelDataChanged(const QModelIndex &topleft, const QModelIndex &bottomright);
private:
void clear(); void clear();
ModelItem *createItem(const MElement *element); ModelItem *createItem(const MElement *element);
void createChildren(const MObject *parentObject, ModelItem *parentItem); void createChildren(const MObject *parentObject, ModelItem *parentItem);

View File

@@ -289,7 +289,7 @@ ClassMembersEdit::ClassMembersEdit(QWidget *parent)
d(new ClassMembersEditPrivate) d(new ClassMembersEditPrivate)
{ {
setTabChangesFocus(true); setTabChangesFocus(true);
connect(this, SIGNAL(textChanged()), this, SLOT(onTextChanged())); connect(this, &QPlainTextEdit::textChanged, this, &ClassMembersEdit::onTextChanged);
} }
ClassMembersEdit::~ClassMembersEdit() ClassMembersEdit::~ClassMembersEdit()

View File

@@ -56,13 +56,11 @@ public:
QList<MClassMember> members() const; QList<MClassMember> members() const;
void setMembers(const QList<MClassMember> &members); void setMembers(const QList<MClassMember> &members);
public slots:
void reparse(); void reparse();
private slots: private:
void onTextChanged(); void onTextChanged();
private:
QString build(const QList<MClassMember> &members); QString build(const QList<MClassMember> &members);
QList<MClassMember> parse(const QString &text, bool *ok); QList<MClassMember> parse(const QString &text, bool *ok);

View File

@@ -57,7 +57,6 @@ public:
void setLinePen(int index, const QPen &pen); void setLinePen(int index, const QPen &pen);
int currentIndex() const { return m_currentIndex; } int currentIndex() const { return m_currentIndex; }
public slots:
void clear(); void clear();
void setCurrentIndex(int index); void setCurrentIndex(int index);

View File

@@ -64,45 +64,47 @@ void PropertiesView::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, &PropertiesView::onBeginResetModel);
connect(m_modelController, &ModelController::endResetModel,
this, &PropertiesView::onEndResetModel);
connect(m_modelController, SIGNAL(beginInsertObject(int,const MObject*)), connect(m_modelController, &ModelController::beginInsertObject,
this, SLOT(onBeginInsertObject(int,const MObject*))); this, &PropertiesView::onBeginInsertObject);
connect(m_modelController, SIGNAL(endInsertObject(int,const MObject*)), connect(m_modelController, &ModelController::endInsertObject,
this, SLOT(onEndInsertObject(int,const MObject*))); this, &PropertiesView::onEndInsertObject);
connect(m_modelController, SIGNAL(beginUpdateObject(int,const MObject*)), connect(m_modelController, &ModelController::beginUpdateObject,
this, SLOT(onBeginUpdateObject(int,const MObject*))); this, &PropertiesView::onBeginUpdateObject);
connect(m_modelController, SIGNAL(endUpdateObject(int,const MObject*)), connect(m_modelController, &ModelController::endUpdateObject,
this, SLOT(onEndUpdateObject(int,const MObject*))); this, &PropertiesView::onEndUpdateObject);
connect(m_modelController, SIGNAL(beginRemoveObject(int,const MObject*)), connect(m_modelController, &ModelController::beginRemoveObject,
this, SLOT(onBeginRemoveObject(int,const MObject*))); this, &PropertiesView::onBeginRemoveObject);
connect(m_modelController, SIGNAL(endRemoveObject(int,const MObject*)), connect(m_modelController, &ModelController::endRemoveObject,
this, SLOT(onEndRemoveObject(int,const MObject*))); this, &PropertiesView::onEndRemoveObject);
connect(m_modelController, SIGNAL(beginMoveObject(int,const MObject*)), connect(m_modelController, &ModelController::beginMoveObject,
this, SLOT(onBeginMoveObject(int,const MObject*))); this, &PropertiesView::onBeginMoveObject);
connect(m_modelController, SIGNAL(endMoveObject(int,const MObject*)), connect(m_modelController, &ModelController::endMoveObject,
this, SLOT(onEndMoveObject(int,const MObject*))); this, &PropertiesView::onEndMoveObject);
connect(m_modelController, SIGNAL(beginInsertRelation(int,const MObject*)), connect(m_modelController, &ModelController::beginInsertRelation,
this, SLOT(onBeginInsertRelation(int,const MObject*))); this, &PropertiesView::onBeginInsertRelation);
connect(m_modelController, SIGNAL(endInsertRelation(int,const MObject*)), connect(m_modelController, &ModelController::endInsertRelation,
this, SLOT(onEndInsertRelation(int,const MObject*))); this, &PropertiesView::onEndInsertRelation);
connect(m_modelController, SIGNAL(beginUpdateRelation(int,const MObject*)), connect(m_modelController, &ModelController::beginUpdateRelation,
this, SLOT(onBeginUpdateRelation(int,const MObject*))); this, &PropertiesView::onBeginUpdateRelation);
connect(m_modelController, SIGNAL(endUpdateRelation(int,const MObject*)), connect(m_modelController, &ModelController::endUpdateRelation,
this, SLOT(onEndUpdateRelation(int,const MObject*))); this, &PropertiesView::onEndUpdateRelation);
connect(m_modelController, SIGNAL(beginRemoveRelation(int,const MObject*)), connect(m_modelController, &ModelController::beginRemoveRelation,
this, SLOT(onBeginRemoveRelation(int,const MObject*))); this, &PropertiesView::onBeginRemoveRelation);
connect(m_modelController, SIGNAL(endRemoveRelation(int,const MObject*)), connect(m_modelController, &ModelController::endRemoveRelation,
this, SLOT(onEndRemoveRelation(int,const MObject*))); this, &PropertiesView::onEndRemoveRelation);
connect(m_modelController, SIGNAL(beginMoveRelation(int,const MObject*)), connect(m_modelController, &ModelController::beginMoveRelation,
this, SLOT(onBeginMoveRelation(int,const MObject*))); this, &PropertiesView::onBeginMoveRelation);
connect(m_modelController, SIGNAL(endMoveRelation(int,const MObject*)), connect(m_modelController, &ModelController::endMoveRelation,
this, SLOT(onEndMoveRelation(int,const MObject*))); this, &PropertiesView::onEndMoveRelation);
connect(m_modelController, SIGNAL(relationEndChanged(MRelation*,MObject*)), connect(m_modelController, &ModelController::relationEndChanged,
this, SLOT(onRelationEndChanged(MRelation*,MObject*))); this, &PropertiesView::onRelationEndChanged);
} }
} }
} }
@@ -116,26 +118,28 @@ void PropertiesView::setDiagramController(DiagramController *diagramController)
} }
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, &PropertiesView::onBeginResetAllDiagrams);
connect(m_diagramController, &DiagramController::endResetAllDiagrams,
this, &PropertiesView::onEndResetAllDiagrams);
connect(m_diagramController, SIGNAL(beginResetDiagram(const MDiagram*)), connect(m_diagramController, &DiagramController::beginResetDiagram,
this, SLOT(onBeginResetDiagram(const MDiagram*))); this, &PropertiesView::onBeginResetDiagram);
connect(m_diagramController, SIGNAL(endResetDiagram(const MDiagram*)), connect(m_diagramController, &DiagramController::endResetDiagram,
this, SLOT(onEndResetDiagram(const MDiagram*))); this, &PropertiesView::onEndResetDiagram);
connect(m_diagramController, SIGNAL(beginUpdateElement(int,const MDiagram*)), connect(m_diagramController, &DiagramController::beginUpdateElement,
this, SLOT(onBeginUpdateElement(int,const MDiagram*))); this, &PropertiesView::onBeginUpdateElement);
connect(m_diagramController, SIGNAL(endUpdateElement(int,const MDiagram*)), connect(m_diagramController, &DiagramController::endUpdateElement,
this, SLOT(onEndUpdateElement(int,const MDiagram*))); this, &PropertiesView::onEndUpdateElement);
connect(m_diagramController, SIGNAL(beginInsertElement(int,const MDiagram*)), connect(m_diagramController, &DiagramController::beginInsertElement,
this, SLOT(onBeginInsertElement(int,const MDiagram*))); this, &PropertiesView::onBeginInsertElement);
connect(m_diagramController, SIGNAL(endInsertElement(int,const MDiagram*)), connect(m_diagramController, &DiagramController::endInsertElement,
this, SLOT(onEndInsertElement(int,const MDiagram*))); this, &PropertiesView::onEndInsertElement);
connect(m_diagramController, SIGNAL(beginRemoveElement(int,const MDiagram*)), connect(m_diagramController, &DiagramController::beginRemoveElement,
this, SLOT(onBeginRemoveElement(int,const MDiagram*))); this, &PropertiesView::onBeginRemoveElement);
connect(m_diagramController, SIGNAL(endRemoveElement(int,const MDiagram*)), connect(m_diagramController, &DiagramController::endRemoveElement,
this, SLOT(onEndRemoveElement(int,const MDiagram*))); this, &PropertiesView::onEndRemoveElement);
} }
} }
} }

View File

@@ -80,10 +80,9 @@ public:
QWidget *widget() const; QWidget *widget() const;
public slots:
void editSelectedElement(); void editSelectedElement();
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);
@@ -115,7 +114,6 @@ private slots:
void onBeginRemoveElement(int row, const MDiagram *diagram); void onBeginRemoveElement(int row, const MDiagram *diagram);
void onEndRemoveElement(int row, const MDiagram *diagram); void onEndRemoveElement(int row, const MDiagram *diagram);
private:
void beginUpdate(MElement *modelElement); void beginUpdate(MElement *modelElement);
void endUpdate(MElement *modelElement, bool cancelled); void endUpdate(MElement *modelElement, bool cancelled);
void beginUpdate(DElement *diagramElement); void beginUpdate(DElement *diagramElement);

View File

@@ -390,9 +390,10 @@ void PropertiesView::MView::visitMElement(const MElement *element)
m_stereotypeComboBox->setInsertPolicy(QComboBox::NoInsert); m_stereotypeComboBox->setInsertPolicy(QComboBox::NoInsert);
m_topLayout->addRow(tr("Stereotypes:"), m_stereotypeComboBox); m_topLayout->addRow(tr("Stereotypes:"), m_stereotypeComboBox);
m_stereotypeComboBox->addItems(m_propertiesView->stereotypeController()->knownStereotypes(m_stereotypeElement)); m_stereotypeComboBox->addItems(m_propertiesView->stereotypeController()->knownStereotypes(m_stereotypeElement));
connect(m_stereotypeComboBox->lineEdit(), SIGNAL(textEdited(QString)), connect(m_stereotypeComboBox->lineEdit(), &QLineEdit::textEdited,
this, SLOT(onStereotypesChanged(QString))); this, &PropertiesView::MView::onStereotypesChanged);
connect(m_stereotypeComboBox, SIGNAL(activated(QString)), this, SLOT(onStereotypesChanged(QString))); connect(m_stereotypeComboBox, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::activated),
this, &PropertiesView::MView::onStereotypesChanged);
} }
if (!m_stereotypeComboBox->hasFocus()) { if (!m_stereotypeComboBox->hasFocus()) {
QList<QString> stereotypeList; QList<QString> stereotypeList;
@@ -424,7 +425,8 @@ void PropertiesView::MView::visitMObject(const MObject *object)
if (m_elementNameLineEdit == 0) { if (m_elementNameLineEdit == 0) {
m_elementNameLineEdit = new QLineEdit(m_topWidget); m_elementNameLineEdit = new QLineEdit(m_topWidget);
m_topLayout->addRow(tr("Name:"), m_elementNameLineEdit); m_topLayout->addRow(tr("Name:"), m_elementNameLineEdit);
connect(m_elementNameLineEdit, SIGNAL(textChanged(QString)), this, SLOT(onObjectNameChanged(QString))); connect(m_elementNameLineEdit, &QLineEdit::textChanged,
this, &PropertiesView::MView::onObjectNameChanged);
} }
if (isSingleSelection) { if (isSingleSelection) {
if (object->name() != m_elementNameLineEdit->text() && !m_elementNameLineEdit->hasFocus()) if (object->name() != m_elementNameLineEdit->text() && !m_elementNameLineEdit->hasFocus())
@@ -467,7 +469,8 @@ void PropertiesView::MView::visitMClass(const MClass *klass)
if (m_namespaceLineEdit == 0) { if (m_namespaceLineEdit == 0) {
m_namespaceLineEdit = new QLineEdit(m_topWidget); m_namespaceLineEdit = new QLineEdit(m_topWidget);
m_topLayout->addRow(tr("Namespace:"), m_namespaceLineEdit); m_topLayout->addRow(tr("Namespace:"), m_namespaceLineEdit);
connect(m_namespaceLineEdit, SIGNAL(textEdited(QString)), this, SLOT(onNamespaceChanged(QString))); connect(m_namespaceLineEdit, &QLineEdit::textEdited,
this, &PropertiesView::MView::onNamespaceChanged);
} }
if (!m_namespaceLineEdit->hasFocus()) { if (!m_namespaceLineEdit->hasFocus()) {
QString umlNamespace; QString umlNamespace;
@@ -483,8 +486,8 @@ void PropertiesView::MView::visitMClass(const MClass *klass)
if (m_templateParametersLineEdit == 0) { if (m_templateParametersLineEdit == 0) {
m_templateParametersLineEdit = new QLineEdit(m_topWidget); m_templateParametersLineEdit = new QLineEdit(m_topWidget);
m_topLayout->addRow(tr("Template:"), m_templateParametersLineEdit); m_topLayout->addRow(tr("Template:"), m_templateParametersLineEdit);
connect(m_templateParametersLineEdit, SIGNAL(textChanged(QString)), connect(m_templateParametersLineEdit, &QLineEdit::textChanged,
this, SLOT(onTemplateParametersChanged(QString))); this, &PropertiesView::MView::onTemplateParametersChanged);
} }
if (isSingleSelection) { if (isSingleSelection) {
if (!m_templateParametersLineEdit->hasFocus()) { if (!m_templateParametersLineEdit->hasFocus()) {
@@ -507,7 +510,8 @@ void PropertiesView::MView::visitMClass(const MClass *klass)
layout->setStretch(0, 1); layout->setStretch(0, 1);
layout->setStretch(1, 0); layout->setStretch(1, 0);
m_topLayout->addRow(QStringLiteral(""), layout); m_topLayout->addRow(QStringLiteral(""), layout);
connect(m_classMembersParseButton, SIGNAL(clicked()), this, SLOT(onParseClassMembers())); connect(m_classMembersParseButton, &QAbstractButton::clicked,
this, &PropertiesView::MView::onParseClassMembers);
} }
if (m_classMembersParseButton->isEnabled() != isSingleSelection) if (m_classMembersParseButton->isEnabled() != isSingleSelection)
m_classMembersParseButton->setEnabled(isSingleSelection); m_classMembersParseButton->setEnabled(isSingleSelection);
@@ -515,9 +519,10 @@ void PropertiesView::MView::visitMClass(const MClass *klass)
m_classMembersEdit = new ClassMembersEdit(m_topWidget); m_classMembersEdit = new ClassMembersEdit(m_topWidget);
m_classMembersEdit->setLineWrapMode(QPlainTextEdit::NoWrap); m_classMembersEdit->setLineWrapMode(QPlainTextEdit::NoWrap);
m_topLayout->addRow(tr("Members:"), m_classMembersEdit); m_topLayout->addRow(tr("Members:"), m_classMembersEdit);
connect(m_classMembersEdit, SIGNAL(membersChanged(QList<MClassMember>&)), connect(m_classMembersEdit, &ClassMembersEdit::membersChanged,
this, SLOT(onClassMembersChanged(QList<MClassMember>&))); this, &PropertiesView::MView::onClassMembersChanged);
connect(m_classMembersEdit, SIGNAL(statusChanged(bool)), this, SLOT(onClassMembersStatusChanged(bool))); connect(m_classMembersEdit, &ClassMembersEdit::statusChanged,
this, &PropertiesView::MView::onClassMembersStatusChanged);
} }
if (isSingleSelection) { if (isSingleSelection) {
if (klass->members() != m_classMembersEdit->members() && !m_classMembersEdit->hasFocus()) if (klass->members() != m_classMembersEdit->members() && !m_classMembersEdit->hasFocus())
@@ -564,7 +569,8 @@ void PropertiesView::MView::visitMItem(const MItem *item)
if (m_itemVarietyEdit == 0) { if (m_itemVarietyEdit == 0) {
m_itemVarietyEdit = new QLineEdit(m_topWidget); m_itemVarietyEdit = new QLineEdit(m_topWidget);
m_topLayout->addRow(tr("Variety:"), m_itemVarietyEdit); m_topLayout->addRow(tr("Variety:"), m_itemVarietyEdit);
connect(m_itemVarietyEdit, SIGNAL(textChanged(QString)), this, SLOT(onItemVarietyChanged(QString))); connect(m_itemVarietyEdit, &QLineEdit::textChanged,
this, &PropertiesView::MView::onItemVarietyChanged);
} }
if (isSingleSelection) { if (isSingleSelection) {
if (item->variety() != m_itemVarietyEdit->text() && !m_itemVarietyEdit->hasFocus()) if (item->variety() != m_itemVarietyEdit->text() && !m_itemVarietyEdit->hasFocus())
@@ -585,7 +591,8 @@ void PropertiesView::MView::visitMRelation(const MRelation *relation)
if (m_elementNameLineEdit == 0) { if (m_elementNameLineEdit == 0) {
m_elementNameLineEdit = new QLineEdit(m_topWidget); m_elementNameLineEdit = new QLineEdit(m_topWidget);
m_topLayout->addRow(tr("Name:"), m_elementNameLineEdit); m_topLayout->addRow(tr("Name:"), m_elementNameLineEdit);
connect(m_elementNameLineEdit, SIGNAL(textChanged(QString)), this, SLOT(onRelationNameChanged(QString))); connect(m_elementNameLineEdit, &QLineEdit::textChanged,
this, &PropertiesView::MView::onRelationNameChanged);
} }
if (isSingleSelection) { if (isSingleSelection) {
if (relation->name() != m_elementNameLineEdit->text() && !m_elementNameLineEdit->hasFocus()) if (relation->name() != m_elementNameLineEdit->text() && !m_elementNameLineEdit->hasFocus())
@@ -614,7 +621,8 @@ void PropertiesView::MView::visitMDependency(const MDependency *dependency)
m_directionSelector->addItems(QStringList() m_directionSelector->addItems(QStringList()
<< QStringLiteral("->") << QStringLiteral("<-") << QStringLiteral("<->")); << QStringLiteral("->") << QStringLiteral("<-") << QStringLiteral("<->"));
m_topLayout->addRow(tr("Direction:"), m_directionSelector); m_topLayout->addRow(tr("Direction:"), m_directionSelector);
connect(m_directionSelector, SIGNAL(activated(int)), this, SLOT(onDependencyDirectionChanged(int))); connect(m_directionSelector, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated),
this, &PropertiesView::MView::onDependencyDirectionChanged);
} }
if (isSingleSelection) { if (isSingleSelection) {
if ((!isValidDirectionIndex(m_directionSelector->currentIndex()) if ((!isValidDirectionIndex(m_directionSelector->currentIndex())
@@ -653,7 +661,8 @@ void PropertiesView::MView::visitMAssociation(const MAssociation *association)
if (m_endAEndName == 0) { if (m_endAEndName == 0) {
m_endAEndName = new QLineEdit(m_topWidget); m_endAEndName = new QLineEdit(m_topWidget);
m_topLayout->addRow(tr("Role:"), m_endAEndName); m_topLayout->addRow(tr("Role:"), m_endAEndName);
connect(m_endAEndName, SIGNAL(textChanged(QString)), this, SLOT(onAssociationEndANameChanged(QString))); connect(m_endAEndName, &QLineEdit::textChanged,
this, &PropertiesView::MView::onAssociationEndANameChanged);
} }
if (isSingleSelection) { if (isSingleSelection) {
if (association->endA().name() != m_endAEndName->text() && !m_endAEndName->hasFocus()) if (association->endA().name() != m_endAEndName->text() && !m_endAEndName->hasFocus())
@@ -666,8 +675,8 @@ void PropertiesView::MView::visitMAssociation(const MAssociation *association)
if (m_endACardinality == 0) { if (m_endACardinality == 0) {
m_endACardinality = new QLineEdit(m_topWidget); m_endACardinality = new QLineEdit(m_topWidget);
m_topLayout->addRow(tr("Cardinality:"), m_endACardinality); m_topLayout->addRow(tr("Cardinality:"), m_endACardinality);
connect(m_endACardinality, SIGNAL(textChanged(QString)), connect(m_endACardinality, &QLineEdit::textChanged,
this, SLOT(onAssociationEndACardinalityChanged(QString))); this, &PropertiesView::MView::onAssociationEndACardinalityChanged);
} }
if (isSingleSelection) { if (isSingleSelection) {
if (association->endA().cardinality() != m_endACardinality->text() && !m_endACardinality->hasFocus()) if (association->endA().cardinality() != m_endACardinality->text() && !m_endACardinality->hasFocus())
@@ -680,7 +689,8 @@ void PropertiesView::MView::visitMAssociation(const MAssociation *association)
if (m_endANavigable == 0) { if (m_endANavigable == 0) {
m_endANavigable = new QCheckBox(tr("Navigable"), m_topWidget); m_endANavigable = new QCheckBox(tr("Navigable"), m_topWidget);
m_topLayout->addRow(QString(), m_endANavigable); m_topLayout->addRow(QString(), m_endANavigable);
connect(m_endANavigable, SIGNAL(clicked(bool)), this, SLOT(onAssociationEndANavigableChanged(bool))); connect(m_endANavigable, &QAbstractButton::clicked,
this, &PropertiesView::MView::onAssociationEndANavigableChanged);
} }
if (isSingleSelection) { if (isSingleSelection) {
if (association->endA().isNavigable() != m_endANavigable->isChecked()) if (association->endA().isNavigable() != m_endANavigable->isChecked())
@@ -694,7 +704,8 @@ void PropertiesView::MView::visitMAssociation(const MAssociation *association)
m_endAKind = new QComboBox(m_topWidget); m_endAKind = new QComboBox(m_topWidget);
m_endAKind->addItems(QStringList() << tr("Association") << tr("Aggregation") << tr("Composition")); m_endAKind->addItems(QStringList() << tr("Association") << tr("Aggregation") << tr("Composition"));
m_topLayout->addRow(tr("Relationship:"), m_endAKind); m_topLayout->addRow(tr("Relationship:"), m_endAKind);
connect(m_endAKind, SIGNAL(activated(int)), this, SLOT(onAssociationEndAKindChanged(int))); connect(m_endAKind, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated),
this, &PropertiesView::MView::onAssociationEndAKindChanged);
} }
if (isSingleSelection) { if (isSingleSelection) {
if ((!isValidAssociationKindIndex(m_endAKind->currentIndex()) if ((!isValidAssociationKindIndex(m_endAKind->currentIndex())
@@ -715,7 +726,8 @@ void PropertiesView::MView::visitMAssociation(const MAssociation *association)
if (m_endBEndName == 0) { if (m_endBEndName == 0) {
m_endBEndName = new QLineEdit(m_topWidget); m_endBEndName = new QLineEdit(m_topWidget);
m_topLayout->addRow(tr("Role:"), m_endBEndName); m_topLayout->addRow(tr("Role:"), m_endBEndName);
connect(m_endBEndName, SIGNAL(textChanged(QString)), this, SLOT(onAssociationEndBNameChanged(QString))); connect(m_endBEndName, &QLineEdit::textChanged,
this, &PropertiesView::MView::onAssociationEndBNameChanged);
} }
if (isSingleSelection) { if (isSingleSelection) {
if (association->endB().name() != m_endBEndName->text() && !m_endBEndName->hasFocus()) if (association->endB().name() != m_endBEndName->text() && !m_endBEndName->hasFocus())
@@ -728,8 +740,8 @@ void PropertiesView::MView::visitMAssociation(const MAssociation *association)
if (m_endBCardinality == 0) { if (m_endBCardinality == 0) {
m_endBCardinality = new QLineEdit(m_topWidget); m_endBCardinality = new QLineEdit(m_topWidget);
m_topLayout->addRow(tr("Cardinality:"), m_endBCardinality); m_topLayout->addRow(tr("Cardinality:"), m_endBCardinality);
connect(m_endBCardinality, SIGNAL(textChanged(QString)), connect(m_endBCardinality, &QLineEdit::textChanged,
this, SLOT(onAssociationEndBCardinalityChanged(QString))); this, &PropertiesView::MView::onAssociationEndBCardinalityChanged);
} }
if (isSingleSelection) { if (isSingleSelection) {
if (association->endB().cardinality() != m_endBCardinality->text() && !m_endBCardinality->hasFocus()) if (association->endB().cardinality() != m_endBCardinality->text() && !m_endBCardinality->hasFocus())
@@ -742,7 +754,8 @@ void PropertiesView::MView::visitMAssociation(const MAssociation *association)
if (m_endBNavigable == 0) { if (m_endBNavigable == 0) {
m_endBNavigable = new QCheckBox(tr("Navigable"), m_topWidget); m_endBNavigable = new QCheckBox(tr("Navigable"), m_topWidget);
m_topLayout->addRow(QString(), m_endBNavigable); m_topLayout->addRow(QString(), m_endBNavigable);
connect(m_endBNavigable, SIGNAL(clicked(bool)), this, SLOT(onAssociationEndBNavigableChanged(bool))); connect(m_endBNavigable, &QAbstractButton::clicked,
this, &PropertiesView::MView::onAssociationEndBNavigableChanged);
} }
if (isSingleSelection) { if (isSingleSelection) {
if (association->endB().isNavigable() != m_endBNavigable->isChecked()) if (association->endB().isNavigable() != m_endBNavigable->isChecked())
@@ -756,7 +769,8 @@ void PropertiesView::MView::visitMAssociation(const MAssociation *association)
m_endBKind = new QComboBox(m_topWidget); m_endBKind = new QComboBox(m_topWidget);
m_endBKind->addItems(QStringList() << tr("Association") << tr("Aggregation") << tr("Composition")); m_endBKind->addItems(QStringList() << tr("Association") << tr("Aggregation") << tr("Composition"));
m_topLayout->addRow(tr("Relationship:"), m_endBKind); m_topLayout->addRow(tr("Relationship:"), m_endBKind);
connect(m_endBKind, SIGNAL(activated(int)), this, SLOT(onAssociationEndBKindChanged(int))); connect(m_endBKind, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated),
this, &PropertiesView::MView::onAssociationEndBKindChanged);
} }
if (isSingleSelection) { if (isSingleSelection) {
if ((!isValidAssociationKindIndex(m_endAKind->currentIndex()) if ((!isValidAssociationKindIndex(m_endAKind->currentIndex())
@@ -811,7 +825,8 @@ void PropertiesView::MView::visitDObject(const DObject *object)
if (m_autoSizedCheckbox == 0) { if (m_autoSizedCheckbox == 0) {
m_autoSizedCheckbox = new QCheckBox(tr("Auto sized"), m_topWidget); m_autoSizedCheckbox = new QCheckBox(tr("Auto sized"), m_topWidget);
m_topLayout->addRow(QString(), m_autoSizedCheckbox); m_topLayout->addRow(QString(), m_autoSizedCheckbox);
connect(m_autoSizedCheckbox, SIGNAL(clicked(bool)), this, SLOT(onAutoSizedChanged(bool))); connect(m_autoSizedCheckbox, &QAbstractButton::clicked,
this, &PropertiesView::MView::onAutoSizedChanged);
} }
if (!m_autoSizedCheckbox->hasFocus()) { if (!m_autoSizedCheckbox->hasFocus()) {
bool autoSized; bool autoSized;
@@ -828,7 +843,8 @@ void PropertiesView::MView::visitDObject(const DObject *object)
setPrimaryRolePalette(m_styleElementType, DObject::PrimaryRoleCustom4, QColor()); setPrimaryRolePalette(m_styleElementType, DObject::PrimaryRoleCustom4, QColor());
setPrimaryRolePalette(m_styleElementType, DObject::PrimaryRoleCustom5, QColor()); setPrimaryRolePalette(m_styleElementType, DObject::PrimaryRoleCustom5, QColor());
m_topLayout->addRow(tr("Color:"), m_visualPrimaryRoleSelector); m_topLayout->addRow(tr("Color:"), m_visualPrimaryRoleSelector);
connect(m_visualPrimaryRoleSelector, SIGNAL(activated(int)), this, SLOT(onVisualPrimaryRoleChanged(int))); connect(m_visualPrimaryRoleSelector, &PaletteBox::activated,
this, &PropertiesView::MView::onVisualPrimaryRoleChanged);
} }
if (!m_visualPrimaryRoleSelector->hasFocus()) { if (!m_visualPrimaryRoleSelector->hasFocus()) {
StereotypeDisplayVisitor stereotypeDisplayVisitor; StereotypeDisplayVisitor stereotypeDisplayVisitor;
@@ -854,7 +870,8 @@ void PropertiesView::MView::visitDObject(const DObject *object)
<< tr("Lighter") << tr("Darker") << tr("Lighter") << tr("Darker")
<< tr("Soften") << tr("Outline")); << tr("Soften") << tr("Outline"));
m_topLayout->addRow(tr("Role:"), m_visualSecondaryRoleSelector); m_topLayout->addRow(tr("Role:"), m_visualSecondaryRoleSelector);
connect(m_visualSecondaryRoleSelector, SIGNAL(activated(int)), this, SLOT(onVisualSecondaryRoleChanged(int))); connect(m_visualSecondaryRoleSelector, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated),
this, &PropertiesView::MView::onVisualSecondaryRoleChanged);
} }
if (!m_visualSecondaryRoleSelector->hasFocus()) { if (!m_visualSecondaryRoleSelector->hasFocus()) {
DObject::VisualSecondaryRole visualSecondaryRole; DObject::VisualSecondaryRole visualSecondaryRole;
@@ -866,7 +883,8 @@ void PropertiesView::MView::visitDObject(const DObject *object)
if (m_visualEmphasizedCheckbox == 0) { if (m_visualEmphasizedCheckbox == 0) {
m_visualEmphasizedCheckbox = new QCheckBox(tr("Emphasized"), m_topWidget); m_visualEmphasizedCheckbox = new QCheckBox(tr("Emphasized"), m_topWidget);
m_topLayout->addRow(QString(), m_visualEmphasizedCheckbox); m_topLayout->addRow(QString(), m_visualEmphasizedCheckbox);
connect(m_visualEmphasizedCheckbox, SIGNAL(clicked(bool)), this, SLOT(onVisualEmphasizedChanged(bool))); connect(m_visualEmphasizedCheckbox, &QAbstractButton::clicked,
this, &PropertiesView::MView::onVisualEmphasizedChanged);
} }
if (!m_visualEmphasizedCheckbox->hasFocus()) { if (!m_visualEmphasizedCheckbox->hasFocus()) {
bool emphasized; bool emphasized;
@@ -880,7 +898,8 @@ void PropertiesView::MView::visitDObject(const DObject *object)
m_stereotypeDisplaySelector->addItems(QStringList() << tr("Smart") << tr("None") << tr("Label") m_stereotypeDisplaySelector->addItems(QStringList() << tr("Smart") << tr("None") << tr("Label")
<< tr("Decoration") << tr("Icon")); << tr("Decoration") << tr("Icon"));
m_topLayout->addRow(tr("Stereotype display:"), m_stereotypeDisplaySelector); m_topLayout->addRow(tr("Stereotype display:"), m_stereotypeDisplaySelector);
connect(m_stereotypeDisplaySelector, SIGNAL(activated(int)), this, SLOT(onStereotypeDisplayChanged(int))); connect(m_stereotypeDisplaySelector, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated),
this, &PropertiesView::MView::onStereotypeDisplayChanged);
} }
if (!m_stereotypeDisplaySelector->hasFocus()) { if (!m_stereotypeDisplaySelector->hasFocus()) {
DObject::StereotypeDisplay stereotypeDisplay; DObject::StereotypeDisplay stereotypeDisplay;
@@ -916,7 +935,8 @@ void PropertiesView::MView::visitDClass(const DClass *klass)
m_templateDisplaySelector = new QComboBox(m_topWidget); m_templateDisplaySelector = new QComboBox(m_topWidget);
m_templateDisplaySelector->addItems(QStringList() << tr("Smart") << tr("Box") << tr("Angle Brackets")); m_templateDisplaySelector->addItems(QStringList() << tr("Smart") << tr("Box") << tr("Angle Brackets"));
m_topLayout->addRow(tr("Template display:"), m_templateDisplaySelector); m_topLayout->addRow(tr("Template display:"), m_templateDisplaySelector);
connect(m_templateDisplaySelector, SIGNAL(activated(int)), this, SLOT(onTemplateDisplayChanged(int))); connect(m_templateDisplaySelector, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated),
this, &PropertiesView::MView::onTemplateDisplayChanged);
} }
if (!m_templateDisplaySelector->hasFocus()) { if (!m_templateDisplaySelector->hasFocus()) {
DClass::TemplateDisplay templateDisplay; DClass::TemplateDisplay templateDisplay;
@@ -928,7 +948,8 @@ void PropertiesView::MView::visitDClass(const DClass *klass)
if (m_showAllMembersCheckbox == 0) { if (m_showAllMembersCheckbox == 0) {
m_showAllMembersCheckbox = new QCheckBox(tr("Show members"), m_topWidget); m_showAllMembersCheckbox = new QCheckBox(tr("Show members"), m_topWidget);
m_topLayout->addRow(QString(), m_showAllMembersCheckbox); m_topLayout->addRow(QString(), m_showAllMembersCheckbox);
connect(m_showAllMembersCheckbox, SIGNAL(clicked(bool)), this, SLOT(onShowAllMembersChanged(bool))); connect(m_showAllMembersCheckbox, &QAbstractButton::clicked,
this, &PropertiesView::MView::onShowAllMembersChanged);
} }
if (!m_showAllMembersCheckbox->hasFocus()) { if (!m_showAllMembersCheckbox->hasFocus()) {
bool showAllMembers; bool showAllMembers;
@@ -948,7 +969,8 @@ void PropertiesView::MView::visitDComponent(const DComponent *component)
if (m_plainShapeCheckbox == 0) { if (m_plainShapeCheckbox == 0) {
m_plainShapeCheckbox = new QCheckBox(tr("Plain shape"), m_topWidget); m_plainShapeCheckbox = new QCheckBox(tr("Plain shape"), m_topWidget);
m_topLayout->addRow(QString(), m_plainShapeCheckbox); m_topLayout->addRow(QString(), m_plainShapeCheckbox);
connect(m_plainShapeCheckbox, SIGNAL(clicked(bool)), this, SLOT(onPlainShapeChanged(bool))); connect(m_plainShapeCheckbox, &QAbstractButton::clicked,
this, &PropertiesView::MView::onPlainShapeChanged);
} }
if (!m_plainShapeCheckbox->hasFocus()) { if (!m_plainShapeCheckbox->hasFocus()) {
bool plainShape; bool plainShape;
@@ -978,7 +1000,8 @@ void PropertiesView::MView::visitDItem(const DItem *item)
if (m_itemShapeEdit == 0) { if (m_itemShapeEdit == 0) {
m_itemShapeEdit = new QLineEdit(m_topWidget); m_itemShapeEdit = new QLineEdit(m_topWidget);
m_topLayout->addRow(tr("Shape:"), m_itemShapeEdit); m_topLayout->addRow(tr("Shape:"), m_itemShapeEdit);
connect(m_itemShapeEdit, SIGNAL(textChanged(QString)), this, SLOT(onItemShapeChanged(QString))); connect(m_itemShapeEdit, &QLineEdit::textChanged,
this, &PropertiesView::MView::onItemShapeChanged);
} }
if (isSingleSelection) { if (isSingleSelection) {
if (item->shape() != m_itemShapeEdit->text() && !m_itemShapeEdit->hasFocus()) if (item->shape() != m_itemShapeEdit->text() && !m_itemShapeEdit->hasFocus())
@@ -1021,7 +1044,8 @@ void PropertiesView::MView::visitDAnnotation(const DAnnotation *annotation)
if (m_annotationAutoWidthCheckbox == 0) { if (m_annotationAutoWidthCheckbox == 0) {
m_annotationAutoWidthCheckbox = new QCheckBox(tr("Auto width"), m_topWidget); m_annotationAutoWidthCheckbox = new QCheckBox(tr("Auto width"), m_topWidget);
m_topLayout->addRow(QString(), m_annotationAutoWidthCheckbox); m_topLayout->addRow(QString(), m_annotationAutoWidthCheckbox);
connect(m_annotationAutoWidthCheckbox, SIGNAL(clicked(bool)), this, SLOT(onAutoWidthChanged(bool))); connect(m_annotationAutoWidthCheckbox, &QAbstractButton::clicked,
this, &PropertiesView::MView::onAutoWidthChanged);
} }
if (!m_annotationAutoWidthCheckbox->hasFocus()) { if (!m_annotationAutoWidthCheckbox->hasFocus()) {
bool autoSized; bool autoSized;
@@ -1036,7 +1060,8 @@ void PropertiesView::MView::visitDAnnotation(const DAnnotation *annotation)
<< tr("Normal") << tr("Title") << tr("Subtitle") << tr("Normal") << tr("Title") << tr("Subtitle")
<< tr("Emphasized") << tr("Soften") << tr("Footnote")); << tr("Emphasized") << tr("Soften") << tr("Footnote"));
m_topLayout->addRow(tr("Role:"), m_annotationVisualRoleSelector); m_topLayout->addRow(tr("Role:"), m_annotationVisualRoleSelector);
connect(m_annotationVisualRoleSelector, SIGNAL(activated(int)), this, SLOT(onAnnotationVisualRoleChanged(int))); connect(m_annotationVisualRoleSelector, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated),
this, &PropertiesView::MView::onAnnotationVisualRoleChanged);
} }
if (!m_annotationVisualRoleSelector->hasFocus()) { if (!m_annotationVisualRoleSelector->hasFocus()) {
DAnnotation::VisualRole visualRole; DAnnotation::VisualRole visualRole;

View File

@@ -102,7 +102,7 @@ public:
void update(QList<DElement *> &diagramElements, MDiagram *diagram); void update(QList<DElement *> &diagramElements, MDiagram *diagram);
void edit(); void edit();
private slots: private:
void onStereotypesChanged(const QString &stereotypes); void onStereotypesChanged(const QString &stereotypes);
void onObjectNameChanged(const QString &name); void onObjectNameChanged(const QString &name);
void onNamespaceChanged(const QString &umlNamespace); void onNamespaceChanged(const QString &umlNamespace);
@@ -133,7 +133,6 @@ private slots:
void onAutoWidthChanged(bool autoWidthed); void onAutoWidthChanged(bool autoWidthed);
void onAnnotationVisualRoleChanged(int visualRoleIndex); void onAnnotationVisualRoleChanged(int visualRoleIndex);
private:
void prepare(); void prepare();
template<class T, class V> template<class T, class V>
void setTitle(const QList<V *> &elements, const QString &singularTitle, void setTitle(const QList<V *> &elements, const QString &singularTitle,

View File

@@ -69,7 +69,6 @@ public:
Project *project() const { return m_project.data(); } Project *project() const { return m_project.data(); }
bool isModified() const { return m_isModified; } bool isModified() const { return m_isModified; }
public slots:
void newProject(const QString &fileName); void newProject(const QString &fileName);
void setFileName(const QString &fileName); void setFileName(const QString &fileName);
void setModified(); void setModified();

View File

@@ -127,7 +127,6 @@ private:
void evaluate(); void evaluate();
private:
const QString m_source; const QString m_source;
const QString m_pattern; const QString m_pattern;
bool m_isEvaluated; bool m_isEvaluated;