Gui: Use auto and range-based for (#7481)
* On lines where the variable type is obvious from inspection, avoid repeating the type using auto. * When possible use a ranged for loop instead of begin() and end() iterators
This commit is contained in:
@@ -106,7 +106,7 @@ StdOrthographicCamera::StdOrthographicCamera()
|
||||
void StdOrthographicCamera::activated(int iMsg)
|
||||
{
|
||||
if (iMsg == 1) {
|
||||
View3DInventor* view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
auto view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
SoCamera* cam = view->getViewer()->getSoRenderManager()->getCamera();
|
||||
if (!cam || cam->getTypeId() != SoOrthographicCamera::getClassTypeId())
|
||||
|
||||
@@ -116,7 +116,7 @@ void StdOrthographicCamera::activated(int iMsg)
|
||||
|
||||
bool StdOrthographicCamera::isActive()
|
||||
{
|
||||
View3DInventor* view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
auto view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
if (view) {
|
||||
// update the action group if needed
|
||||
bool check = _pcAction->isChecked();
|
||||
@@ -156,7 +156,7 @@ StdPerspectiveCamera::StdPerspectiveCamera()
|
||||
void StdPerspectiveCamera::activated(int iMsg)
|
||||
{
|
||||
if (iMsg == 1) {
|
||||
View3DInventor* view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
auto view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
SoCamera* cam = view->getViewer()->getSoRenderManager()->getCamera();
|
||||
if (!cam || cam->getTypeId() != SoPerspectiveCamera::getClassTypeId())
|
||||
|
||||
@@ -166,7 +166,7 @@ void StdPerspectiveCamera::activated(int iMsg)
|
||||
|
||||
bool StdPerspectiveCamera::isActive()
|
||||
{
|
||||
View3DInventor* view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
auto view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
if (view) {
|
||||
// update the action group if needed
|
||||
bool check = _pcAction->isChecked();
|
||||
@@ -215,7 +215,7 @@ void StdCmdViewSaveCamera::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
|
||||
Gui::View3DInventor* view = qobject_cast<Gui::View3DInventor*>(Gui::getMainWindow()->activeWindow());
|
||||
auto view = qobject_cast<Gui::View3DInventor*>(Gui::getMainWindow()->activeWindow());
|
||||
if (view) {
|
||||
view->getViewer()->saveHomePosition();
|
||||
}
|
||||
@@ -241,7 +241,7 @@ void StdCmdViewRestoreCamera::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
|
||||
Gui::View3DInventor* view = qobject_cast<Gui::View3DInventor*>(Gui::getMainWindow()->activeWindow());
|
||||
auto view = qobject_cast<Gui::View3DInventor*>(Gui::getMainWindow()->activeWindow());
|
||||
if (view) {
|
||||
view->getViewer()->resetToHomePosition();
|
||||
}
|
||||
@@ -299,7 +299,7 @@ StdCmdFreezeViews::StdCmdFreezeViews()
|
||||
|
||||
Action * StdCmdFreezeViews::createAction()
|
||||
{
|
||||
ActionGroup* pcAction = new ActionGroup(this, getMainWindow());
|
||||
auto pcAction = new ActionGroup(this, getMainWindow());
|
||||
pcAction->setDropDownMenu(true);
|
||||
applyCommandData(this->className(), pcAction);
|
||||
|
||||
@@ -327,7 +327,7 @@ Action * StdCmdFreezeViews::createAction()
|
||||
|
||||
void StdCmdFreezeViews::activated(int iMsg)
|
||||
{
|
||||
ActionGroup* pcAction = qobject_cast<ActionGroup*>(_pcAction);
|
||||
auto pcAction = qobject_cast<ActionGroup*>(_pcAction);
|
||||
|
||||
if (iMsg == 0) {
|
||||
onSaveViews();
|
||||
@@ -382,7 +382,7 @@ void StdCmdFreezeViews::onSaveViews()
|
||||
if (file.open(QFile::WriteOnly))
|
||||
{
|
||||
QTextStream str(&file);
|
||||
ActionGroup* pcAction = qobject_cast<ActionGroup*>(_pcAction);
|
||||
auto pcAction = qobject_cast<ActionGroup*>(_pcAction);
|
||||
QList<QAction*> acts = pcAction->actions();
|
||||
str << "<?xml version='1.0' encoding='utf-8'?>\n"
|
||||
<< "<FrozenViews SchemaVersion=\"1\">\n";
|
||||
@@ -474,7 +474,7 @@ void StdCmdFreezeViews::onRestoreViews()
|
||||
// use this rather than the attribute 'Count' because it could be
|
||||
// changed from outside
|
||||
int ct = cameras.count();
|
||||
ActionGroup* pcAction = qobject_cast<ActionGroup*>(_pcAction);
|
||||
auto pcAction = qobject_cast<ActionGroup*>(_pcAction);
|
||||
QList<QAction*> acts = pcAction->actions();
|
||||
|
||||
int numRestoredViews = std::min<int>(ct, acts.size()-offset);
|
||||
@@ -501,7 +501,7 @@ void StdCmdFreezeViews::onRestoreViews()
|
||||
|
||||
bool StdCmdFreezeViews::isActive()
|
||||
{
|
||||
View3DInventor* view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
auto view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
if (view) {
|
||||
saveView->setEnabled(savedViews > 0);
|
||||
freezeView->setEnabled(savedViews < maxViews);
|
||||
@@ -522,7 +522,7 @@ void StdCmdFreezeViews::languageChange()
|
||||
|
||||
if (!_pcAction)
|
||||
return;
|
||||
ActionGroup* pcAction = qobject_cast<ActionGroup*>(_pcAction);
|
||||
auto pcAction = qobject_cast<ActionGroup*>(_pcAction);
|
||||
QList<QAction*> acts = pcAction->actions();
|
||||
acts[0]->setText(QObject::tr("Save views..."));
|
||||
acts[1]->setText(QObject::tr("Load views..."));
|
||||
@@ -558,7 +558,7 @@ StdCmdToggleClipPlane::StdCmdToggleClipPlane()
|
||||
|
||||
Action * StdCmdToggleClipPlane::createAction()
|
||||
{
|
||||
Action *pcAction = (Action*)Command::createAction();
|
||||
auto pcAction = (Action*)Command::createAction();
|
||||
return pcAction;
|
||||
}
|
||||
|
||||
@@ -567,7 +567,7 @@ void StdCmdToggleClipPlane::activated(int iMsg)
|
||||
Q_UNUSED(iMsg);
|
||||
static QPointer<Gui::Dialog::Clipping> clipping = nullptr;
|
||||
if (!clipping) {
|
||||
View3DInventor* view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
auto view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
if (view) {
|
||||
clipping = Gui::Dialog::Clipping::makeDockWidget(view);
|
||||
}
|
||||
@@ -576,7 +576,7 @@ void StdCmdToggleClipPlane::activated(int iMsg)
|
||||
|
||||
bool StdCmdToggleClipPlane::isActive()
|
||||
{
|
||||
View3DInventor* view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
auto view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
return view ? true : false;
|
||||
}
|
||||
|
||||
@@ -613,7 +613,7 @@ StdCmdDrawStyle::StdCmdDrawStyle()
|
||||
|
||||
Gui::Action * StdCmdDrawStyle::createAction()
|
||||
{
|
||||
Gui::ActionGroup* pcAction = new Gui::ActionGroup(this, Gui::getMainWindow());
|
||||
auto pcAction = new Gui::ActionGroup(this, Gui::getMainWindow());
|
||||
pcAction->setDropDownMenu(true);
|
||||
pcAction->setIsMode(true);
|
||||
applyCommandData(this->className(), pcAction);
|
||||
@@ -675,7 +675,7 @@ void StdCmdDrawStyle::languageChange()
|
||||
|
||||
if (!_pcAction)
|
||||
return;
|
||||
Gui::ActionGroup* pcAction = qobject_cast<Gui::ActionGroup*>(_pcAction);
|
||||
auto pcAction = qobject_cast<Gui::ActionGroup*>(_pcAction);
|
||||
QList<QAction*> a = pcAction->actions();
|
||||
|
||||
a[0]->setText(QCoreApplication::translate(
|
||||
@@ -716,14 +716,14 @@ void StdCmdDrawStyle::languageChange()
|
||||
|
||||
void StdCmdDrawStyle::updateIcon(const MDIView *view)
|
||||
{
|
||||
const Gui::View3DInventor *view3d = dynamic_cast<const Gui::View3DInventor *>(view);
|
||||
const auto view3d = dynamic_cast<const Gui::View3DInventor *>(view);
|
||||
if (!view3d)
|
||||
return;
|
||||
Gui::View3DInventorViewer *viewer = view3d->getViewer();
|
||||
if (!viewer)
|
||||
return;
|
||||
std::string mode(viewer->getOverrideMode());
|
||||
Gui::ActionGroup *actionGroup = dynamic_cast<Gui::ActionGroup *>(_pcAction);
|
||||
auto actionGroup = dynamic_cast<Gui::ActionGroup *>(_pcAction);
|
||||
if (!actionGroup)
|
||||
return;
|
||||
|
||||
@@ -768,7 +768,7 @@ void StdCmdDrawStyle::activated(int iMsg)
|
||||
bool oneChangedSignal(false);
|
||||
for (viewIt = views.begin(); viewIt != views.end(); ++viewIt)
|
||||
{
|
||||
View3DInventor* view = qobject_cast<View3DInventor*>(*viewIt);
|
||||
auto view = qobject_cast<View3DInventor*>(*viewIt);
|
||||
if (view)
|
||||
{
|
||||
View3DInventorViewer* viewer;
|
||||
@@ -862,21 +862,20 @@ void StdCmdToggleSelectability::activated(int iMsg)
|
||||
Q_UNUSED(iMsg);
|
||||
// go through all documents
|
||||
const std::vector<App::Document*> docs = App::GetApplication().getDocuments();
|
||||
for (std::vector<App::Document*>::const_iterator it = docs.begin(); it != docs.end(); ++it) {
|
||||
Document *pcDoc = Application::Instance->getDocument(*it);
|
||||
for (const auto & doc : docs) {
|
||||
Document *pcDoc = Application::Instance->getDocument(doc);
|
||||
std::vector<App::DocumentObject*> sel = Selection().getObjectsOfType
|
||||
(App::DocumentObject::getClassTypeId(), (*it)->getName());
|
||||
(App::DocumentObject::getClassTypeId(), doc->getName());
|
||||
|
||||
|
||||
for (std::vector<App::DocumentObject*>::const_iterator ft=sel.begin();ft!=sel.end();++ft) {
|
||||
ViewProvider *pr = pcDoc->getViewProviderByName((*ft)->getNameInDocument());
|
||||
for (const auto & ft : sel) {
|
||||
ViewProvider *pr = pcDoc->getViewProviderByName(ft->getNameInDocument());
|
||||
if (pr && pr->isDerivedFrom(ViewProviderGeometryObject::getClassTypeId())){
|
||||
if (static_cast<ViewProviderGeometryObject*>(pr)->Selectable.getValue())
|
||||
doCommand(Gui,"Gui.getDocument(\"%s\").getObject(\"%s\").Selectable=False"
|
||||
, (*it)->getName(), (*ft)->getNameInDocument());
|
||||
, doc->getName(), ft->getNameInDocument());
|
||||
else
|
||||
doCommand(Gui,"Gui.getDocument(\"%s\").getObject(\"%s\").Selectable=True"
|
||||
, (*it)->getName(), (*ft)->getNameInDocument());
|
||||
, doc->getName(), ft->getNameInDocument());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -971,9 +970,9 @@ void StdCmdSelectVisibleObjects::activated(int iMsg)
|
||||
|
||||
std::vector<App::DocumentObject*> visible;
|
||||
visible.reserve(obj.size());
|
||||
for (std::vector<App::DocumentObject*>::const_iterator it=obj.begin();it!=obj.end();++it) {
|
||||
if (doc->isShow((*it)->getNameInDocument()))
|
||||
visible.push_back(*it);
|
||||
for (const auto & it : obj) {
|
||||
if (doc->isShow(it->getNameInDocument()))
|
||||
visible.push_back(it);
|
||||
}
|
||||
|
||||
SelectionSingleton& rSel = Selection();
|
||||
@@ -1011,13 +1010,13 @@ void StdCmdToggleObjects::activated(int iMsg)
|
||||
const std::vector<App::DocumentObject*> obj = app->getObjectsOfType
|
||||
(App::DocumentObject::getClassTypeId());
|
||||
|
||||
for (std::vector<App::DocumentObject*>::const_iterator it=obj.begin();it!=obj.end();++it) {
|
||||
if (doc->isShow((*it)->getNameInDocument()))
|
||||
for (const auto & it : obj) {
|
||||
if (doc->isShow(it->getNameInDocument()))
|
||||
doCommand(Gui,"Gui.getDocument(\"%s\").getObject(\"%s\").Visibility=False"
|
||||
, app->getName(), (*it)->getNameInDocument());
|
||||
, app->getName(), it->getNameInDocument());
|
||||
else
|
||||
doCommand(Gui,"Gui.getDocument(\"%s\").getObject(\"%s\").Visibility=True"
|
||||
, app->getName(), (*it)->getNameInDocument());
|
||||
, app->getName(), it->getNameInDocument());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1052,9 +1051,9 @@ void StdCmdShowObjects::activated(int iMsg)
|
||||
const std::vector<App::DocumentObject*> obj = app->getObjectsOfType
|
||||
(App::DocumentObject::getClassTypeId());
|
||||
|
||||
for (std::vector<App::DocumentObject*>::const_iterator it=obj.begin();it!=obj.end();++it) {
|
||||
for (const auto & it : obj) {
|
||||
doCommand(Gui,"Gui.getDocument(\"%s\").getObject(\"%s\").Visibility=True"
|
||||
, app->getName(), (*it)->getNameInDocument());
|
||||
, app->getName(), it->getNameInDocument());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1089,9 +1088,9 @@ void StdCmdHideObjects::activated(int iMsg)
|
||||
const std::vector<App::DocumentObject*> obj = app->getObjectsOfType
|
||||
(App::DocumentObject::getClassTypeId());
|
||||
|
||||
for (std::vector<App::DocumentObject*>::const_iterator it=obj.begin();it!=obj.end();++it) {
|
||||
for (const auto & it : obj) {
|
||||
doCommand(Gui,"Gui.getDocument(\"%s\").getObject(\"%s\").Visibility=False"
|
||||
, app->getName(), (*it)->getNameInDocument());
|
||||
, app->getName(), it->getNameInDocument());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1625,7 +1624,7 @@ StdViewDockUndockFullscreen::StdViewDockUndockFullscreen()
|
||||
|
||||
Action * StdViewDockUndockFullscreen::createAction()
|
||||
{
|
||||
ActionGroup* pcAction = new ActionGroup(this, getMainWindow());
|
||||
auto pcAction = new ActionGroup(this, getMainWindow());
|
||||
pcAction->setDropDownMenu(true);
|
||||
pcAction->setText(QCoreApplication::translate(
|
||||
this->className(), getMenuText()));
|
||||
@@ -1698,7 +1697,7 @@ bool StdViewDockUndockFullscreen::isActive()
|
||||
MDIView* view = getMainWindow()->activeWindow();
|
||||
if (qobject_cast<View3DInventor*>(view)) {
|
||||
// update the action group if needed
|
||||
ActionGroup* pActGrp = qobject_cast<ActionGroup*>(_pcAction);
|
||||
auto pActGrp = qobject_cast<ActionGroup*>(_pcAction);
|
||||
if (pActGrp) {
|
||||
int index = pActGrp->checkedAction();
|
||||
int mode = (int)(view->currentViewMode());
|
||||
@@ -1764,7 +1763,7 @@ StdViewScreenShot::StdViewScreenShot()
|
||||
void StdViewScreenShot::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
View3DInventor* view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
auto view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
if (view) {
|
||||
QStringList formats;
|
||||
SbViewportRegion vp(view->getViewer()->getSoRenderManager()->getViewportRegion());
|
||||
@@ -1800,7 +1799,7 @@ void StdViewScreenShot::activated(int iMsg)
|
||||
fd.selectNameFilter(selFilter);
|
||||
|
||||
// create the image options widget
|
||||
DlgSettingsImageImp* opt = new DlgSettingsImageImp(&fd);
|
||||
auto opt = new DlgSettingsImageImp(&fd);
|
||||
SbVec2s sz = vp.getWindowSize();
|
||||
opt->setImageSize((int)sz[0], (int)sz[1]);
|
||||
opt->setBackgroundType(backtype);
|
||||
@@ -2014,7 +2013,7 @@ StdCmdAxisCross::StdCmdAxisCross()
|
||||
void StdCmdAxisCross::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
Gui::View3DInventor* view = qobject_cast<View3DInventor*>(Gui::getMainWindow()->activeWindow());
|
||||
auto view = qobject_cast<View3DInventor*>(Gui::getMainWindow()->activeWindow());
|
||||
if (view) {
|
||||
if (!view->getViewer()->hasAxisCross())
|
||||
doCommand(Command::Gui,"Gui.ActiveDocument.ActiveView.setAxisCross(True)");
|
||||
@@ -2025,7 +2024,7 @@ void StdCmdAxisCross::activated(int iMsg)
|
||||
|
||||
bool StdCmdAxisCross::isActive()
|
||||
{
|
||||
Gui::View3DInventor* view = qobject_cast<View3DInventor*>(Gui::getMainWindow()->activeWindow());
|
||||
auto view = qobject_cast<View3DInventor*>(Gui::getMainWindow()->activeWindow());
|
||||
if (view && view->getViewer()->hasAxisCross()) {
|
||||
if (!_pcAction->isChecked())
|
||||
_pcAction->setChecked(true);
|
||||
@@ -2338,7 +2337,7 @@ StdViewZoomIn::StdViewZoomIn()
|
||||
void StdViewZoomIn::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
View3DInventor* view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
auto view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
if ( view ) {
|
||||
View3DInventorViewer* viewer = view->getViewer();
|
||||
viewer->navigationStyle()->zoomIn();
|
||||
@@ -2371,7 +2370,7 @@ StdViewZoomOut::StdViewZoomOut()
|
||||
void StdViewZoomOut::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
View3DInventor* view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
auto view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
if (view) {
|
||||
View3DInventorViewer* viewer = view->getViewer();
|
||||
viewer->navigationStyle()->zoomOut();
|
||||
@@ -2431,15 +2430,15 @@ public:
|
||||
// Also supports aborting the selection mode by pressing (releasing) the Escape key.
|
||||
static void selectionCallback(void * ud, SoEventCallback * n)
|
||||
{
|
||||
SelectionCallbackHandler* selectionHandler = static_cast<SelectionCallbackHandler*>(ud);
|
||||
Gui::View3DInventorViewer* view = static_cast<Gui::View3DInventorViewer*>(n->getUserData());
|
||||
auto selectionHandler = static_cast<SelectionCallbackHandler*>(ud);
|
||||
auto view = static_cast<Gui::View3DInventorViewer*>(n->getUserData());
|
||||
const SoEvent* ev = n->getEvent();
|
||||
if (ev->isOfType(SoKeyboardEvent::getClassTypeId())) {
|
||||
|
||||
n->setHandled();
|
||||
n->getAction()->setHandled();
|
||||
|
||||
const SoKeyboardEvent * ke = static_cast<const SoKeyboardEvent*>(ev);
|
||||
const auto ke = static_cast<const SoKeyboardEvent*>(ev);
|
||||
const SbBool press = ke->getState() == SoButtonEvent::DOWN ? true : false;
|
||||
if (ke->getKey() == SoKeyboardEvent::ESCAPE) {
|
||||
|
||||
@@ -2450,7 +2449,7 @@ public:
|
||||
}
|
||||
}
|
||||
else if (ev->isOfType(SoMouseButtonEvent::getClassTypeId())) {
|
||||
const SoMouseButtonEvent * mbe = static_cast<const SoMouseButtonEvent*>(ev);
|
||||
const auto mbe = static_cast<const SoMouseButtonEvent*>(ev);
|
||||
|
||||
// Mark all incoming mouse button events as handled, especially, to deactivate the selection node
|
||||
n->getAction()->setHandled();
|
||||
@@ -2541,7 +2540,7 @@ StdViewBoxZoom::StdViewBoxZoom()
|
||||
void StdViewBoxZoom::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
View3DInventor* view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
auto view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
if ( view ) {
|
||||
View3DInventorViewer* viewer = view->getViewer();
|
||||
if (!viewer->isSelecting()) {
|
||||
@@ -2736,7 +2735,7 @@ static std::vector<std::string> getBoxSelection(
|
||||
static void doSelect(void* ud, SoEventCallback * cb)
|
||||
{
|
||||
bool selectElement = ud ? true : false;
|
||||
Gui::View3DInventorViewer* viewer = static_cast<Gui::View3DInventorViewer*>(cb->getUserData());
|
||||
auto viewer = static_cast<Gui::View3DInventorViewer*>(cb->getUserData());
|
||||
|
||||
SoNode* root = viewer->getSceneGraph();
|
||||
static_cast<Gui::SoFCUnifiedSelection*>(root)->selectionRole.setValue(true);
|
||||
@@ -2762,8 +2761,8 @@ static void doSelect(void* ud, SoEventCallback * cb)
|
||||
selectionMode = INTERSECT;
|
||||
}
|
||||
else {
|
||||
for (std::vector<SbVec2f>::const_iterator it = picked.begin(); it != picked.end(); ++it)
|
||||
polygon.Add(Base::Vector2d((*it)[0],(*it)[1]));
|
||||
for (const auto & it : picked)
|
||||
polygon.Add(Base::Vector2d(it[0],it[1]));
|
||||
}
|
||||
|
||||
App::Document* doc = App::GetApplication().getActiveDocument();
|
||||
@@ -2793,7 +2792,7 @@ static void doSelect(void* ud, SoEventCallback * cb)
|
||||
void StdBoxSelection::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
View3DInventor* view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
auto view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
if (view) {
|
||||
View3DInventorViewer* viewer = view->getViewer();
|
||||
if (!viewer->isSelecting()) {
|
||||
@@ -2874,7 +2873,7 @@ StdBoxElementSelection::StdBoxElementSelection()
|
||||
void StdBoxElementSelection::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
View3DInventor* view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
auto view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
if (view) {
|
||||
View3DInventorViewer* viewer = view->getViewer();
|
||||
if (!viewer->isSelecting()) {
|
||||
@@ -3080,7 +3079,7 @@ void StdCmdMeasureDistance::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
Gui::Document* doc = Gui::Application::Instance->activeDocument();
|
||||
Gui::View3DInventor* view = static_cast<Gui::View3DInventor*>(doc->getActiveView());
|
||||
auto view = static_cast<Gui::View3DInventor*>(doc->getActiveView());
|
||||
if (view) {
|
||||
Gui::View3DInventorViewer* viewer = view->getViewer();
|
||||
viewer->setEditing(true);
|
||||
@@ -3088,7 +3087,7 @@ void StdCmdMeasureDistance::activated(int iMsg)
|
||||
|
||||
// Derives from QObject and we have a parent object, so we don't
|
||||
// require a delete.
|
||||
PointMarker* marker = new PointMarker(viewer);
|
||||
auto marker = new PointMarker(viewer);
|
||||
viewer->addEventCallback(SoEvent::getClassTypeId(),
|
||||
ViewProviderMeasureDistance::measureDistanceCallback, marker);
|
||||
}
|
||||
@@ -3218,7 +3217,7 @@ CmdViewMeasureClearAll::CmdViewMeasureClearAll()
|
||||
void CmdViewMeasureClearAll::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
Gui::View3DInventor *view = dynamic_cast<Gui::View3DInventor*>(Gui::Application::Instance->
|
||||
auto view = dynamic_cast<Gui::View3DInventor*>(Gui::Application::Instance->
|
||||
activeDocument()->getActiveView());
|
||||
if (!view)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user