mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2025-01-12 16:20:25 +08:00
Added supoprt for coin3d Quarter viewer
This commit is contained in:
parent
ae7d6cc655
commit
5af55c1258
@ -64,6 +64,15 @@
|
||||
#include <QElapsedTimer>
|
||||
#include <QQuickWidget>
|
||||
|
||||
#include <Inventor/Qt/SoQt.h>
|
||||
#include <Inventor/Qt/viewers/SoQtExaminerViewer.h>
|
||||
#include <Inventor/nodes/SoSeparator.h>
|
||||
#include <Inventor/nodes/SoCone.h>
|
||||
#include <Inventor/nodes/SoBaseColor.h>
|
||||
|
||||
#include <Quarter/QuarterWidget.h>
|
||||
#include <Quarter/Quarter.h>
|
||||
#include <Quarter/eventhandlers/DragDropHandler.h>
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
#include <QRandomGenerator>
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
@ -70,6 +70,8 @@ private slots:
|
||||
void createImageViewer();
|
||||
void lockWorkspace(bool Value);
|
||||
void createOpenGlWidget();
|
||||
void createCoin3DViewer();
|
||||
void createQuarterViewer();
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -40,5 +40,6 @@
|
||||
<file>images/lock.svg</file>
|
||||
<file>images/lock_open.svg</file>
|
||||
<file>images/deployed_code.svg</file>
|
||||
<file>images/category.svg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
5
demo/images/category.svg
Normal file
5
demo/images/category.svg
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg version="1.1" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
|
||||
<desc>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.)</desc>
|
||||
<path d="m243.2 467.2 246.4-403.2 246.4 403.2zm492.8 492.8q-84 0-142.8-58.8t-58.8-142.8 58.8-142.8 142.8-58.8 142.8 58.8 58.8 142.8-58.8 142.8-142.8 58.8zm-649.6-22.4v-358.4h358.4v358.4zm649.6-67.2q47.04 0 79.52-32.48t32.48-79.52-32.48-79.52-79.52-32.48-79.52 32.48-32.48 79.52 32.48 79.52 79.52 32.48zm-560-22.4h179.2v-179.2h-179.2zm226.24-470.4h174.72l-87.36-141.12z" fill="#03b8e5" fill-opacity=".87843" stroke-width=".025"/>
|
||||
</svg>
|
After Width: | Height: | Size: 755 B |
Loading…
Reference in New Issue
Block a user