[TD]ActiveView from different document

This commit is contained in:
wandererfan
2022-10-16 13:40:21 -04:00
committed by WandererFan
parent 9ae1432c3d
commit ce4ba703d9
6 changed files with 138 additions and 62 deletions

View File

@@ -30,35 +30,22 @@
#include "Grabber3d.h"
using namespace TechDrawGui;
using namespace Gui;
void Grabber3d::quickView(const QColor bgColor,
void Grabber3d::quickView(View3DInventor* view3d,
const QColor bgColor,
QImage &image)
{
// Base::Console().Message("G3d::quickView());
//get a 3d view
if (!Gui::getMainWindow()) {
//this should already be checked in the caller
Base::Console().Warning("G3d::quickView - no Main Window - returning\n");
return;
}
Gui::MainWindow* mainWindow = Gui::getMainWindow();
Gui::MDIView* mdiView = Gui::getMainWindow()->activeWindow();
View3DInventor* view3d = qobject_cast<View3DInventor*>(mdiView);
if (!view3d) {
//the active window is not a 3D view, so try to find one
auto mdiWindows = mainWindow->windows();
for (auto& mdi : mdiWindows) {
auto mdiView = qobject_cast<View3DInventor*>(mdi);
if (mdiView) {
view3d = mdiView;
break;
}
}
}
if (!view3d) {
//this should also already be checked in the caller
Base::Console().Warning("G3d::quickView - no 3D view for ActiveView - returning\n");
return;
}