diff --git a/GUI/View/Instrument/InstrumentListing.cpp b/GUI/View/Instrument/InstrumentListing.cpp index 031792d7af2184218ca62753edf16c37657ab920..6dbcd49679b3a6ee4aa2e91ee34ab1fa39da5767 100644 --- a/GUI/View/Instrument/InstrumentListing.cpp +++ b/GUI/View/Instrument/InstrumentListing.cpp @@ -21,9 +21,8 @@ #include <QMessageBox> #include <QVBoxLayout> -InstrumentListing::InstrumentListing(ProjectDocument* document) - : m_document(document) - , m_model(new InstrumentListModel(this, m_document->multiNotifier())) +InstrumentListing::InstrumentListing() + : m_model(new InstrumentListModel(this, gDoc->multiNotifier())) , m_separatorAction1(new QAction(this)) , m_separatorAction2(new QAction(this)) { @@ -141,7 +140,7 @@ void InstrumentListing::onItemSelectionChanged() QModelIndexList indexes = selectionModel()->selectedIndexes(); if (!indexes.empty()) { QModelIndex current = indexes.front(); - m_document->instrumentModel()->setSelectedIndex(current.row()); + gDoc->instrumentModel()->setSelectedIndex(current.row()); emit instrumentSelected(m_model->instrumentItemForIndex(current)); } else emit instrumentSelected(nullptr); @@ -240,7 +239,7 @@ void InstrumentListing::ensureItemSelected() void InstrumentListing::restoreSelection() { - int lastUsed = m_document->instrumentModel()->selectedIndex(); + int lastUsed = gDoc->instrumentModel()->selectedIndex(); if (lastUsed >= 0 && lastUsed < m_model->rowCount()) { QModelIndex lastUsedIndex = m_model->index(lastUsed, 0, QModelIndex()); selectionModel()->select(lastUsedIndex, QItemSelectionModel::ClearAndSelect); diff --git a/GUI/View/Instrument/InstrumentListing.h b/GUI/View/Instrument/InstrumentListing.h index 8e9af7cd2c55848c7a94a90396b49f88fb6b81be..59a74d0442e81354d67708ca1fe48278e26f7972 100644 --- a/GUI/View/Instrument/InstrumentListing.h +++ b/GUI/View/Instrument/InstrumentListing.h @@ -20,14 +20,13 @@ class InstrumentItem; class InstrumentListModel; -class ProjectDocument; //! Instrument selector on the left side of InstrumentView. class InstrumentListing : public QListView { Q_OBJECT public: - InstrumentListing(ProjectDocument* document); + InstrumentListing(); ~InstrumentListing(); QSize sizeHint() const override; @@ -60,7 +59,6 @@ private: private: InstrumentLibrary m_instrumentLibrary; - ProjectDocument* m_document; InstrumentListModel* m_model; QAction* m_newGisasAction; QAction* m_newOffspecAction; diff --git a/GUI/View/Instrument/InstrumentView.cpp b/GUI/View/Instrument/InstrumentView.cpp index 15e9998fcfa81dab4795bb37d29b814c6cc3ca35..b1de60967de0e91b3ebaa10a138b6f15289aa262 100644 --- a/GUI/View/Instrument/InstrumentView.cpp +++ b/GUI/View/Instrument/InstrumentView.cpp @@ -14,6 +14,7 @@ #include "GUI/View/Instrument/InstrumentView.h" #include "GUI/Model/Device/InstrumentItems.h" +#include "GUI/Model/Project/ProjectDocument.h" #include "GUI/View/Instrument/DepthprobeInstrumentEditor.h" #include "GUI/View/Instrument/GISASInstrumentEditor.h" #include "GUI/View/Instrument/InstrumentListing.h" @@ -27,7 +28,7 @@ #include <QTextEdit> InstrumentView::InstrumentView() - : m_listing(new InstrumentListing(gDoc.get())) + : m_listing(new InstrumentListing) , m_scrollArea(new QScrollArea) { auto* layout = new QVBoxLayout(this); diff --git a/GUI/View/Instrument/InstrumentView.h b/GUI/View/Instrument/InstrumentView.h index 58c1be3c9645fbc85467b744e201477fc5a3dea7..aac435d6cb0fa908aa1bf5cc239821da85f314bd 100644 --- a/GUI/View/Instrument/InstrumentView.h +++ b/GUI/View/Instrument/InstrumentView.h @@ -15,14 +15,12 @@ #ifndef BORNAGAIN_GUI_VIEW_INSTRUMENT_INSTRUMENTVIEW_H #define BORNAGAIN_GUI_VIEW_INSTRUMENT_INSTRUMENTVIEW_H -#include "GUI/Model/Project/ProjectDocument.h" // ProjectDocument::Functionalities #include <QCheckBox> #include <QScrollArea> #include <QWidget> class InstrumentItem; class InstrumentListing; -class ProjectDocument; class InstrumentView : public QWidget { Q_OBJECT