Skip to content

Commit

Permalink
declare getMDIView and getMDIViewPage as const
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Dec 29, 2019
1 parent 6a4dd82 commit e900384
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 20 deletions.
4 changes: 3 additions & 1 deletion src/Gui/ViewProvider.h
Expand Up @@ -470,7 +470,9 @@ class GuiExport ViewProvider : public App::TransactionalObject
static Base::Matrix4D convert(const SbMatrix &sbMat);
//@}

virtual MDIView *getMDIView() {return 0;}
virtual MDIView *getMDIView() const {
return nullptr;
}

public:
// this method is called by the viewer when the ViewProvider is in edit
Expand Down
7 changes: 4 additions & 3 deletions src/Mod/Spreadsheet/Gui/ViewProviderSpreadsheet.cpp
Expand Up @@ -169,10 +169,11 @@ SheetView *ViewProviderSheet::showSpreadsheetView()
}

return view;
}
}

Gui::MDIView *ViewProviderSheet::getMDIView() {
return showSpreadsheetView();
Gui::MDIView *ViewProviderSheet::getMDIView() const
{
return const_cast<ViewProviderSheet*>(this)->showSpreadsheetView();
}

void ViewProviderSheet::updateData(const App::Property* prop)
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Spreadsheet/Gui/ViewProviderSpreadsheet.h
Expand Up @@ -65,7 +65,7 @@ class SpreadsheetGuiExport ViewProviderSheet : public Gui::ViewProviderDocumentO

virtual bool isShow(void) const override { return true; }

virtual Gui::MDIView *getMDIView() override;
virtual Gui::MDIView *getMDIView() const override;

protected:
SheetView* showSpreadsheetView();
Expand Down
3 changes: 2 additions & 1 deletion src/Mod/TechDraw/Gui/ViewProviderDrawingView.cpp
Expand Up @@ -257,7 +257,8 @@ MDIViewPage* ViewProviderDrawingView::getMDIViewPage() const
return result;
}

Gui::MDIView *ViewProviderDrawingView::getMDIView() {
Gui::MDIView *ViewProviderDrawingView::getMDIView() const
{
return getMDIViewPage();
}

Expand Down
2 changes: 1 addition & 1 deletion src/Mod/TechDraw/Gui/ViewProviderDrawingView.h
Expand Up @@ -70,7 +70,7 @@ class TechDrawGuiExport ViewProviderDrawingView : public Gui::ViewProviderDocume

QGIView* getQView(void);
MDIViewPage* getMDIViewPage() const;
virtual Gui::MDIView *getMDIView() override;
virtual Gui::MDIView *getMDIView() const override;

/** @name Restoring view provider from document load */
//@{
Expand Down
3 changes: 2 additions & 1 deletion src/Mod/TechDraw/Gui/ViewProviderGeomHatch.cpp
Expand Up @@ -203,7 +203,8 @@ TechDraw::DrawGeomHatch* ViewProviderGeomHatch::getViewObject() const
return dynamic_cast<TechDraw::DrawGeomHatch*>(pcObject);
}

Gui::MDIView *ViewProviderGeomHatch::getMDIView() {
Gui::MDIView *ViewProviderGeomHatch::getMDIView() const
{
auto obj = getViewObject();
if(!obj) return 0;
auto vp = Gui::Application::Instance->getViewProvider(obj->getSourceView());
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/TechDraw/Gui/ViewProviderGeomHatch.h
Expand Up @@ -68,7 +68,7 @@ class TechDrawGuiExport ViewProviderGeomHatch : public Gui::ViewProviderDocument

TechDraw::DrawGeomHatch* getViewObject() const;

virtual Gui::MDIView *getMDIView() override;
virtual Gui::MDIView *getMDIView() const override;
};

} // namespace TechDrawGui
Expand Down
3 changes: 2 additions & 1 deletion src/Mod/TechDraw/Gui/ViewProviderHatch.cpp
Expand Up @@ -123,7 +123,8 @@ TechDraw::DrawHatch* ViewProviderHatch::getViewObject() const
return dynamic_cast<TechDraw::DrawHatch*>(pcObject);
}

Gui::MDIView *ViewProviderHatch::getMDIView() {
Gui::MDIView *ViewProviderHatch::getMDIView() const
{
auto obj = getViewObject();
if(!obj) return 0;
auto vp = Gui::Application::Instance->getViewProvider(obj->getSourceView());
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/TechDraw/Gui/ViewProviderHatch.h
Expand Up @@ -57,7 +57,7 @@ class TechDrawGuiExport ViewProviderHatch : public Gui::ViewProviderDocumentObje

TechDraw::DrawHatch* getViewObject() const;

virtual Gui::MDIView *getMDIView() override;
virtual Gui::MDIView *getMDIView() const override;

private:
static App::PropertyFloatConstraint::Constraints scaleRange;
Expand Down
7 changes: 4 additions & 3 deletions src/Mod/TechDraw/Gui/ViewProviderPage.cpp
Expand Up @@ -335,7 +335,7 @@ void ViewProviderPage::unsetEdit(int ModNum)
}


MDIViewPage* ViewProviderPage::getMDIViewPage()
MDIViewPage* ViewProviderPage::getMDIViewPage() const
{
if (m_mdiView.isNull()) {
Base::Console().Log("INFO - ViewProviderPage::getMDIViewPage has no m_mdiView!\n");
Expand Down Expand Up @@ -444,7 +444,8 @@ TechDraw::DrawPage* ViewProviderPage::getDrawPage() const
return dynamic_cast<TechDraw::DrawPage*>(pcObject);
}

Gui::MDIView *ViewProviderPage::getMDIView() {
showMDIViewPage();
Gui::MDIView *ViewProviderPage::getMDIView() const
{
const_cast<ViewProviderPage*>(this)->showMDIViewPage();
return m_mdiView.data();
}
4 changes: 2 additions & 2 deletions src/Mod/TechDraw/Gui/ViewProviderPage.h
Expand Up @@ -81,11 +81,11 @@ class TechDrawGuiExport ViewProviderPage : public Gui::ViewProviderDocumentObjec
Connection connectGuiRepaint;

void unsetEdit(int ModNum) override;
MDIViewPage* getMDIViewPage();
MDIViewPage* getMDIViewPage() const;
bool showMDIViewPage();
void removeMDIView(void);

virtual Gui::MDIView *getMDIView() override;
virtual Gui::MDIView *getMDIView() const override;

bool getFrameState(void);
void setFrameState(bool state);
Expand Down
5 changes: 3 additions & 2 deletions src/Mod/TechDraw/Gui/ViewProviderTemplate.cpp
Expand Up @@ -182,7 +182,7 @@ void ViewProviderTemplate::setMarkers(bool state)
}
}

MDIViewPage* ViewProviderTemplate::getMDIViewPage(void)
MDIViewPage* ViewProviderTemplate::getMDIViewPage(void) const
{
MDIViewPage* myMdi = nullptr;
auto t = getTemplate();
Expand All @@ -195,7 +195,8 @@ MDIViewPage* ViewProviderTemplate::getMDIViewPage(void)
return myMdi;
}

Gui::MDIView *ViewProviderTemplate::getMDIView() {
Gui::MDIView *ViewProviderTemplate::getMDIView() const
{
return getMDIViewPage();
}

Expand Down
4 changes: 2 additions & 2 deletions src/Mod/TechDraw/Gui/ViewProviderTemplate.h
Expand Up @@ -56,8 +56,8 @@ class TechDrawGuiExport ViewProviderTemplate : public Gui::ViewProviderDocumentO
virtual bool isShow(void) const override;
QGITemplate* getQTemplate(void);
TechDraw::DrawTemplate* getTemplate() const;
MDIViewPage* getMDIViewPage(void);
virtual Gui::MDIView *getMDIView() override;
MDIViewPage* getMDIViewPage(void) const;
virtual Gui::MDIView *getMDIView() const override;

void setMarkers(bool state);
};
Expand Down

0 comments on commit e900384

Please sign in to comment.