From 5af55c12585f2fc1812e5b6359e6925cc960a7e1 Mon Sep 17 00:00:00 2001 From: Uwe Kindler Date: Thu, 18 Apr 2024 15:37:37 +0200 Subject: [PATCH] Added supoprt for coin3d Quarter viewer --- demo/MainWindow.cpp | 81 ++++++++++++++++++++++++++++++++++++++++ demo/MainWindow.h | 2 + demo/demo.pro | 25 +++++++++++++ demo/demo.qrc | 1 + demo/images/category.svg | 5 +++ 5 files changed, 114 insertions(+) create mode 100644 demo/images/category.svg diff --git a/demo/MainWindow.cpp b/demo/MainWindow.cpp index fa4cdfb..b09ee0d 100644 --- a/demo/MainWindow.cpp +++ b/demo/MainWindow.cpp @@ -64,6 +64,15 @@ #include #include +#include +#include +#include +#include +#include + +#include +#include +#include #if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) #include @@ -665,6 +674,18 @@ void MainWindowPrivate::createActions() QObject::connect(a, &QAction::triggered, _this, &CMainWindow::createOpenGlWidget); ui.menuTests->addAction(a); + a = ui.toolBar->addAction("Create Coin3D Viewer"); + a->setToolTip("Creates a Coin3D SoQt examine viewer for testing." ); + a->setIcon(svgIcon(":/adsdemo/images/category.svg")); + QObject::connect(a, &QAction::triggered, _this, &CMainWindow::createCoin3DViewer); + ui.menuTests->addAction(a); + + a = ui.toolBar->addAction("Create Quarter Viewer"); + a->setToolTip("Creates a Coin3D Quarter examine viewer for testing." ); + a->setIcon(svgIcon(":/adsdemo/images/category.svg")); + QObject::connect(a, &QAction::triggered, _this, &CMainWindow::createQuarterViewer); + ui.menuTests->addAction(a); + a = ui.toolBar->addAction("Apply VS Style"); a->setToolTip("Applies a Visual Studio light style (visual_studio_light.css)." ); a->setIcon(svgIcon(":/adsdemo/images/color_lens.svg")); @@ -731,6 +752,9 @@ CMainWindow::CMainWindow(QWidget *parent) : d->ui.setupUi(this); setWindowTitle(QApplication::instance()->applicationName()); d->createActions(); + SoQt::init(this); + SoDB::init(); + SIM::Coin3D::Quarter::Quarter::init(); // uncomment the following line if the tab close button should be // a QToolButton instead of a QPushButton @@ -1076,3 +1100,60 @@ void CMainWindow::createOpenGlWidget() d->DockManager->addDockWidget(ads::RightDockWidgetArea, DockWidget); } + +//============================================================================ +void CMainWindow::createCoin3DViewer() +{ + qDebug() << ":createCoin3DViewer "; + static int Coin3DWidgetCount = 0; + static SoSeparator* Root; + if (!Coin3DWidgetCount) + { + Root = new SoSeparator(); + Root->ref(); + auto Cone = new SoCone(); + Root->addChild(Cone); + } + + auto Viewer = new SoQtExaminerViewer(this, nullptr, true, SoQtFullViewer::BUILD_ALL); + Viewer->setTransparencyType(SoGLRenderAction::SORTED_OBJECT_BLEND); + Viewer->setAnimationEnabled(false); + Viewer->setFeedbackVisibility(true); + Viewer->setSampleBuffers(4); + Viewer->setSceneGraph(Root); + //d->Viewer->setBackgroundColor(toSbColor(QColor(38, 38, 38))); + auto DockWidget = new ads::CDockWidget(QString("Coin3D Viewer %1").arg(Coin3DWidgetCount++)); + DockWidget->setIcon(svgIcon(":/adsdemo/images/category.svg")); + DockWidget->setWidget(Viewer->getWidget(), ads:: CDockWidget::ForceNoScrollArea); + d->DockManager->addDockWidget(ads::LeftDockWidgetArea, DockWidget); +} + + +//============================================================================ +void CMainWindow::createQuarterViewer() +{ + qDebug() << ":createQuarterViewer "; + static int QuarterWidgetCount = 0; + static SoSeparator* Root; + if (!QuarterWidgetCount) + { + Root = new SoSeparator(); + Root->ref(); + SoBaseColor * col = new SoBaseColor; + col->rgb = SbColor(1, 1, 0); + Root->addChild(col); + Root->addChild(new SoCone); + } + + using namespace SIM::Coin3D::Quarter; + auto Viewer = new QuarterWidget(); + Viewer->setTransparencyType(QuarterWidget::SORTED_OBJECT_BLEND); + Viewer->setNavigationModeFile(); + Viewer->setSceneGraph(Root); + //d->Viewer->setBackgroundColor(toSbColor(QColor(38, 38, 38))); + auto DockWidget = new ads::CDockWidget(QString("Quarter Viewer %1").arg(QuarterWidgetCount++)); + DockWidget->setIcon(svgIcon(":/adsdemo/images/category.svg")); + DockWidget->setWidget(Viewer, ads:: CDockWidget::ForceNoScrollArea); + d->DockManager->addDockWidget(ads::LeftDockWidgetArea, DockWidget); +} + diff --git a/demo/MainWindow.h b/demo/MainWindow.h index 7beef1f..68d20df 100644 --- a/demo/MainWindow.h +++ b/demo/MainWindow.h @@ -70,6 +70,8 @@ private slots: void createImageViewer(); void lockWorkspace(bool Value); void createOpenGlWidget(); + void createCoin3DViewer(); + void createQuarterViewer(); }; #endif // MAINWINDOW_H diff --git a/demo/demo.pro b/demo/demo.pro index b3feb22..d9919cc 100644 --- a/demo/demo.pro +++ b/demo/demo.pro @@ -1,5 +1,7 @@ ADS_OUT_ROOT = $${OUT_PWD}/.. +include($$(cetoni_repository)/build/qt/qtprojectsettings/common.pri) + TARGET = AdvancedDockingSystemDemo DESTDIR = $${ADS_OUT_ROOT}/lib QT += core gui widgets quick quickwidgets opengl @@ -54,3 +56,26 @@ LIBS += -L$${ADS_OUT_ROOT}/lib INCLUDEPATH += ../src DEPENDPATH += ../src + + +DEFINES += COIN_NOT_DLL \ + SOQT_NOT_DLL \ + QUARTER_NOT_DLL + +LIBS *= -lopengl32 + +CONFIG(debug, debug|release){ + LIBS *= -llibSoQtd \ + -llibCoin-80d \ + -llibrlmdld \ + -llibrlsgd \ + -llibsolid3_d \ + -lquarterd +}else{ + LIBS *= -llibSoQt \ + -llibCoin-80 \ + -llibrlmdl \ + -llibrlsg \ + -llibsolid3 \ + -lquarter +} diff --git a/demo/demo.qrc b/demo/demo.qrc index 9ef0ff9..90b5919 100644 --- a/demo/demo.qrc +++ b/demo/demo.qrc @@ -40,5 +40,6 @@ images/lock.svg images/lock_open.svg images/deployed_code.svg + images/category.svg diff --git a/demo/images/category.svg b/demo/images/category.svg new file mode 100644 index 0000000..daac21a --- /dev/null +++ b/demo/images/category.svg @@ -0,0 +1,5 @@ + + + lock_outline icon - Licensed under Apache License v2.0 (http://www.apache.org/licenses/LICENSE-2.0) - Created with Iconfu.com - Derivative work of Material icons (Copyright Google Inc.) + +