Skip to content

Commit

Permalink
Convert old style of connect with new one. Work on solver from vlm more
Browse files Browse the repository at this point in the history
  • Loading branch information
Arthur Glowacki committed Nov 21, 2024
1 parent d954547 commit da38a6d
Show file tree
Hide file tree
Showing 14 changed files with 102 additions and 179 deletions.
86 changes: 19 additions & 67 deletions src/core/uProbeX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,28 +442,13 @@ void uProbeX::make_VLM_Window(VLM_Model* model)
VLM_Widget* widget = new VLM_Widget();
widget->resize(1027, 768);
widget->setModel(model);

connect(widget,
SIGNAL(solverStart()),
this,
SLOT(solverStart()));

connect(widget,
SIGNAL(solverVariableUpdate(double, double)),
this,
SLOT(solverVariableUpdate(double, double)));

connect(widget,
SIGNAL(cancelSolverVariableUpdate()),
this,
SLOT(cancelSolverVariableUpdate()));


/* TODO: connect properly
connect(widget, &VLM_Widget::solverStart, this, &uProbeX::solverStart);
connect(widget, &VLM_Widget::solverVariableUpdate, this, &uProbeX::solverVariableUpdate);
connect(widget, &VLM_Widget::cancelSolverVariableUpdate, this, &uProbeX::cancelSolverVariableUpdate);
*/
SubWindow* w = new SubWindow(m_mdiArea);
connect(w,
SIGNAL(windowClosing(SubWindow*)),
this,
SLOT(subWindowClosed(SubWindow*)));
connect(w, &SubWindow::windowClosing, this, &uProbeX::subWindowClosed);


m_mdiArea->addSubWindow(w);
Expand All @@ -474,10 +459,7 @@ void uProbeX::make_VLM_Window(VLM_Model* model)

m_subWindows[w->getUuid()] = w;

connect(w,
SIGNAL(windowStateChanged(Qt::WindowStates, Qt::WindowStates )),
widget,
SLOT(windowChanged(Qt::WindowStates, Qt::WindowStates)));
connect(w, &SubWindow::windowStateChanged, widget, &VLM_Widget::windowChanged);
}

//---------------------------------------------------------------------------
Expand Down Expand Up @@ -538,31 +520,16 @@ void uProbeX::make_VLM_Window(QString path, bool newWindow)
return;
}

connect(widget,
SIGNAL(solverStart()),
this,
SLOT(solverStart()));

connect(widget,
SIGNAL(solverVariableUpdate(double, double)),
this,
SLOT(solverVariableUpdate(double, double)));

connect(widget,
SIGNAL(cancelSolverVariableUpdate()),
this,
SLOT(cancelSolverVariableUpdate()));


/*TODO: connect properly
connect(widget, &VLM_Widget::solverStart, this, &uProbeX::solverStart);
connect(widget, &VLM_Widget::solverVariableUpdate, this, &uProbeX::solverVariableUpdate);
connect(widget, &VLM_Widget::cancelSolverVariableUpdate, this, &uProbeX::cancelSolverVariableUpdate);
*/
SubWindow* w = nullptr;
if (newWindow == true)
{
w = new SubWindow(m_mdiArea);
connect(w,
SIGNAL(windowClosing(SubWindow*)),
this,
SLOT(subWindowClosed(SubWindow*)));

connect(w, &SubWindow::windowClosing, this, &uProbeX::subWindowClosed);
}

m_mdiArea->addSubWindow(w);
Expand All @@ -573,10 +540,7 @@ void uProbeX::make_VLM_Window(QString path, bool newWindow)

m_subWindows[w->getUuid()] = w;

connect(w,
SIGNAL(windowStateChanged(Qt::WindowStates, Qt::WindowStates)),
widget,
SLOT(windowChanged(Qt::WindowStates, Qt::WindowStates)));
connect(w, &SubWindow::windowStateChanged, widget, &VLM_Widget::windowChanged);
}
else
{
Expand Down Expand Up @@ -712,10 +676,7 @@ void uProbeX::make_HDF_Window(MapsH5Model* model)

SubWindow* w = nullptr;
w = new SubWindow(m_mdiArea);
connect(w,
SIGNAL(windowClosing(SubWindow*)),
this,
SLOT(subWindowClosed(SubWindow*)));
connect(w, &SubWindow::windowClosing, this, &uProbeX::subWindowClosed);


m_mdiArea->addSubWindow(w);
Expand All @@ -727,10 +688,7 @@ void uProbeX::make_HDF_Window(MapsH5Model* model)

m_subWindows[w->getUuid()] = w;

connect(w,
SIGNAL(windowStateChanged(Qt::WindowStates, Qt::WindowStates )),
widget,
SLOT(windowChanged(Qt::WindowStates, Qt::WindowStates)));
connect(w, &SubWindow::windowStateChanged, widget, &MapsElementsWidget::windowChanged);


}
Expand All @@ -744,10 +702,7 @@ void uProbeX::make_MDA_Window(RAW_Model* model)

SubWindow* w = nullptr;
w = new SubWindow(m_mdiArea);
connect(w,
SIGNAL(windowClosing(SubWindow*)),
this,
SLOT(subWindowClosed(SubWindow*)));
connect(w, &SubWindow::windowClosing, this, &uProbeX::subWindowClosed);


m_mdiArea->addSubWindow(w);
Expand All @@ -759,10 +714,7 @@ void uProbeX::make_MDA_Window(RAW_Model* model)

m_subWindows[w->getUuid()] = w;

connect(w,
SIGNAL(windowStateChanged(Qt::WindowStates, Qt::WindowStates )),
widget,
SLOT(windowChanged(Qt::WindowStates, Qt::WindowStates)));
//connect(w, &SubWindow::windowStateChanged, widget, &MDA_Widget::windowChanged);
}

//---------------------------------------------------------------------------
Expand Down Expand Up @@ -876,7 +828,7 @@ void uProbeX::openMapsWorkspace(QString dirName)
updateRecentMapsWorkspaces();

MapsWorkspaceController* mapsWorkspaceController = new MapsWorkspaceController(this);
connect(mapsWorkspaceController, SIGNAL(controllerClosed(MapsWorkspaceController*)), this, SLOT(mapsControllerClosed(MapsWorkspaceController*)));
connect(mapsWorkspaceController, &MapsWorkspaceController::controllerClosed, this, &uProbeX::mapsControllerClosed);
_mapsWorkspaceControllers.append(mapsWorkspaceController);

mapsWorkspaceController->setWorkingDir(dirName);
Expand Down
67 changes: 16 additions & 51 deletions src/gstar/AbstractImageWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,10 @@ AbstractImageWidget::AbstractImageWidget(int rows, int cols, QWidget* parent)

createActions();


//Setup a QTreeView and AnnotationTreeModel for Annotations

m_treeModel = new AnnotationTreeModel();
connect(m_treeModel,
SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)),
this,
SLOT(modelDataChanged(const QModelIndex &, const QModelIndex &)));
connect(m_treeModel, &AnnotationTreeModel::dataChanged, this, &AbstractImageWidget::modelDataChanged);

m_selectionModel = new QItemSelectionModel(m_treeModel);

Expand All @@ -66,23 +62,14 @@ AbstractImageWidget::AbstractImageWidget(int rows, int cols, QWidget* parent)
m_annoTreeView->setHeaderHidden(true);
m_annoTreeView->setSelectionModel(m_selectionModel);
m_annoTreeView->setContextMenuPolicy(Qt::CustomContextMenu);
connect(m_annoTreeView,
SIGNAL(customContextMenuRequested(const QPoint &)),
this,
SLOT(treeContextMenu(const QPoint &)));
connect(m_annoTreeView,
SIGNAL(doubleClicked(const QModelIndex &)),
this,
SLOT(treeDoubleClicked(const QModelIndex &)));
connect(m_annoTreeView, &QTreeView::customContextMenuRequested, this, &AbstractImageWidget::treeContextMenu);
connect(m_annoTreeView, &QTreeView::doubleClicked, this, &AbstractImageWidget::treeDoubleClicked);

m_imageViewWidget = new ImageViewWidget(rows, cols);
m_imageViewWidget->setSceneModel(m_treeModel);
m_imageViewWidget->setSceneSelectionModel(m_selectionModel);
m_imageViewWidget->setContextMenuPolicy(Qt::CustomContextMenu);
connect(m_imageViewWidget,
SIGNAL(customContextMenuRequested(const QPoint &)),
this,
SLOT(viewContextMenu(const QPoint &)));
connect(m_imageViewWidget, &ImageViewWidget::customContextMenuRequested, this, &AbstractImageWidget::viewContextMenu);

createAnnotationToolBar();

Expand Down Expand Up @@ -177,27 +164,12 @@ void AbstractImageWidget::createActions()
m_deleteAction = new QAction("Delete", this);
m_showRulerDialogAction = new QAction("Ruler Units", this);

connect(m_addRulerAction,
SIGNAL(triggered()),
this,
SLOT(addRuler()));
connect(m_addMarkerAction,
SIGNAL(triggered()),
this,
SLOT(addMarker()));
connect(m_addRulerAction, &QAction::triggered, this, &AbstractImageWidget::addRuler);
connect(m_addMarkerAction, &QAction::triggered, this, &AbstractImageWidget::addMarker);

connect(m_duplicateAction,
SIGNAL(triggered()),
this,
SLOT(duplicateItem()));
connect(m_deleteAction,
SIGNAL(triggered()),
this,
SLOT(deleteItem()));
connect(m_showRulerDialogAction,
SIGNAL(triggered()),
this,
SLOT(showRulerUnitsDialog()));
connect(m_duplicateAction, &QAction::triggered, this, &AbstractImageWidget::duplicateItem);
connect(m_deleteAction, &QAction::triggered, this, &AbstractImageWidget::deleteItem);
connect(m_showRulerDialogAction, &QAction::triggered, this, &AbstractImageWidget::showRulerUnitsDialog);

}

Expand Down Expand Up @@ -235,19 +207,10 @@ void AbstractImageWidget::createAnnotationToolBar()

m_annotationToolbar = new AnnotationToolBarWidget();

connect(m_annotationToolbar,
SIGNAL(clickRuler()),
this,
SLOT(addRuler()));
connect(m_annotationToolbar,
SIGNAL(clickMarker()),
this,
SLOT(addMarker()));
connect(m_annotationToolbar, &AnnotationToolBarWidget::clickRuler, this, &AbstractImageWidget::addRuler);
connect(m_annotationToolbar, &AnnotationToolBarWidget::clickMarker, this, &AbstractImageWidget::addMarker);

connect(m_annotationToolbar,
SIGNAL(enabledStateChanged(bool)),
this,
SLOT(setAnnotationsEnabled(bool)));
connect(m_annotationToolbar, &AnnotationToolBarWidget::enabledStateChanged, this, &AbstractImageWidget::setAnnotationsEnabled);

}

Expand Down Expand Up @@ -574,9 +537,11 @@ void AbstractImageWidget::setHeightDims(int h)
{
if (h > (m_imageHeightDim->count() - 1)) return;

disconnect(m_imageHeightDim,SIGNAL(activated(int)),this,SLOT(imageHeightDimChanged(int)));
disconnect(m_imageHeightDim, &QComboBox::activated, this, &AbstractImageWidget::imageHeightDimChanged);

m_imageHeightDim->setCurrentIndex(h);
connect(m_imageHeightDim,SIGNAL(activated(int)),this,SIGNAL(imageHeightDimChanged(int)));

connect(m_imageHeightDim, &QComboBox::activated, this, &AbstractImageWidget::imageHeightDimChanged);
}
}

Expand Down
5 changes: 1 addition & 4 deletions src/gstar/AnnotationToolBarWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,7 @@ AnnotationToolBarWidget::AnnotationToolBarWidget(QWidget* parent) :
QLabel* enableLable = new QLabel("Visible:");
m_chkSetVisible = new QCheckBox();
m_chkSetVisible->setChecked(true);
connect(m_chkSetVisible,
SIGNAL(stateChanged(int)),
this,
SLOT(setActionsEnabled(int)));
connect(m_chkSetVisible, &QCheckBox::stateChanged, this, &AnnotationToolBarWidget::setActionsEnabled);

m_toolbar->addWidget(enableLable);
m_toolbar->addWidget(m_chkSetVisible);
Expand Down
5 changes: 1 addition & 4 deletions src/gstar/AnnotationTreeModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,7 @@ QModelIndex AnnotationTreeModel::appendNode(AbstractGraphicsItem* item)

beginInsertRows(gIndex, row, row);

connect(item,
SIGNAL(viewUpdated(AbstractGraphicsItem*)),
this,
SLOT(refreshModel(AbstractGraphicsItem*)));
connect(item, &AbstractGraphicsItem::viewUpdated, this, &AnnotationTreeModel::refreshModel);

groupRoot->appendChild(item);

Expand Down
3 changes: 1 addition & 2 deletions src/gstar/ImageViewScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ ImageViewScene::ImageViewScene(QWidget* parent) : QGraphicsScene(parent)
setSceneRect(m_pixItem -> boundingRect());

// Connect selectionChanged signal to annotation slot
connect(this, SIGNAL(selectionChanged()),
this, SLOT(sceneSelectionChanged()));
connect(this, &ImageViewScene::selectionChanged, this, &ImageViewScene::sceneSelectionChanged);

}

Expand Down
Loading

0 comments on commit da38a6d

Please sign in to comment.