1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-03 17:56:21 +03:00

0029747: Samples - Inspector tool - start DFBrowser inside FuncDemo qt sample

new Model->DFBrowser action to start Inspector tool with active DFBrowser plugin filled by the sample OCAF application.
To update content of the DFBrowser, use <F5> shortcut.
This commit is contained in:
nds 2018-05-08 19:56:11 +03:00 committed by abv
parent 2e93433ee5
commit ed667b9069
3 changed files with 49 additions and 0 deletions

View File

@ -3,3 +3,7 @@ project(FuncDemo)
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_prepare_sample)
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_prepare_sample)
if (BUILD_Inspector)
target_link_libraries (FuncDemo TKTInspector)
endif()

View File

@ -84,6 +84,11 @@
#include <unistd.h>
#endif
#ifdef HAVE_Inspector
#include <inspector/TInspector_Communicator.hxx>
static TInspector_Communicator* MyTCommunicator;
#endif
MainWindow::MainWindow()
{
graph = new GraphWidget(this);
@ -224,6 +229,30 @@ void MainWindow::nbThreads()
graph->setNbThreads(nb);
}
#ifdef HAVE_Inspector
void MainWindow::startDFBrowser()
{
Handle(AppStd_Application) anApplication = getApplication();
if (!anApplication.IsNull())
{
if (!MyTCommunicator)
{
MyTCommunicator = new TInspector_Communicator();
NCollection_List<Handle(Standard_Transient)> aParameters;
aParameters.Append(anApplication);
MyTCommunicator->RegisterPlugin("TKDFBrowser");
MyTCommunicator->Init(aParameters);
MyTCommunicator->Activate("TKDFBrowser");
}
MyTCommunicator->SetVisible(true);
}
}
#endif
void MainWindow::about()
{
QMessageBox::about(this, tr("Test-application of the advanced Function Mechanism"),
@ -250,6 +279,12 @@ void MainWindow::createActions()
nbThreadsAct->setStatusTip(tr("Number of threads"));
connect(nbThreadsAct, SIGNAL(triggered()), this, SLOT(nbThreads()));
#ifdef HAVE_Inspector
dfBrowserAct = new QAction(tr("DFBrowser"), this);
dfBrowserAct->setStatusTip(tr("OCAF structure presentation"));
connect(dfBrowserAct, SIGNAL(triggered()), this, SLOT(startDFBrowser()));
#endif
exitAct = new QAction(tr("E&xit"), this);
exitAct->setShortcut(tr("Ctrl+Q"));
exitAct->setStatusTip(tr("Exit the application"));
@ -269,6 +304,10 @@ void MainWindow::createMenus()
computeMenu->addAction(computeAct);
computeMenu->addAction(nbThreadsAct);
computeMenu->addSeparator();
#ifdef HAVE_Inspector
computeMenu->addAction(dfBrowserAct);
computeMenu->addSeparator();
#endif
computeMenu->addAction(exitAct);
menuBar()->addSeparator();

View File

@ -70,6 +70,9 @@ private slots:
void model2();
void compute();
void nbThreads();
#ifdef HAVE_Inspector
void startDFBrowser();
#endif
void about();
private:
@ -87,6 +90,9 @@ private:
QAction *model2Act;
QAction *computeAct;
QAction *nbThreadsAct;
#ifdef HAVE_Inspector
QAction *dfBrowserAct;
#endif
QAction *exitAct;
QAction *aboutAct;