mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0024479: Ray Tracing mode does not work in Qt IE sample
Implementation of Ray Tracing mode in standard Qt sample Fix compile warnings in Qt samples. Fix tabs in Common-string.ts. Update Code style. 0024415: Update QT samples Code which was based on QT3 was removed. Some bugs and warnings has been also fixed. Porting from QT4 to QT5 sample files.
This commit is contained in:
parent
471dfc6c80
commit
1503bd7d5b
BIN
samples/qt/Common/res/raytracing.png
Normal file
BIN
samples/qt/Common/res/raytracing.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 223 B |
@ -7,7 +7,8 @@
|
|||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QMenuBar>
|
#include <QMenuBar>
|
||||||
#include <QStatusBar>
|
#include <QStatusBar>
|
||||||
#include <QWorkspace>
|
#include <QMdiArea>
|
||||||
|
#include <QMdiSubWindow>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QSignalMapper>
|
#include <QSignalMapper>
|
||||||
@ -17,8 +18,8 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
static ApplicationCommonWindow* stApp;
|
static ApplicationCommonWindow* stApp = 0;
|
||||||
static QWorkspace* stWs;
|
static QMdiArea* stWs = 0;
|
||||||
|
|
||||||
ApplicationCommonWindow::ApplicationCommonWindow()
|
ApplicationCommonWindow::ApplicationCommonWindow()
|
||||||
: QMainWindow( 0 ),
|
: QMainWindow( 0 ),
|
||||||
@ -38,7 +39,7 @@ myStdToolBar( 0 )
|
|||||||
layout->setMargin( 0 );
|
layout->setMargin( 0 );
|
||||||
|
|
||||||
vb->setFrameStyle( QFrame::StyledPanel | QFrame::Sunken );
|
vb->setFrameStyle( QFrame::StyledPanel | QFrame::Sunken );
|
||||||
stWs = new QWorkspace( vb );
|
stWs = new QMdiArea( vb );
|
||||||
layout->addWidget( stWs );
|
layout->addWidget( stWs );
|
||||||
setCentralWidget( vb );
|
setCentralWidget( vb );
|
||||||
|
|
||||||
@ -122,7 +123,7 @@ void ApplicationCommonWindow::createStandardOperations()
|
|||||||
QMenu* aPrefMenu = new QMenu( QObject::tr("MNU_PREFERENCES") );
|
QMenu* aPrefMenu = new QMenu( QObject::tr("MNU_PREFERENCES") );
|
||||||
aPrefMenu->addAction( filePrefUseVBOAction );
|
aPrefMenu->addAction( filePrefUseVBOAction );
|
||||||
|
|
||||||
// popuplate a menu with all actions
|
// populate a menu with all actions
|
||||||
myFilePopup = new QMenu( this );
|
myFilePopup = new QMenu( this );
|
||||||
myFilePopup = menuBar()->addMenu( QObject::tr("MNU_FILE") );
|
myFilePopup = menuBar()->addMenu( QObject::tr("MNU_FILE") );
|
||||||
myFilePopup->addAction( fileNewAction );
|
myFilePopup->addAction( fileNewAction );
|
||||||
@ -198,43 +199,9 @@ void ApplicationCommonWindow::createCasCadeOperations()
|
|||||||
a = new QAction( QPixmap( dir+QObject::tr("ICON_TOOL_DEL") ), QObject::tr("MNU_TOOL_DEL"), this );
|
a = new QAction( QPixmap( dir+QObject::tr("ICON_TOOL_DEL") ), QObject::tr("MNU_TOOL_DEL"), this );
|
||||||
a->setToolTip( QObject::tr("TBR_TOOL_DEL") );
|
a->setToolTip( QObject::tr("TBR_TOOL_DEL") );
|
||||||
a->setStatusTip( QObject::tr("TBR_TOOL_DEL") );
|
a->setStatusTip( QObject::tr("TBR_TOOL_DEL") );
|
||||||
connect( a, SIGNAL( activated() ) , this, SLOT( onToolAction() ) );
|
connect( a, SIGNAL( triggered() ) , this, SLOT( onToolAction() ) );
|
||||||
myToolActions.insert( ToolDeleteId, a );
|
myToolActions.insert( ToolDeleteId, a );
|
||||||
|
|
||||||
#ifdef HAVE_OPENCL
|
|
||||||
|
|
||||||
// populate a tool bar with some actions
|
|
||||||
myRaytraceBar = addToolBar( tr( "Ray-trace options" ) );
|
|
||||||
|
|
||||||
a = new QAction( QPixmap( dir+QObject::tr("ICON_TOOL_SHADOWS") ), QObject::tr("MNU_TOOL_SHADOWS"), this );
|
|
||||||
a->setToolTip( QObject::tr("TBR_TOOL_SHADOWS") );
|
|
||||||
a->setStatusTip( QObject::tr("TBR_TOOL_SHADOWS") );
|
|
||||||
a->setCheckable( true );
|
|
||||||
a->setChecked( true );
|
|
||||||
connect( a, SIGNAL( activated() ) , this, SLOT( onRaytraceAction() ) );
|
|
||||||
myRaytraceActions.insert( ToolShadowsId, a );
|
|
||||||
myRaytraceBar->addAction( a );
|
|
||||||
|
|
||||||
a = new QAction( QPixmap( dir+QObject::tr("ICON_TOOL_REFLECTIONS") ), QObject::tr("MNU_TOOL_REFLECTIONS"), this );
|
|
||||||
a->setToolTip( QObject::tr("TBR_TOOL_REFLECTIONS") );
|
|
||||||
a->setStatusTip( QObject::tr("TBR_TOOL_REFLECTIONS") );
|
|
||||||
a->setCheckable( true );
|
|
||||||
a->setChecked( true );
|
|
||||||
connect( a, SIGNAL( activated() ) , this, SLOT( onRaytraceAction() ) );
|
|
||||||
myRaytraceActions.insert( ToolReflectionsId, a );
|
|
||||||
myRaytraceBar->addAction( a );
|
|
||||||
|
|
||||||
a = new QAction( QPixmap( dir+QObject::tr("ICON_TOOL_ANTIALIASING") ), QObject::tr("MNU_TOOL_ANTIALIASING"), this );
|
|
||||||
a->setToolTip( QObject::tr("TBR_TOOL_ANTIALIASING") );
|
|
||||||
a->setStatusTip( QObject::tr("TBR_TOOL_ANTIALIASING") );
|
|
||||||
a->setCheckable( true );
|
|
||||||
a->setChecked( false );
|
|
||||||
connect( a, SIGNAL( activated() ) , this, SLOT( onRaytraceAction() ) );
|
|
||||||
myRaytraceActions.insert( ToolAntialiasingId, a );
|
|
||||||
myRaytraceBar->addAction( a );
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QSignalMapper* sm = new QSignalMapper( this );
|
QSignalMapper* sm = new QSignalMapper( this );
|
||||||
connect( sm, SIGNAL( mapped( int ) ), this, SLOT( onSetMaterial( int ) ) );
|
connect( sm, SIGNAL( mapped( int ) ), this, SLOT( onSetMaterial( int ) ) );
|
||||||
|
|
||||||
@ -326,22 +293,12 @@ void ApplicationCommonWindow::windowsMenuAboutToShow()
|
|||||||
|
|
||||||
QString dir = getResourceDir() + QString( "/" );
|
QString dir = getResourceDir() + QString( "/" );
|
||||||
|
|
||||||
a = new QAction( QPixmap( dir + QObject::tr( "ICON_WINDOW_NEW3D" ) ), QObject::tr( "MNU_WINDOW_NEW3D_GL" ), this );
|
a = new QAction( QPixmap( dir + QObject::tr( "ICON_WINDOW_NEW3D" ) ), QObject::tr( "MNU_WINDOW_NEW3D" ), this );
|
||||||
a->setToolTip( QObject::tr( "TBR_WINDOW_NEW3D_GL" ) );
|
a->setToolTip( QObject::tr( "TBR_WINDOW_NEW3D" ) );
|
||||||
a->setStatusTip( QObject::tr( "TBR_WINDOW_NEW3D_GL" ) );
|
a->setStatusTip( QObject::tr( "TBR_WINDOW_NEW3D" ) );
|
||||||
connect( a, SIGNAL( triggered() ), this, SLOT( onCreateNewView() ) );
|
connect( a, SIGNAL( triggered() ), this, SLOT( onCreateNewView() ) );
|
||||||
myWindowPopup->addAction( a );
|
myWindowPopup->addAction( a );
|
||||||
|
|
||||||
#ifdef HAVE_OPENCL
|
|
||||||
|
|
||||||
a = new QAction( QPixmap( dir + QObject::tr( "ICON_WINDOW_NEW3D" ) ), QObject::tr( "MNU_WINDOW_NEW3D_RT" ), this );
|
|
||||||
a->setToolTip( QObject::tr( "TBR_WINDOW_NEW3D_RT" ) );
|
|
||||||
a->setStatusTip( QObject::tr( "TBR_WINDOW_NEW3D_RT" ) );
|
|
||||||
connect( a, SIGNAL( activated() ), this, SLOT( onCreateNewViewRT() ) );
|
|
||||||
myWindowPopup->addAction( a );
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
a = new QAction( QPixmap( dir + QObject::tr( "ICON_WINDOW_CASCADE" ) ), QObject::tr( "MNU_WINDOW_CASCADE" ), this );
|
a = new QAction( QPixmap( dir + QObject::tr( "ICON_WINDOW_CASCADE" ) ), QObject::tr( "MNU_WINDOW_CASCADE" ), this );
|
||||||
a->setToolTip( QObject::tr( "TBR_WINDOW_CASCADE" ) );
|
a->setToolTip( QObject::tr( "TBR_WINDOW_CASCADE" ) );
|
||||||
a->setStatusTip( QObject::tr( "TBR_WINDOW_CASCADE" ) );
|
a->setStatusTip( QObject::tr( "TBR_WINDOW_CASCADE" ) );
|
||||||
@ -355,16 +312,15 @@ void ApplicationCommonWindow::windowsMenuAboutToShow()
|
|||||||
myWindowPopup->addAction( a );
|
myWindowPopup->addAction( a );
|
||||||
|
|
||||||
myWindowPopup->addSeparator();
|
myWindowPopup->addSeparator();
|
||||||
QWidgetList windows = stWs->windowList();
|
QList<QMdiSubWindow *> windows = stWs->subWindowList();
|
||||||
for ( uint i = 0; i < windows.count(); ++i )
|
for (int i = 0; i < windows.count(); ++i)
|
||||||
{
|
{
|
||||||
|
QAction* aAction = new QAction( windows.at(i)->windowTitle(), this );
|
||||||
QAction* aAction = new QAction( windows.at(i)->windowTitle(), this );
|
|
||||||
aAction->setCheckable( true );
|
aAction->setCheckable( true );
|
||||||
aAction->setData( i );
|
aAction->setData( i );
|
||||||
myWindowPopup->addAction( aAction );
|
myWindowPopup->addAction( aAction );
|
||||||
connect( aAction, SIGNAL( toggled( bool ) ), this, SLOT( windowsMenuActivated( bool ) ) );
|
connect( aAction, SIGNAL( toggled( bool ) ), this, SLOT( windowsMenuActivated( bool ) ) );
|
||||||
aAction->setChecked( stWs->activeWindow() == windows.at(i) );
|
aAction->setChecked( stWs->activeSubWindow() == windows.at(i) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -373,12 +329,12 @@ void ApplicationCommonWindow::windowsMenuActivated( bool checked )
|
|||||||
QAction* aSender = qobject_cast<QAction*>( sender() );
|
QAction* aSender = qobject_cast<QAction*>( sender() );
|
||||||
if ( !aSender )
|
if ( !aSender )
|
||||||
return;
|
return;
|
||||||
QWidget* w = stWs->windowList().at( aSender->data().toInt() );
|
QWidget * w = stWs->subWindowList().at( aSender->data().toInt() );
|
||||||
if ( w && checked )
|
if ( w && checked )
|
||||||
w->setFocus();
|
w->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
QWorkspace * ApplicationCommonWindow::getWorkspace()
|
QMdiArea * ApplicationCommonWindow::getWorkspace()
|
||||||
{
|
{
|
||||||
return stWs;
|
return stWs;
|
||||||
}
|
}
|
||||||
@ -390,7 +346,7 @@ ApplicationCommonWindow* ApplicationCommonWindow::getApplication()
|
|||||||
|
|
||||||
void ApplicationCommonWindow::updateFileActions()
|
void ApplicationCommonWindow::updateFileActions()
|
||||||
{
|
{
|
||||||
if ( stWs->windowList().isEmpty() )
|
if ( myDocuments.isEmpty() )
|
||||||
{
|
{
|
||||||
if ( !myIsDocuments )
|
if ( !myIsDocuments )
|
||||||
{
|
{
|
||||||
@ -447,67 +403,49 @@ int& ApplicationCommonWindow::getNbDocument()
|
|||||||
|
|
||||||
DocumentCommon* ApplicationCommonWindow::onNewDoc()
|
DocumentCommon* ApplicationCommonWindow::onNewDoc()
|
||||||
{
|
{
|
||||||
updateFileActions();
|
updateFileActions();
|
||||||
DocumentCommon* aDoc = createNewDocument();
|
|
||||||
aDoc->onCreateNewView();
|
DocumentCommon* aDoc = createNewDocument();
|
||||||
onSelectionChanged();
|
aDoc->onCreateNewView();
|
||||||
connect( aDoc, SIGNAL( sendCloseDocument( DocumentCommon* ) ),
|
onSelectionChanged();
|
||||||
this, SLOT( onCloseDocument( DocumentCommon* ) ) );
|
|
||||||
connect( stWs, SIGNAL( windowActivated( QWidget* ) ),
|
connect (aDoc, SIGNAL (sendCloseDocument (DocumentCommon*) ),
|
||||||
this, SLOT( onWindowActivated( QWidget* ) ) );
|
this, SLOT (onCloseDocument (DocumentCommon*)));
|
||||||
connect( aDoc, SIGNAL( selectionChanged() ),
|
connect (stWs, SIGNAL (windowActivated (QWidget*)),
|
||||||
this, SLOT( onSelectionChanged() ) );
|
this, SLOT (onWindowActivated (QWidget*)));
|
||||||
myDocuments.append( aDoc );
|
connect (aDoc, SIGNAL (selectionChanged()),
|
||||||
myStdActions.at( FileCloseId )->setEnabled( myDocuments.count() > 0 );
|
this, SLOT (onSelectionChanged()));
|
||||||
return aDoc;
|
|
||||||
}
|
myDocuments.append (aDoc);
|
||||||
|
myStdActions.at (FileCloseId)->setEnabled (myDocuments.count() > 0);
|
||||||
DocumentCommon* ApplicationCommonWindow::onNewDocRT()
|
|
||||||
{
|
return aDoc;
|
||||||
updateFileActions();
|
|
||||||
DocumentCommon* aDoc = createNewDocument();
|
|
||||||
aDoc->onCreateNewView(true);
|
|
||||||
onSelectionChanged();
|
|
||||||
connect( aDoc, SIGNAL( sendCloseDocument( DocumentCommon* ) ),
|
|
||||||
this, SLOT( onCloseDocument( DocumentCommon* ) ) );
|
|
||||||
connect( stWs, SIGNAL( windowActivated( QWidget* ) ),
|
|
||||||
this, SLOT( onWindowActivated( QWidget* ) ) );
|
|
||||||
connect( aDoc, SIGNAL( selectionChanged() ),
|
|
||||||
this, SLOT( onSelectionChanged() ) );
|
|
||||||
myDocuments.append( aDoc );
|
|
||||||
myStdActions.at( FileCloseId )->setEnabled( myDocuments.count() > 0 );
|
|
||||||
return aDoc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationCommonWindow::onCloseWindow()
|
void ApplicationCommonWindow::onCloseWindow()
|
||||||
{
|
{
|
||||||
MDIWindow* m = (MDIWindow*)stWs->activeWindow();
|
stWs->activeSubWindow()->close();
|
||||||
if ( m )
|
|
||||||
{
|
|
||||||
DocumentCommon* doc = m->getDocument();
|
|
||||||
onCloseDocument( doc );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationCommonWindow::onUseVBO()
|
void ApplicationCommonWindow::onUseVBO()
|
||||||
{
|
{
|
||||||
MDIWindow* w = ( MDIWindow* ) stWs->activeWindow();
|
MDIWindow* aWindow = qobject_cast<MDIWindow*> (stWs->activeSubWindow()->widget());
|
||||||
|
|
||||||
if ( NULL == w )
|
if (NULL == aWindow)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Handle(AIS_InteractiveContext) aContextAIS = w->getDocument()->getContext();
|
Handle(AIS_InteractiveContext) aContextAIS = aWindow->getDocument()->getContext();
|
||||||
|
|
||||||
if (aContextAIS.IsNull())
|
if (aContextAIS.IsNull())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Handle(OpenGl_GraphicDriver) aDriver =
|
Handle(OpenGl_GraphicDriver) aDriver =
|
||||||
Handle(OpenGl_GraphicDriver)::DownCast (aContextAIS->CurrentViewer()->Driver());
|
Handle(OpenGl_GraphicDriver)::DownCast (aContextAIS->CurrentViewer()->Driver());
|
||||||
|
|
||||||
if (!aDriver.IsNull())
|
if (!aDriver.IsNull())
|
||||||
{
|
{
|
||||||
aDriver->ChangeOptions().vboDisable = Standard_True;
|
aDriver->ChangeOptions().vboDisable = Standard_True;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationCommonWindow::onCloseDocument(DocumentCommon* theDoc)
|
void ApplicationCommonWindow::onCloseDocument(DocumentCommon* theDoc)
|
||||||
@ -549,20 +487,10 @@ void ApplicationCommonWindow::onAbout()
|
|||||||
|
|
||||||
void ApplicationCommonWindow::onCreateNewView()
|
void ApplicationCommonWindow::onCreateNewView()
|
||||||
{
|
{
|
||||||
MDIWindow* window = qobject_cast< MDIWindow* >( stWs->activeWindow() );
|
MDIWindow* window = qobject_cast< MDIWindow* >( stWs->activeSubWindow()->widget() );
|
||||||
window->getDocument()->onCreateNewView( false );
|
window->getDocument()->onCreateNewView();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_OPENCL
|
|
||||||
|
|
||||||
void ApplicationCommonWindow::onCreateNewViewRT()
|
|
||||||
{
|
|
||||||
MDIWindow* window = qobject_cast< MDIWindow* >( stWs->activeWindow() );
|
|
||||||
window->getDocument()->onCreateNewView( true );
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void ApplicationCommonWindow::onWindowActivated ( QWidget * w )
|
void ApplicationCommonWindow::onWindowActivated ( QWidget * w )
|
||||||
{
|
{
|
||||||
if (w == NULL)
|
if (w == NULL)
|
||||||
@ -573,21 +501,13 @@ void ApplicationCommonWindow::onWindowActivated ( QWidget * w )
|
|||||||
MDIWindow* window = qobject_cast< MDIWindow* >(w);
|
MDIWindow* window = qobject_cast< MDIWindow* >(w);
|
||||||
|
|
||||||
window->onWindowActivated();
|
window->onWindowActivated();
|
||||||
|
|
||||||
#ifdef HAVE_OPENCL
|
|
||||||
|
|
||||||
myRaytraceActions.at( ToolShadowsId )->setChecked (window->ShadowsEnabled());
|
|
||||||
myRaytraceActions.at( ToolReflectionsId )->setChecked (window->ReflectionsEnabled());
|
|
||||||
myRaytraceActions.at( ToolAntialiasingId )->setChecked (window->AntialiasingEnabled());
|
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationCommonWindow::onToolAction()
|
void ApplicationCommonWindow::onToolAction()
|
||||||
{
|
{
|
||||||
QAction* sentBy = (QAction*) sender();
|
QAction* sentBy = (QAction*) sender();
|
||||||
QWorkspace* ws = ApplicationCommonWindow::getWorkspace();
|
QMdiArea* ws = ApplicationCommonWindow::getWorkspace();
|
||||||
DocumentCommon* doc = ((MDIWindow*)ws->activeWindow())->getDocument();
|
DocumentCommon* doc = qobject_cast<MDIWindow*>( ws->activeSubWindow()->widget() )->getDocument();
|
||||||
|
|
||||||
if( sentBy == myToolActions.at( ToolWireframeId ) )
|
if( sentBy == myToolActions.at( ToolWireframeId ) )
|
||||||
doc->onWireframe();
|
doc->onWireframe();
|
||||||
@ -608,87 +528,60 @@ void ApplicationCommonWindow::onToolAction()
|
|||||||
doc->onDelete();
|
doc->onDelete();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_OPENCL
|
|
||||||
|
|
||||||
void ApplicationCommonWindow::onRaytraceAction()
|
|
||||||
{
|
|
||||||
QAction* sentBy = (QAction*) sender();
|
|
||||||
|
|
||||||
DocumentCommon* doc = qobject_cast< MDIWindow* >(
|
|
||||||
ApplicationCommonWindow::getWorkspace()->activeWindow())->getDocument();
|
|
||||||
|
|
||||||
if( sentBy == myRaytraceActions.at( ToolShadowsId ) )
|
|
||||||
{
|
|
||||||
bool flag = myRaytraceActions.at( ToolShadowsId )->isChecked();
|
|
||||||
doc->onShadows( flag );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( sentBy == myRaytraceActions.at( ToolReflectionsId ) )
|
|
||||||
{
|
|
||||||
bool flag = myRaytraceActions.at( ToolReflectionsId )->isChecked();
|
|
||||||
doc->onReflections( flag );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( sentBy == myRaytraceActions.at( ToolAntialiasingId ) )
|
|
||||||
{
|
|
||||||
bool flag = myRaytraceActions.at( ToolAntialiasingId )->isChecked();
|
|
||||||
doc->onAntialiasing( flag );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void ApplicationCommonWindow::onSelectionChanged()
|
void ApplicationCommonWindow::onSelectionChanged()
|
||||||
{
|
{
|
||||||
QWorkspace* ws = ApplicationCommonWindow::getWorkspace();
|
QMdiArea* ws = ApplicationCommonWindow::getWorkspace();
|
||||||
DocumentCommon* doc;
|
DocumentCommon* doc;
|
||||||
|
|
||||||
if( !qobject_cast<MDIWindow*>( ws->activeWindow() ) )
|
if( !qobject_cast<MDIWindow*>( ws->activeSubWindow()->widget() ) )
|
||||||
return;
|
return;
|
||||||
doc = ((MDIWindow*)ws->activeWindow())->getDocument();
|
|
||||||
Handle(AIS_InteractiveContext) context = doc->getContext();
|
doc = ( qobject_cast<MDIWindow*>( ws->activeSubWindow()->widget() ) )->getDocument();
|
||||||
|
Handle(AIS_InteractiveContext) context = doc->getContext();
|
||||||
|
|
||||||
bool OneOrMoreInShading = false;
|
bool OneOrMoreInShading = false;
|
||||||
bool OneOrMoreInWireframe = false;
|
bool OneOrMoreInWireframe = false;
|
||||||
int numSel = context->NbSelected();
|
int numSel = context->NbSelected();
|
||||||
if ( numSel )
|
if ( numSel )
|
||||||
|
{
|
||||||
|
for ( context->InitCurrent(); context->MoreCurrent(); context->NextCurrent() )
|
||||||
{
|
{
|
||||||
for ( context->InitCurrent(); context->MoreCurrent(); context->NextCurrent() )
|
if ( context->IsDisplayed( context->Current(), 1 ) )
|
||||||
{
|
OneOrMoreInShading = true;
|
||||||
if ( context->IsDisplayed( context->Current(), 1 ) )
|
if ( context->IsDisplayed( context->Current(), 0 ) )
|
||||||
OneOrMoreInShading = true;
|
OneOrMoreInWireframe = true;
|
||||||
if ( context->IsDisplayed( context->Current(), 0 ) )
|
|
||||||
OneOrMoreInWireframe = true;
|
|
||||||
}
|
|
||||||
myToolActions.at( ToolWireframeId )->setEnabled( OneOrMoreInShading );
|
|
||||||
myToolActions.at( ToolShadingId )->setEnabled( OneOrMoreInWireframe );
|
|
||||||
myToolActions.at( ToolColorId )->setEnabled( true );
|
|
||||||
myToolActions.at( ToolMaterialId )->setEnabled( true );
|
|
||||||
myToolActions.at( ToolTransparencyId )->setEnabled( OneOrMoreInShading );
|
|
||||||
myToolActions.at( ToolDeleteId )->setEnabled( true );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
myToolActions.at( ToolWireframeId )->setEnabled( false );
|
|
||||||
myToolActions.at( ToolShadingId )->setEnabled( false );
|
|
||||||
myToolActions.at( ToolColorId )->setEnabled( false );
|
|
||||||
myToolActions.at( ToolMaterialId )->setEnabled( false );
|
|
||||||
myToolActions.at( ToolTransparencyId )->setEnabled( false );
|
|
||||||
myToolActions.at( ToolDeleteId )->setEnabled( false );
|
|
||||||
}
|
}
|
||||||
|
myToolActions.at( ToolWireframeId )->setEnabled( OneOrMoreInShading );
|
||||||
|
myToolActions.at( ToolShadingId )->setEnabled( OneOrMoreInWireframe );
|
||||||
|
myToolActions.at( ToolColorId )->setEnabled( true );
|
||||||
|
myToolActions.at( ToolMaterialId )->setEnabled( true );
|
||||||
|
myToolActions.at( ToolTransparencyId )->setEnabled( OneOrMoreInShading );
|
||||||
|
myToolActions.at( ToolDeleteId )->setEnabled( true );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
myToolActions.at( ToolWireframeId )->setEnabled( false );
|
||||||
|
myToolActions.at( ToolShadingId )->setEnabled( false );
|
||||||
|
myToolActions.at( ToolColorId )->setEnabled( false );
|
||||||
|
myToolActions.at( ToolMaterialId )->setEnabled( false );
|
||||||
|
myToolActions.at( ToolTransparencyId )->setEnabled( false );
|
||||||
|
myToolActions.at( ToolDeleteId )->setEnabled( false );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationCommonWindow::onSetMaterial( int theMaterial )
|
void ApplicationCommonWindow::onSetMaterial( int theMaterial )
|
||||||
{
|
{
|
||||||
QWorkspace* ws = getWorkspace();
|
QMdiArea* ws = getWorkspace();
|
||||||
DocumentCommon* doc = ((MDIWindow*)ws->activeWindow())->getDocument();
|
DocumentCommon* doc = qobject_cast<MDIWindow*>( ws->activeSubWindow()->widget() )->getDocument();
|
||||||
doc->onMaterial( theMaterial );
|
doc->onMaterial( theMaterial );
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ApplicationCommonWindow::getResourceDir()
|
QString ApplicationCommonWindow::getResourceDir()
|
||||||
{
|
{
|
||||||
static QString resDir( ::getenv( "CSF_ResourcesDefaults" ) );
|
static QString aResourceDir =
|
||||||
return resDir;
|
QString::fromUtf8 (qgetenv ("CSF_ResourcesDefaults").constData());
|
||||||
|
|
||||||
|
return aResourceDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationCommonWindow::resizeEvent( QResizeEvent* e )
|
void ApplicationCommonWindow::resizeEvent( QResizeEvent* e )
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QToolBar>
|
#include <QToolBar>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QWorkspace>
|
#include <QMdiArea>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
|
|
||||||
|
|
||||||
@ -18,12 +18,11 @@ class COMMONSAMPLE_EXPORT ApplicationCommonWindow: public QMainWindow
|
|||||||
public:
|
public:
|
||||||
enum { FileNewId, FilePrefUseVBOId, FileCloseId, FilePreferencesId, FileQuitId, ViewToolId, ViewStatusId, HelpAboutId };
|
enum { FileNewId, FilePrefUseVBOId, FileCloseId, FilePreferencesId, FileQuitId, ViewToolId, ViewStatusId, HelpAboutId };
|
||||||
enum { ToolWireframeId, ToolShadingId, ToolColorId, ToolMaterialId, ToolTransparencyId, ToolDeleteId };
|
enum { ToolWireframeId, ToolShadingId, ToolColorId, ToolMaterialId, ToolTransparencyId, ToolDeleteId };
|
||||||
enum { ToolShadowsId, ToolReflectionsId, ToolAntialiasingId };
|
|
||||||
|
|
||||||
ApplicationCommonWindow();
|
ApplicationCommonWindow();
|
||||||
~ApplicationCommonWindow();
|
~ApplicationCommonWindow();
|
||||||
|
|
||||||
static QWorkspace* getWorkspace();
|
static QMdiArea* getWorkspace();
|
||||||
static ApplicationCommonWindow* getApplication();
|
static ApplicationCommonWindow* getApplication();
|
||||||
static QString getResourceDir();
|
static QString getResourceDir();
|
||||||
|
|
||||||
@ -38,7 +37,6 @@ protected:
|
|||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
DocumentCommon* onNewDoc();
|
DocumentCommon* onNewDoc();
|
||||||
DocumentCommon* onNewDocRT();
|
|
||||||
void onCloseWindow();
|
void onCloseWindow();
|
||||||
void onUseVBO();
|
void onUseVBO();
|
||||||
virtual void onCloseDocument( DocumentCommon* theDoc );
|
virtual void onCloseDocument( DocumentCommon* theDoc );
|
||||||
@ -47,13 +45,7 @@ public slots:
|
|||||||
void onViewToolBar();
|
void onViewToolBar();
|
||||||
void onViewStatusBar();
|
void onViewStatusBar();
|
||||||
void onToolAction();
|
void onToolAction();
|
||||||
#ifdef HAVE_OPENCL
|
|
||||||
void onRaytraceAction();
|
|
||||||
#endif
|
|
||||||
void onCreateNewView();
|
void onCreateNewView();
|
||||||
#ifdef HAVE_OPENCL
|
|
||||||
void onCreateNewViewRT();
|
|
||||||
#endif
|
|
||||||
void onWindowActivated ( QWidget * w );
|
void onWindowActivated ( QWidget * w );
|
||||||
void windowsMenuAboutToShow();
|
void windowsMenuAboutToShow();
|
||||||
void windowsMenuActivated( bool checked/*int id*/ );
|
void windowsMenuActivated( bool checked/*int id*/ );
|
||||||
@ -77,16 +69,17 @@ private:
|
|||||||
|
|
||||||
QList<QAction*> myStdActions;
|
QList<QAction*> myStdActions;
|
||||||
QList<QAction*> myToolActions;
|
QList<QAction*> myToolActions;
|
||||||
QList<QAction*> myRaytraceActions;
|
|
||||||
QList<QAction*> myMaterialActions;
|
QList<QAction*> myMaterialActions;
|
||||||
QList<DocumentCommon*> myDocuments;
|
//QList<DocumentCommon*> myDocuments;
|
||||||
|
|
||||||
QToolBar* myStdToolBar;
|
QToolBar* myStdToolBar;
|
||||||
QToolBar* myCasCadeBar;
|
QToolBar* myCasCadeBar;
|
||||||
QToolBar* myRaytraceBar;
|
|
||||||
QMenu* myFilePopup;
|
QMenu* myFilePopup;
|
||||||
QMenu* myWindowPopup;
|
QMenu* myWindowPopup;
|
||||||
QAction* myFileSeparator;
|
QAction* myFileSeparator;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
QList<DocumentCommon*> myDocuments;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -86,14 +86,6 @@
|
|||||||
<source>ICON_NEW</source>
|
<source>ICON_NEW</source>
|
||||||
<translation>new.png</translation>
|
<translation>new.png</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>ICON_NEW_GL</source>
|
|
||||||
<translation>newGL.png</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>ICON_NEW_RT</source>
|
|
||||||
<translation>newRT.png</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>ICON_VIEW_RIGHT</source>
|
<source>ICON_VIEW_RIGHT</source>
|
||||||
<translation>view_right.png</translation>
|
<translation>view_right.png</translation>
|
||||||
@ -134,10 +126,18 @@
|
|||||||
<source>ICON_SAMPLE</source>
|
<source>ICON_SAMPLE</source>
|
||||||
<translation>lamp.png</translation>
|
<translation>lamp.png</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>ICON_TOOL_RAYTRACING</source>
|
||||||
|
<translation>raytracing.png</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>ICON_TOOL_SHADOWS</source>
|
<source>ICON_TOOL_SHADOWS</source>
|
||||||
<translation>shadows.png</translation>
|
<translation>shadows.png</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>ICON_TOOL_RAYTRACING</source>
|
||||||
|
<translation>shadows.png</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>ICON_TOOL_REFLECTIONS</source>
|
<source>ICON_TOOL_REFLECTIONS</source>
|
||||||
<translation>reflections.png</translation>
|
<translation>reflections.png</translation>
|
||||||
|
@ -142,13 +142,17 @@
|
|||||||
<source>MNU_TOOL_SHADOWS</source>
|
<source>MNU_TOOL_SHADOWS</source>
|
||||||
<translation>&Shadows</translation>
|
<translation>&Shadows</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>MNU_TOOL_RAYTRACING</source>
|
||||||
|
<translation>&Ray-tracing</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>MNU_TOOL_REFLECTIONS</source>
|
<source>MNU_TOOL_REFLECTIONS</source>
|
||||||
<translation>&Reflections</translation>
|
<translation>&Reflections</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>MNU_TOOL_ANTIALIASING</source>
|
<source>MNU_TOOL_ANTIALIASING</source>
|
||||||
<translation>&Antialiasing</translation>
|
<translation>&Anti-aliasing</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>BTN_BRASS</source>
|
<source>BTN_BRASS</source>
|
||||||
@ -270,6 +274,22 @@
|
|||||||
<source>TBR_TOOL_MATER</source>
|
<source>TBR_TOOL_MATER</source>
|
||||||
<translation>Material</translation>
|
<translation>Material</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>TBR_TOOL_RAYTRACING</source>
|
||||||
|
<translation>Enable Ray-tracing</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>TBR_TOOL_SHADOWS</source>
|
||||||
|
<translation>Enable Shadows</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>TBR_TOOL_REFLECTIONS</source>
|
||||||
|
<translation>Enable Reflections</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>TBR_TOOL_ANTIALIASING</source>
|
||||||
|
<translation>Enable Anti-aliasing</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>TBR_TOOL_BAR</source>
|
<source>TBR_TOOL_BAR</source>
|
||||||
<translation>Toolbar</translation>
|
<translation>Toolbar</translation>
|
||||||
@ -343,20 +363,8 @@
|
|||||||
<translation>New 3D View</translation>
|
<translation>New 3D View</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>TBR_WINDOW_NEW3D_GL</source>
|
<source>MNU_WINDOW_NEW3D</source>
|
||||||
<translation>New GL 3D View</translation>
|
<translation>New 3D View</translation>
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>MNU_WINDOW_NEW3D_GL</source>
|
|
||||||
<translation>New GL 3D View</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>TBR_WINDOW_NEW3D_RT</source>
|
|
||||||
<translation>&New RT 3D View</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>MNU_WINDOW_NEW3D_RT</source>
|
|
||||||
<translation>&New RT 3D View</translation>
|
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>MNU_STATUS_BAR</source>
|
<source>MNU_STATUS_BAR</source>
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#include <OpenGl_GraphicDriver.hxx>
|
#include <OpenGl_GraphicDriver.hxx>
|
||||||
#include <TCollection_AsciiString.hxx>
|
#include <TCollection_AsciiString.hxx>
|
||||||
|
|
||||||
Handle(V3d_Viewer) DocumentCommon::Viewer( const Standard_CString aDisplay,
|
Handle(V3d_Viewer) DocumentCommon::Viewer( const Standard_CString /*aDisplay*/,
|
||||||
const Standard_ExtString aName,
|
const Standard_ExtString aName,
|
||||||
const Standard_CString aDomain,
|
const Standard_CString aDomain,
|
||||||
const Standard_Real ViewSize,
|
const Standard_Real ViewSize,
|
||||||
@ -46,14 +46,14 @@ myApp( app ),
|
|||||||
myIndex( theIndex ),
|
myIndex( theIndex ),
|
||||||
myNbViews( 0 )
|
myNbViews( 0 )
|
||||||
{
|
{
|
||||||
TCollection_ExtendedString a3DName("Visu3D");
|
TCollection_ExtendedString a3DName ("Visu3D");
|
||||||
myViewer = Viewer( getenv("DISPLAY"), a3DName.ToExtString(), "", 1000.0,
|
myViewer = Viewer (qgetenv ("DISPLAY").constData(),
|
||||||
V3d_XposYnegZpos, Standard_True, Standard_True );
|
a3DName.ToExtString(), "", 1000.0, V3d_XposYnegZpos, Standard_True, Standard_True);
|
||||||
|
|
||||||
myViewer->SetDefaultLights();
|
myViewer->SetDefaultLights();
|
||||||
myViewer->SetLightOn();
|
myViewer->SetLightOn();
|
||||||
|
|
||||||
myContext =new AIS_InteractiveContext(myViewer);
|
myContext = new AIS_InteractiveContext (myViewer);
|
||||||
}
|
}
|
||||||
|
|
||||||
DocumentCommon::~DocumentCommon()
|
DocumentCommon::~DocumentCommon()
|
||||||
@ -65,22 +65,22 @@ ApplicationCommonWindow* DocumentCommon::getApplication()
|
|||||||
return myApp;
|
return myApp;
|
||||||
}
|
}
|
||||||
|
|
||||||
MDIWindow* DocumentCommon::createNewMDIWindow( bool theRT )
|
MDIWindow* DocumentCommon::createNewMDIWindow()
|
||||||
{
|
{
|
||||||
QWorkspace* ws = myApp->getWorkspace();
|
QMdiArea* ws = myApp->getWorkspace();
|
||||||
return new MDIWindow( this, ws, 0, theRT );
|
return new MDIWindow (this, ws, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DocumentCommon::onCreateNewView( bool theRT )
|
void DocumentCommon::onCreateNewView()
|
||||||
{
|
{
|
||||||
QWorkspace* ws = myApp->getWorkspace();
|
QMdiArea* ws = myApp->getWorkspace();
|
||||||
MDIWindow* w = createNewMDIWindow( theRT );
|
MDIWindow* w = createNewMDIWindow();
|
||||||
|
|
||||||
if( !w )
|
if (!w)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ws->addWindow( w );
|
ws->addSubWindow (w);
|
||||||
myViews.append(w);
|
myViews.append (w);
|
||||||
|
|
||||||
connect( w, SIGNAL( selectionChanged() ),
|
connect( w, SIGNAL( selectionChanged() ),
|
||||||
this, SIGNAL( selectionChanged() ) );
|
this, SIGNAL( selectionChanged() ) );
|
||||||
@ -95,7 +95,7 @@ void DocumentCommon::onCreateNewView( bool theRT )
|
|||||||
|
|
||||||
w->setWindowIcon( QPixmap( dir + QObject::tr("ICON_DOC") ) );
|
w->setWindowIcon( QPixmap( dir + QObject::tr("ICON_DOC") ) );
|
||||||
|
|
||||||
if ( ws->windowList().isEmpty() )
|
if ( ws->subWindowList().isEmpty() )
|
||||||
{
|
{
|
||||||
// Due to strange Qt4.2.3 feature the child window icon is not drawn
|
// Due to strange Qt4.2.3 feature the child window icon is not drawn
|
||||||
// in the main menu if showMaximized() is called for a non-visible child window
|
// in the main menu if showMaximized() is called for a non-visible child window
|
||||||
@ -129,7 +129,9 @@ void DocumentCommon::removeView(MDIWindow* theView)
|
|||||||
void DocumentCommon::removeViews()
|
void DocumentCommon::removeViews()
|
||||||
{
|
{
|
||||||
while( myViews.count() )
|
while( myViews.count() )
|
||||||
removeView( (MDIWindow*)myViews.first() );
|
{
|
||||||
|
removeView( myViews.first() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int DocumentCommon::countOfWindow()
|
int DocumentCommon::countOfWindow()
|
||||||
@ -226,49 +228,3 @@ void DocumentCommon::onDelete()
|
|||||||
myContext->ClearSelected();
|
myContext->ClearSelected();
|
||||||
getApplication()->onSelectionChanged();
|
getApplication()->onSelectionChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_OPENCL
|
|
||||||
|
|
||||||
void DocumentCommon::onShadows( int state )
|
|
||||||
{
|
|
||||||
QWorkspace* ws = ApplicationCommonWindow::getWorkspace();
|
|
||||||
|
|
||||||
MDIWindow* window = qobject_cast< MDIWindow* >( ws->activeWindow() );
|
|
||||||
|
|
||||||
if( window == NULL )
|
|
||||||
return;
|
|
||||||
|
|
||||||
window->setRaytracedShadows( state );
|
|
||||||
|
|
||||||
myContext->UpdateCurrentViewer();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DocumentCommon::onReflections( int state )
|
|
||||||
{
|
|
||||||
QWorkspace* ws = ApplicationCommonWindow::getWorkspace();
|
|
||||||
|
|
||||||
MDIWindow* window = qobject_cast< MDIWindow* >( ws->activeWindow() );
|
|
||||||
|
|
||||||
if( window == NULL )
|
|
||||||
return;
|
|
||||||
|
|
||||||
window->setRaytracedReflections( state );
|
|
||||||
|
|
||||||
myContext->UpdateCurrentViewer();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DocumentCommon::onAntialiasing( int state )
|
|
||||||
{
|
|
||||||
QWorkspace* ws = ApplicationCommonWindow::getWorkspace();
|
|
||||||
|
|
||||||
MDIWindow* window = qobject_cast< MDIWindow* >( ws->activeWindow() );
|
|
||||||
|
|
||||||
if( window == NULL )
|
|
||||||
return;
|
|
||||||
|
|
||||||
window->setRaytracedAntialiasing( state );
|
|
||||||
|
|
||||||
myContext->UpdateCurrentViewer();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
@ -28,7 +28,7 @@ public:
|
|||||||
void fitAll();
|
void fitAll();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual MDIWindow* createNewMDIWindow( bool theRT = false );
|
virtual MDIWindow* createNewMDIWindow();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void selectionChanged();
|
void selectionChanged();
|
||||||
@ -36,17 +36,11 @@ signals:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void onCloseView( MDIWindow* );
|
virtual void onCloseView( MDIWindow* );
|
||||||
virtual void onCreateNewView( bool theRT = false );
|
virtual void onCreateNewView();
|
||||||
virtual void onMaterial();
|
virtual void onMaterial();
|
||||||
virtual void onMaterial( int );
|
virtual void onMaterial( int );
|
||||||
virtual void onDelete();
|
virtual void onDelete();
|
||||||
|
|
||||||
#ifdef HAVE_OPENCL
|
|
||||||
virtual void onShadows( int state );
|
|
||||||
virtual void onReflections( int state );
|
|
||||||
virtual void onAntialiasing( int state );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void onWireframe();
|
void onWireframe();
|
||||||
void onShading();
|
void onShading();
|
||||||
void onColor();
|
void onColor();
|
||||||
|
@ -21,20 +21,11 @@ MDIWindow::MDIWindow(View* aView,
|
|||||||
Qt::WindowFlags wflags )
|
Qt::WindowFlags wflags )
|
||||||
: QMainWindow( parent, wflags )
|
: QMainWindow( parent, wflags )
|
||||||
{
|
{
|
||||||
|
|
||||||
myView = aView;
|
myView = aView;
|
||||||
myDocument = aDocument;
|
myDocument = aDocument;
|
||||||
|
|
||||||
#ifdef HAVE_OPENCL
|
|
||||||
|
|
||||||
myShadowsEnabled = true;
|
|
||||||
myReflectionsEnabled = true;
|
|
||||||
myAntialiasingEnabled = false;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MDIWindow::MDIWindow( DocumentCommon* aDocument, QWidget* parent, Qt::WindowFlags wflags, bool theRT )
|
MDIWindow::MDIWindow( DocumentCommon* aDocument, QWidget* parent, Qt::WindowFlags wflags)
|
||||||
: QMainWindow( parent, wflags )
|
: QMainWindow( parent, wflags )
|
||||||
{
|
{
|
||||||
QFrame *vb = new QFrame( this );
|
QFrame *vb = new QFrame( this );
|
||||||
@ -47,24 +38,18 @@ MDIWindow::MDIWindow( DocumentCommon* aDocument, QWidget* parent, Qt::WindowFlag
|
|||||||
setCentralWidget( vb );
|
setCentralWidget( vb );
|
||||||
|
|
||||||
myDocument = aDocument;
|
myDocument = aDocument;
|
||||||
myView = new View( myDocument->getContext(), vb, theRT );
|
myView = new View (myDocument->getContext(), vb);
|
||||||
layout->addWidget( myView );
|
layout->addWidget (myView);
|
||||||
|
|
||||||
connect( myView, SIGNAL( selectionChanged() ),
|
connect( myView, SIGNAL( selectionChanged() ),
|
||||||
this, SIGNAL( selectionChanged() ) );
|
this, SIGNAL( selectionChanged() ) );
|
||||||
createViewActions();
|
|
||||||
|
createViewActions();
|
||||||
|
createRaytraceActions();
|
||||||
|
|
||||||
resize( sizeHint() );
|
resize( sizeHint() );
|
||||||
|
|
||||||
setFocusPolicy( Qt::StrongFocus );
|
setFocusPolicy( Qt::StrongFocus );
|
||||||
|
|
||||||
#ifdef HAVE_OPENCL
|
|
||||||
|
|
||||||
myShadowsEnabled = true;
|
|
||||||
myReflectionsEnabled = true;
|
|
||||||
myAntialiasingEnabled = false;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MDIWindow::~MDIWindow()
|
MDIWindow::~MDIWindow()
|
||||||
@ -98,21 +83,34 @@ void MDIWindow::createViewActions()
|
|||||||
aList->at(View::ViewHlrOffId)->setChecked( true );
|
aList->at(View::ViewHlrOffId)->setChecked( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MDIWindow::createRaytraceActions()
|
||||||
|
{
|
||||||
|
// populate a tool bar with some actions
|
||||||
|
QToolBar* aToolBar = addToolBar( tr( "Ray-tracing Options" ) );
|
||||||
|
|
||||||
|
QList<QAction*>* aList = myView->getRaytraceActions();
|
||||||
|
aToolBar->addActions( *aList );
|
||||||
|
|
||||||
|
aToolBar->toggleViewAction()->setVisible (true);
|
||||||
|
aList->at (View::ToolRaytracingId)->setChecked (false);
|
||||||
|
aList->at (View::ToolShadowsId)->setChecked (true);
|
||||||
|
aList->at (View::ToolReflectionsId)->setChecked (true);
|
||||||
|
aList->at (View::ToolAntialiasingId)->setChecked (false);
|
||||||
|
}
|
||||||
|
|
||||||
void MDIWindow::onWindowActivated ()
|
void MDIWindow::onWindowActivated ()
|
||||||
{
|
{
|
||||||
getDocument()->getApplication()->onSelectionChanged();
|
getDocument()->getApplication()->onSelectionChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MDIWindow::dump()
|
void MDIWindow::dump()
|
||||||
{
|
{
|
||||||
|
QString datadir = (QString(qgetenv ("CASROOT").constData()) + "/../data/images");
|
||||||
QString datadir = (QString(getenv("CASROOT")) + "/../data/images");
|
|
||||||
static QString filter;
|
static QString filter;
|
||||||
filter = "Images Files (*.bmp *.ppm *.png *.jpg *.tiff *.tga *.gif *.exr *.ps *.eps *.tex *.pdf *.svg *.pgf)";
|
filter = "Images Files (*.bmp *.ppm *.png *.jpg *.tiff *.tga *.gif *.exr *.ps *.eps *.tex *.pdf *.svg *.pgf)";
|
||||||
QFileDialog fd ( 0 );
|
QFileDialog fd ( 0 );
|
||||||
fd.setModal( true );
|
fd.setModal( true );
|
||||||
fd.setFilter( filter );
|
fd.setNameFilter ( filter );
|
||||||
fd.setWindowTitle( QObject::tr("INF_APP_EXPORT") );
|
fd.setWindowTitle( QObject::tr("INF_APP_EXPORT") );
|
||||||
fd.setFileMode( QFileDialog::AnyFile );
|
fd.setFileMode( QFileDialog::AnyFile );
|
||||||
int ret = fd.exec();
|
int ret = fd.exec();
|
||||||
@ -129,6 +127,7 @@ void MDIWindow::dump()
|
|||||||
QApplication::setOverrideCursor( Qt::WaitCursor );
|
QApplication::setOverrideCursor( Qt::WaitCursor );
|
||||||
if ( !QFileInfo( file ).completeSuffix().length() )
|
if ( !QFileInfo( file ).completeSuffix().length() )
|
||||||
file += QString( ".bmp" );
|
file += QString( ".bmp" );
|
||||||
|
|
||||||
bool res = myView->dump( (Standard_CString)file.toLatin1().constData() );
|
bool res = myView->dump( (Standard_CString)file.toLatin1().constData() );
|
||||||
QApplication::restoreOverrideCursor();
|
QApplication::restoreOverrideCursor();
|
||||||
if ( !res )
|
if ( !res )
|
||||||
@ -152,27 +151,3 @@ QSize MDIWindow::sizeHint() const
|
|||||||
{
|
{
|
||||||
return QSize( 450, 300 );
|
return QSize( 450, 300 );
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_OPENCL
|
|
||||||
|
|
||||||
void MDIWindow::setRaytracedShadows( int state )
|
|
||||||
{
|
|
||||||
myView->setRaytracedShadows( state );
|
|
||||||
myShadowsEnabled = state;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MDIWindow::setRaytracedReflections( int state )
|
|
||||||
{
|
|
||||||
myView->setRaytracedReflections( state );
|
|
||||||
myReflectionsEnabled = state;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MDIWindow::setRaytracedAntialiasing( int state )
|
|
||||||
{
|
|
||||||
myView->setRaytracedAntialiasing( state );
|
|
||||||
myAntialiasingEnabled = state;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ class COMMONSAMPLE_EXPORT MDIWindow: public QMainWindow
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MDIWindow( DocumentCommon* aDocument, QWidget* parent, Qt::WindowFlags wflags, bool theRT = false );
|
MDIWindow( DocumentCommon* aDocument, QWidget* parent, Qt::WindowFlags wflags );
|
||||||
MDIWindow( View* aView, DocumentCommon* aDocument, QWidget* parent, Qt::WindowFlags wflags );
|
MDIWindow( View* aView, DocumentCommon* aDocument, QWidget* parent, Qt::WindowFlags wflags );
|
||||||
~MDIWindow();
|
~MDIWindow();
|
||||||
|
|
||||||
@ -20,18 +20,6 @@ public:
|
|||||||
void fitAll();
|
void fitAll();
|
||||||
virtual QSize sizeHint() const;
|
virtual QSize sizeHint() const;
|
||||||
|
|
||||||
#ifdef HAVE_OPENCL
|
|
||||||
|
|
||||||
void setRaytracedShadows( int state );
|
|
||||||
void setRaytracedReflections( int state );
|
|
||||||
void setRaytracedAntialiasing( int state );
|
|
||||||
|
|
||||||
bool ShadowsEnabled() { return myShadowsEnabled; }
|
|
||||||
bool ReflectionsEnabled() { return myReflectionsEnabled; }
|
|
||||||
bool AntialiasingEnabled() { return myAntialiasingEnabled; }
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void selectionChanged();
|
void selectionChanged();
|
||||||
void message(const QString&, int );
|
void message(const QString&, int );
|
||||||
@ -44,19 +32,11 @@ public slots:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void createViewActions();
|
void createViewActions();
|
||||||
|
void createRaytraceActions();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
DocumentCommon* myDocument;
|
DocumentCommon* myDocument;
|
||||||
View* myView;
|
View* myView;
|
||||||
|
|
||||||
#ifdef HAVE_OPENCL
|
|
||||||
|
|
||||||
bool myShadowsEnabled;
|
|
||||||
bool myReflectionsEnabled;
|
|
||||||
bool myAntialiasingEnabled;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -14,12 +14,13 @@
|
|||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QRubberBand>
|
#include <QRubberBand>
|
||||||
|
#include <QMdiSubWindow>
|
||||||
|
#include <QStyleFactory>
|
||||||
|
|
||||||
#include <Visual3d_View.hxx>
|
#include <Visual3d_View.hxx>
|
||||||
#include <Graphic3d_ExportFormat.hxx>
|
#include <Graphic3d_ExportFormat.hxx>
|
||||||
#include <Graphic3d_GraphicDriver.hxx>
|
#include <Graphic3d_GraphicDriver.hxx>
|
||||||
#include <Graphic3d_TextureEnv.hxx>
|
#include <Graphic3d_TextureEnv.hxx>
|
||||||
#include <QWindowsStyle>
|
|
||||||
|
|
||||||
#if defined(_WIN32) || defined(__WIN32__)
|
#if defined(_WIN32) || defined(__WIN32__)
|
||||||
#include <WNT_Window.hxx>
|
#include <WNT_Window.hxx>
|
||||||
@ -54,10 +55,14 @@ static QCursor* globPanCursor = NULL;
|
|||||||
static QCursor* zoomCursor = NULL;
|
static QCursor* zoomCursor = NULL;
|
||||||
static QCursor* rotCursor = NULL;
|
static QCursor* rotCursor = NULL;
|
||||||
|
|
||||||
View::View( Handle(AIS_InteractiveContext) theContext, QWidget* parent, bool theRT )
|
View::View( Handle(AIS_InteractiveContext) theContext, QWidget* parent )
|
||||||
: QWidget( parent ),
|
: QWidget( parent ),
|
||||||
myIsRT( theRT ),
|
myIsRaytracing( false ),
|
||||||
|
myIsShadowsEnabled (true),
|
||||||
|
myIsReflectionsEnabled (true),
|
||||||
|
myIsAntialiasingEnabled (false),
|
||||||
myViewActions( 0 ),
|
myViewActions( 0 ),
|
||||||
|
myRaytraceActions( 0 ),
|
||||||
myBackMenu( NULL )
|
myBackMenu( NULL )
|
||||||
{
|
{
|
||||||
#if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
|
#if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
|
||||||
@ -77,7 +82,7 @@ myBackMenu( NULL )
|
|||||||
myCurZoom = 0;
|
myCurZoom = 0;
|
||||||
myRectBand = 0;
|
myRectBand = 0;
|
||||||
|
|
||||||
setAttribute(Qt::WA_PaintOnScreen);
|
setAttribute(Qt::WA_PaintOnScreen);
|
||||||
setAttribute(Qt::WA_NoSystemBackground);
|
setAttribute(Qt::WA_NoSystemBackground);
|
||||||
|
|
||||||
#if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
|
#if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
|
||||||
@ -153,7 +158,12 @@ myBackMenu( NULL )
|
|||||||
myCurrentMode = CurAction3d_Nothing;
|
myCurrentMode = CurAction3d_Nothing;
|
||||||
myHlrModeIsOn = Standard_False;
|
myHlrModeIsOn = Standard_False;
|
||||||
setMouseTracking( true );
|
setMouseTracking( true );
|
||||||
|
|
||||||
|
if( myFirst )
|
||||||
|
{
|
||||||
|
init();
|
||||||
|
myFirst = false;
|
||||||
|
}
|
||||||
initViewActions();
|
initViewActions();
|
||||||
initCursors();
|
initCursors();
|
||||||
|
|
||||||
@ -172,8 +182,9 @@ View::~View()
|
|||||||
|
|
||||||
void View::init()
|
void View::init()
|
||||||
{
|
{
|
||||||
if (myView.IsNull())
|
if ( myView.IsNull() )
|
||||||
myView = myContext->CurrentViewer()->CreateView();
|
myView = myContext->CurrentViewer()->CreateView();
|
||||||
|
|
||||||
#if defined(_WIN32) || defined(__WIN32__)
|
#if defined(_WIN32) || defined(__WIN32__)
|
||||||
Aspect_Handle aWindowHandle = (Aspect_Handle )winId();
|
Aspect_Handle aWindowHandle = (Aspect_Handle )winId();
|
||||||
Handle(WNT_Window) hWnd = new WNT_Window (aWindowHandle);
|
Handle(WNT_Window) hWnd = new WNT_Window (aWindowHandle);
|
||||||
@ -185,15 +196,16 @@ void View::init()
|
|||||||
Handle(Aspect_DisplayConnection) aDispConnection = myContext->CurrentViewer()->Driver()->GetDisplayConnection();
|
Handle(Aspect_DisplayConnection) aDispConnection = myContext->CurrentViewer()->Driver()->GetDisplayConnection();
|
||||||
Handle(Xw_Window) hWnd = new Xw_Window (aDispConnection, aWindowHandle);
|
Handle(Xw_Window) hWnd = new Xw_Window (aDispConnection, aWindowHandle);
|
||||||
#endif // WNT
|
#endif // WNT
|
||||||
|
|
||||||
myView->SetWindow (hWnd);
|
myView->SetWindow (hWnd);
|
||||||
if (!hWnd->IsMapped())
|
if ( !hWnd->IsMapped() )
|
||||||
{
|
{
|
||||||
hWnd->Map();
|
hWnd->Map();
|
||||||
}
|
}
|
||||||
myView->SetBackgroundColor (Quantity_NOC_BLACK);
|
myView->SetBackgroundColor (Quantity_NOC_BLACK);
|
||||||
myView->MustBeResized();
|
myView->MustBeResized();
|
||||||
|
|
||||||
if (myIsRT)
|
if (myIsRaytracing)
|
||||||
myView->SetRaytracingMode();
|
myView->SetRaytracingMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -310,28 +322,95 @@ void View::hlrOn()
|
|||||||
QApplication::restoreOverrideCursor();
|
QApplication::restoreOverrideCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void View::setRaytracedShadows( int state )
|
void View::SetRaytracedShadows (bool theState)
|
||||||
{
|
{
|
||||||
if ( state )
|
if (theState)
|
||||||
myView->EnableRaytracedShadows();
|
myView->EnableRaytracedShadows();
|
||||||
else
|
else
|
||||||
myView->DisableRaytracedShadows();
|
myView->DisableRaytracedShadows();
|
||||||
|
|
||||||
|
myIsShadowsEnabled = theState;
|
||||||
|
|
||||||
|
myContext->UpdateCurrentViewer();
|
||||||
}
|
}
|
||||||
|
|
||||||
void View::setRaytracedReflections( int state )
|
void View::SetRaytracedReflections (bool theState)
|
||||||
{
|
{
|
||||||
if ( state )
|
if (theState)
|
||||||
myView->EnableRaytracedReflections();
|
myView->EnableRaytracedReflections();
|
||||||
else
|
else
|
||||||
myView->DisableRaytracedReflections();
|
myView->DisableRaytracedReflections();
|
||||||
|
|
||||||
|
myIsReflectionsEnabled = theState;
|
||||||
|
|
||||||
|
myContext->UpdateCurrentViewer();
|
||||||
}
|
}
|
||||||
|
|
||||||
void View::setRaytracedAntialiasing( int state )
|
void View::onRaytraceAction()
|
||||||
{
|
{
|
||||||
if ( state )
|
QAction* aSentBy = (QAction*)sender();
|
||||||
|
|
||||||
|
if (aSentBy == myRaytraceActions->at (ToolRaytracingId))
|
||||||
|
{
|
||||||
|
bool aState = myRaytraceActions->at (ToolRaytracingId)->isChecked();
|
||||||
|
|
||||||
|
QApplication::setOverrideCursor (Qt::WaitCursor);
|
||||||
|
if (aState)
|
||||||
|
EnableRaytracing();
|
||||||
|
else
|
||||||
|
DisableRaytracing();
|
||||||
|
QApplication::restoreOverrideCursor();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aSentBy == myRaytraceActions->at (ToolShadowsId))
|
||||||
|
{
|
||||||
|
bool aState = myRaytraceActions->at (ToolShadowsId)->isChecked();
|
||||||
|
SetRaytracedShadows (aState);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aSentBy == myRaytraceActions->at (ToolReflectionsId))
|
||||||
|
{
|
||||||
|
bool aState = myRaytraceActions->at (ToolReflectionsId)->isChecked();
|
||||||
|
SetRaytracedReflections (aState);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aSentBy == myRaytraceActions->at (ToolAntialiasingId))
|
||||||
|
{
|
||||||
|
bool aState = myRaytraceActions->at (ToolAntialiasingId)->isChecked();
|
||||||
|
SetRaytracedAntialiasing (aState);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void View::SetRaytracedAntialiasing (bool theState)
|
||||||
|
{
|
||||||
|
if (theState)
|
||||||
myView->EnableRaytracedAntialiasing();
|
myView->EnableRaytracedAntialiasing();
|
||||||
else
|
else
|
||||||
myView->DisableRaytracedAntialiasing();
|
myView->DisableRaytracedAntialiasing();
|
||||||
|
|
||||||
|
myIsAntialiasingEnabled = theState;
|
||||||
|
|
||||||
|
myContext->UpdateCurrentViewer();
|
||||||
|
}
|
||||||
|
|
||||||
|
void View::EnableRaytracing()
|
||||||
|
{
|
||||||
|
if (!myIsRaytracing)
|
||||||
|
myView->SetRaytracingMode();
|
||||||
|
|
||||||
|
myIsRaytracing = true;
|
||||||
|
|
||||||
|
myContext->UpdateCurrentViewer();
|
||||||
|
}
|
||||||
|
|
||||||
|
void View::DisableRaytracing()
|
||||||
|
{
|
||||||
|
if (myIsRaytracing)
|
||||||
|
myView->SetRasterizationMode();
|
||||||
|
|
||||||
|
myIsRaytracing = false;
|
||||||
|
|
||||||
|
myContext->UpdateCurrentViewer();
|
||||||
}
|
}
|
||||||
|
|
||||||
void View::updateToggled( bool isOn )
|
void View::updateToggled( bool isOn )
|
||||||
@ -398,6 +477,12 @@ QList<QAction*>* View::getViewActions()
|
|||||||
return myViewActions;
|
return myViewActions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QList<QAction*>* View::getRaytraceActions()
|
||||||
|
{
|
||||||
|
initRaytraceActions();
|
||||||
|
return myRaytraceActions;
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Get paint engine for the OpenGL viewer. [ virtual public ]
|
Get paint engine for the OpenGL viewer. [ virtual public ]
|
||||||
*/
|
*/
|
||||||
@ -533,6 +618,48 @@ void View::initViewActions()
|
|||||||
myViewActions->insert( ViewHlrOnId, a );
|
myViewActions->insert( ViewHlrOnId, a );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void View::initRaytraceActions()
|
||||||
|
{
|
||||||
|
if ( myRaytraceActions )
|
||||||
|
return;
|
||||||
|
|
||||||
|
myRaytraceActions = new QList<QAction*>();
|
||||||
|
QString dir = ApplicationCommonWindow::getResourceDir() + QString( "/" );
|
||||||
|
QAction* a;
|
||||||
|
|
||||||
|
a = new QAction( QPixmap( dir+QObject::tr("ICON_TOOL_RAYTRACING") ), QObject::tr("MNU_TOOL_RAYTRACING"), this );
|
||||||
|
a->setToolTip( QObject::tr("TBR_TOOL_RAYTRACING") );
|
||||||
|
a->setStatusTip( QObject::tr("TBR_TOOL_RAYTRACING") );
|
||||||
|
a->setCheckable( true );
|
||||||
|
a->setChecked( false );
|
||||||
|
connect( a, SIGNAL( activated() ) , this, SLOT( onRaytraceAction() ) );
|
||||||
|
myRaytraceActions->insert( ToolRaytracingId, a );
|
||||||
|
|
||||||
|
a = new QAction( QPixmap( dir+QObject::tr("ICON_TOOL_SHADOWS") ), QObject::tr("MNU_TOOL_SHADOWS"), this );
|
||||||
|
a->setToolTip( QObject::tr("TBR_TOOL_SHADOWS") );
|
||||||
|
a->setStatusTip( QObject::tr("TBR_TOOL_SHADOWS") );
|
||||||
|
a->setCheckable( true );
|
||||||
|
a->setChecked( true );
|
||||||
|
connect( a, SIGNAL( activated() ) , this, SLOT( onRaytraceAction() ) );
|
||||||
|
myRaytraceActions->insert( ToolShadowsId, a );
|
||||||
|
|
||||||
|
a = new QAction( QPixmap( dir+QObject::tr("ICON_TOOL_REFLECTIONS") ), QObject::tr("MNU_TOOL_REFLECTIONS"), this );
|
||||||
|
a->setToolTip( QObject::tr("TBR_TOOL_REFLECTIONS") );
|
||||||
|
a->setStatusTip( QObject::tr("TBR_TOOL_REFLECTIONS") );
|
||||||
|
a->setCheckable( true );
|
||||||
|
a->setChecked( true );
|
||||||
|
connect( a, SIGNAL( activated() ) , this, SLOT( onRaytraceAction() ) );
|
||||||
|
myRaytraceActions->insert( ToolReflectionsId, a );
|
||||||
|
|
||||||
|
a = new QAction( QPixmap( dir+QObject::tr("ICON_TOOL_ANTIALIASING") ), QObject::tr("MNU_TOOL_ANTIALIASING"), this );
|
||||||
|
a->setToolTip( QObject::tr("TBR_TOOL_ANTIALIASING") );
|
||||||
|
a->setStatusTip( QObject::tr("TBR_TOOL_ANTIALIASING") );
|
||||||
|
a->setCheckable( true );
|
||||||
|
a->setChecked( false );
|
||||||
|
connect( a, SIGNAL( activated() ) , this, SLOT( onRaytraceAction() ) );
|
||||||
|
myRaytraceActions->insert( ToolAntialiasingId, a );
|
||||||
|
}
|
||||||
|
|
||||||
void View::mousePressEvent( QMouseEvent* e )
|
void View::mousePressEvent( QMouseEvent* e )
|
||||||
{
|
{
|
||||||
if ( e->button() == Qt::LeftButton )
|
if ( e->button() == Qt::LeftButton )
|
||||||
@ -855,8 +982,8 @@ void View::MultiInputEvent( const int /*x*/, const int /*y*/ )
|
|||||||
void View::Popup( const int /*x*/, const int /*y*/ )
|
void View::Popup( const int /*x*/, const int /*y*/ )
|
||||||
{
|
{
|
||||||
ApplicationCommonWindow* stApp = ApplicationCommonWindow::getApplication();
|
ApplicationCommonWindow* stApp = ApplicationCommonWindow::getApplication();
|
||||||
QWorkspace* ws = ApplicationCommonWindow::getWorkspace();
|
QMdiArea* ws = ApplicationCommonWindow::getWorkspace();
|
||||||
QWidget* w = ws->activeWindow();
|
QMdiSubWindow* w = ws->activeSubWindow();
|
||||||
if ( myContext->NbSelected() )
|
if ( myContext->NbSelected() )
|
||||||
{
|
{
|
||||||
QList<QAction*>* aList = stApp->getToolActions();
|
QList<QAction*>* aList = stApp->getToolActions();
|
||||||
@ -928,7 +1055,7 @@ void View::DrawRectangle(const int MinX, const int MinY,
|
|||||||
if ( !myRectBand )
|
if ( !myRectBand )
|
||||||
{
|
{
|
||||||
myRectBand = new QRubberBand( QRubberBand::Rectangle, this );
|
myRectBand = new QRubberBand( QRubberBand::Rectangle, this );
|
||||||
myRectBand->setStyle(new QWindowsStyle);
|
myRectBand->setStyle( QStyleFactory::create("windows") );
|
||||||
myRectBand->setGeometry( aRect );
|
myRectBand->setGeometry( aRect );
|
||||||
myRectBand->show();
|
myRectBand->show();
|
||||||
|
|
||||||
@ -1000,7 +1127,7 @@ void View::onEnvironmentMap()
|
|||||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"), "",
|
QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"), "",
|
||||||
tr("All Image Files (*.bmp *.gif *.jpg *.jpeg *.png *.tga)"));
|
tr("All Image Files (*.bmp *.gif *.jpg *.jpeg *.png *.tga)"));
|
||||||
|
|
||||||
Handle(Graphic3d_TextureEnv) aTexture = new Graphic3d_TextureEnv( fileName.toAscii().data() );
|
Handle(Graphic3d_TextureEnv) aTexture = new Graphic3d_TextureEnv( fileName.toLatin1().data() );
|
||||||
|
|
||||||
myView->SetTextureEnv (aTexture);
|
myView->SetTextureEnv (aTexture);
|
||||||
myView->SetSurfaceDetail (V3d_TEX_ENVIRONMENT);
|
myView->SetSurfaceDetail (V3d_TEX_ENVIRONMENT);
|
||||||
|
@ -24,22 +24,30 @@ public:
|
|||||||
enum ViewAction { ViewFitAllId, ViewFitAreaId, ViewZoomId, ViewPanId, ViewGlobalPanId,
|
enum ViewAction { ViewFitAllId, ViewFitAreaId, ViewZoomId, ViewPanId, ViewGlobalPanId,
|
||||||
ViewFrontId, ViewBackId, ViewTopId, ViewBottomId, ViewLeftId, ViewRightId,
|
ViewFrontId, ViewBackId, ViewTopId, ViewBottomId, ViewLeftId, ViewRightId,
|
||||||
ViewAxoId, ViewRotationId, ViewResetId, ViewHlrOffId, ViewHlrOnId };
|
ViewAxoId, ViewRotationId, ViewResetId, ViewHlrOffId, ViewHlrOnId };
|
||||||
|
enum RaytraceAction { ToolRaytracingId, ToolShadowsId, ToolReflectionsId, ToolAntialiasingId };
|
||||||
|
|
||||||
View( Handle(AIS_InteractiveContext) theContext,
|
View( Handle(AIS_InteractiveContext) theContext, QWidget* parent );
|
||||||
QWidget* parent,
|
|
||||||
bool theRT = false );
|
|
||||||
|
|
||||||
~View();
|
~View();
|
||||||
|
|
||||||
virtual void init();
|
virtual void init();
|
||||||
bool dump( Standard_CString theFile );
|
bool dump( Standard_CString theFile );
|
||||||
QList<QAction*>* getViewActions();
|
QList<QAction*>* getViewActions();
|
||||||
|
QList<QAction*>* getRaytraceActions();
|
||||||
void noActiveActions();
|
void noActiveActions();
|
||||||
bool isShadingMode();
|
bool isShadingMode();
|
||||||
|
|
||||||
void setRaytracedShadows( int state );
|
void EnableRaytracing();
|
||||||
void setRaytracedReflections( int state );
|
void DisableRaytracing();
|
||||||
void setRaytracedAntialiasing( int state );
|
|
||||||
|
void SetRaytracedShadows (bool theState);
|
||||||
|
void SetRaytracedReflections (bool theState);
|
||||||
|
void SetRaytracedAntialiasing (bool theState);
|
||||||
|
|
||||||
|
bool IsRaytracingMode() const { return myIsRaytracing; }
|
||||||
|
bool IsShadowsEnabled() const { return myIsShadowsEnabled; }
|
||||||
|
bool IsReflectionsEnabled() const { return myIsReflectionsEnabled; }
|
||||||
|
bool IsAntialiasingEnabled() const { return myIsAntialiasingEnabled; }
|
||||||
|
|
||||||
static QString GetMessages( int type,TopAbs_ShapeEnum aSubShapeType,
|
static QString GetMessages( int type,TopAbs_ShapeEnum aSubShapeType,
|
||||||
TopAbs_ShapeEnum aShapeType );
|
TopAbs_ShapeEnum aShapeType );
|
||||||
@ -77,6 +85,7 @@ public slots:
|
|||||||
void updateToggled( bool );
|
void updateToggled( bool );
|
||||||
void onBackground();
|
void onBackground();
|
||||||
void onEnvironmentMap();
|
void onEnvironmentMap();
|
||||||
|
void onRaytraceAction();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void paintEvent( QPaintEvent* );
|
virtual void paintEvent( QPaintEvent* );
|
||||||
@ -104,6 +113,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
void initCursors();
|
void initCursors();
|
||||||
void initViewActions();
|
void initViewActions();
|
||||||
|
void initRaytraceActions();
|
||||||
void DragEvent( const int x, const int y, const int TheState );
|
void DragEvent( const int x, const int y, const int TheState );
|
||||||
void InputEvent( const int x, const int y );
|
void InputEvent( const int x, const int y );
|
||||||
void MoveEvent( const int x, const int y );
|
void MoveEvent( const int x, const int y );
|
||||||
@ -114,7 +124,11 @@ private:
|
|||||||
const int MaxX, const int MaxY, const bool Draw );
|
const int MaxX, const int MaxY, const bool Draw );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool myIsRT;
|
bool myIsRaytracing;
|
||||||
|
bool myIsShadowsEnabled;
|
||||||
|
bool myIsReflectionsEnabled;
|
||||||
|
bool myIsAntialiasingEnabled;
|
||||||
|
|
||||||
bool myFirst;
|
bool myFirst;
|
||||||
bool myDrawRect; // set when a rect is used for selection or magnify
|
bool myDrawRect; // set when a rect is used for selection or magnify
|
||||||
Handle(V3d_View) myView;
|
Handle(V3d_View) myView;
|
||||||
@ -127,6 +141,7 @@ private:
|
|||||||
Quantity_Factor myCurZoom;
|
Quantity_Factor myCurZoom;
|
||||||
Standard_Boolean myHlrModeIsOn;
|
Standard_Boolean myHlrModeIsOn;
|
||||||
QList<QAction*>* myViewActions;
|
QList<QAction*>* myViewActions;
|
||||||
|
QList<QAction*>* myRaytraceActions;
|
||||||
QMenu* myBackMenu;
|
QMenu* myBackMenu;
|
||||||
QRubberBand* myRectBand; //!< selection rectangle rubber band
|
QRubberBand* myRectBand; //!< selection rectangle rubber band
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||||
# Visual Studio 2010
|
# Visual Studio 2010
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IESample", "IESample.vcxproj", "{7FD0453F-8AC0-3EE3-9C11-DD413EF20A44}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IESample", "IESample.vcxproj", "{7972FDD8-9612-3401-827F-C8DF8E2689B5}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@ -8,12 +8,12 @@ Global
|
|||||||
Release|Win32 = Release|Win32
|
Release|Win32 = Release|Win32
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{7FD0453F-8AC0-3EE3-9C11-DD413EF20A44}.Debug|Win32.ActiveCfg = Debug|Win32
|
{7972FDD8-9612-3401-827F-C8DF8E2689B5}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
{7FD0453F-8AC0-3EE3-9C11-DD413EF20A44}.Debug|Win32.Build.0 = Debug|Win32
|
{7972FDD8-9612-3401-827F-C8DF8E2689B5}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
{7FD0453F-8AC0-3EE3-9C11-DD413EF20A44}.Release|Win32.ActiveCfg = Release|Win32
|
{7972FDD8-9612-3401-827F-C8DF8E2689B5}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
{7FD0453F-8AC0-3EE3-9C11-DD413EF20A44}.Release|Win32.Build.0 = Release|Win32
|
{7972FDD8-9612-3401-827F-C8DF8E2689B5}.Release|Win32.Build.0 = Release|Win32
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||||
# Visual Studio 2008
|
# Visual Studio 2008
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IESample", "IESample.vcproj", "{7FD0453F-8AC0-3EE3-9C11-DD413EF20A44}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IESample", "IESample.vcproj", "{AD4DADCB-F15E-37FD-B3AA-88504FAAF4FD}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@ -8,10 +8,10 @@ Global
|
|||||||
Release|Win32 = Release|Win32
|
Release|Win32 = Release|Win32
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{7FD0453F-8AC0-3EE3-9C11-DD413EF20A44}.Debug|Win32.ActiveCfg = Debug|Win32
|
{AD4DADCB-F15E-37FD-B3AA-88504FAAF4FD}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
{7FD0453F-8AC0-3EE3-9C11-DD413EF20A44}.Debug|Win32.Build.0 = Debug|Win32
|
{AD4DADCB-F15E-37FD-B3AA-88504FAAF4FD}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
{7FD0453F-8AC0-3EE3-9C11-DD413EF20A44}.Release|Win32.ActiveCfg = Release|Win32
|
{AD4DADCB-F15E-37FD-B3AA-88504FAAF4FD}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
{7FD0453F-8AC0-3EE3-9C11-DD413EF20A44}.Release|Win32.Build.0 = Release|Win32
|
{AD4DADCB-F15E-37FD-B3AA-88504FAAF4FD}.Release|Win32.Build.0 = Release|Win32
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@ -3,10 +3,9 @@ CONFIG += debug_and_release qt
|
|||||||
|
|
||||||
TARGET = IESample
|
TARGET = IESample
|
||||||
|
|
||||||
SAMPLESROOT = $$(CASROOT)/samples/qt
|
SAMPLESROOT = $$(SAMPLESROOT)
|
||||||
|
|
||||||
HEADERS = src/*.h \
|
HEADERS = $${SAMPLESROOT}/Common/src/*.h \
|
||||||
$${SAMPLESROOT}/Common/src/*.h \
|
|
||||||
$${SAMPLESROOT}/Interface/src/*.h
|
$${SAMPLESROOT}/Interface/src/*.h
|
||||||
|
|
||||||
SOURCES = src/*.cxx \
|
SOURCES = src/*.cxx \
|
||||||
@ -24,7 +23,9 @@ RES_DIR = $$quote($$(RES_DIR))
|
|||||||
INCLUDEPATH += $$quote($${SAMPLESROOT}/Common/src)
|
INCLUDEPATH += $$quote($${SAMPLESROOT}/Common/src)
|
||||||
INCLUDEPATH += $$quote($${SAMPLESROOT}/Interface/src)
|
INCLUDEPATH += $$quote($${SAMPLESROOT}/Interface/src)
|
||||||
|
|
||||||
DEFINES = CSFDB
|
OCCT_DEFINES = $$(CSF_DEFINES)
|
||||||
|
|
||||||
|
DEFINES = CSFDB $$split(OCCT_DEFINES, ;)
|
||||||
|
|
||||||
unix {
|
unix {
|
||||||
UNAME = $$system(uname -s)
|
UNAME = $$system(uname -s)
|
||||||
@ -38,11 +39,11 @@ unix {
|
|||||||
CONFIG(debug, debug|release) {
|
CONFIG(debug, debug|release) {
|
||||||
DESTDIR = ./$$UNAME/bind
|
DESTDIR = ./$$UNAME/bind
|
||||||
OBJECTS_DIR = ./$$UNAME/objd
|
OBJECTS_DIR = ./$$UNAME/objd
|
||||||
MOC_DIR = ./$$UNAME/srcd
|
MOC_DIR = ./$$UNAME/mocd
|
||||||
} else {
|
} else {
|
||||||
DESTDIR = ./$$UNAME/bin
|
DESTDIR = ./$$UNAME/bin
|
||||||
OBJECTS_DIR = ./$$UNAME/obj
|
OBJECTS_DIR = ./$$UNAME/obj
|
||||||
MOC_DIR = ./$$UNAME/src
|
MOC_DIR = ./$$UNAME/moc
|
||||||
}
|
}
|
||||||
|
|
||||||
MACOSX_USE_GLX = $$(MACOSX_USE_GLX)
|
MACOSX_USE_GLX = $$(MACOSX_USE_GLX)
|
||||||
@ -63,107 +64,23 @@ win32 {
|
|||||||
|
|
||||||
CONFIG(debug, debug|release) {
|
CONFIG(debug, debug|release) {
|
||||||
DEFINES += _DEBUG
|
DEFINES += _DEBUG
|
||||||
|
DESTDIR = ./win$(ARCH)/$(VCVER)/bind
|
||||||
|
OBJECTS_DIR = ./win$(ARCH)/$(VCVER)/objd
|
||||||
|
MOC_DIR = ./win$(ARCH)/$(VCVER)/mocd
|
||||||
!contains(QMAKE_HOST.arch, x86_64) {
|
!contains(QMAKE_HOST.arch, x86_64) {
|
||||||
LIBS = -L$(CSF_OPT_LIB32D)
|
LIBS = -L$(CSF_OPT_LIB32D)
|
||||||
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1310) {
|
|
||||||
DESTDIR = ./win32/vc7/bind
|
|
||||||
OBJECTS_DIR = ./win32/vc7/objd
|
|
||||||
MOC_DIR = ./win32/vc7/srcd
|
|
||||||
}
|
|
||||||
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1400) {
|
|
||||||
DESTDIR = ./win32/vc8/bind
|
|
||||||
OBJECTS_DIR = ./win32/vc8/objd
|
|
||||||
MOC_DIR = ./win32/vc8/srcd
|
|
||||||
}
|
|
||||||
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1500) {
|
|
||||||
DESTDIR = ./win32/vc9/bind
|
|
||||||
OBJECTS_DIR = ./win32/vc9/objd
|
|
||||||
MOC_DIR = ./win32/vc9/srcd
|
|
||||||
}
|
|
||||||
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1600) {
|
|
||||||
DESTDIR = ./win32/vc10/bind
|
|
||||||
OBJECTS_DIR = ./win32/vc10/objd
|
|
||||||
MOC_DIR = ./win32/vc10/srcd
|
|
||||||
}
|
|
||||||
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1700) {
|
|
||||||
DESTDIR = ./win32/vc11/bind
|
|
||||||
OBJECTS_DIR = ./win32/vc11/objd
|
|
||||||
MOC_DIR = ./win32/vc11/srcd
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
LIBS = -L$(CSF_OPT_LIB64D)
|
LIBS = -L$(CSF_OPT_LIB64D)
|
||||||
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1400) {
|
|
||||||
DESTDIR = ./win64/vc8/bind
|
|
||||||
OBJECTS_DIR = ./win64/vc8/objd
|
|
||||||
MOC_DIR = ./win64/vc8/srcd
|
|
||||||
}
|
|
||||||
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1500) {
|
|
||||||
DESTDIR = ./win64/vc9/bind
|
|
||||||
OBJECTS_DIR = ./win64/vc9/objd
|
|
||||||
MOC_DIR = ./win64/vc9/srcd
|
|
||||||
}
|
|
||||||
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1600) {
|
|
||||||
DESTDIR = ./win64/vc10/bind
|
|
||||||
OBJECTS_DIR = ./win64/vc10/objd
|
|
||||||
MOC_DIR = ./win64/vc10/srcd
|
|
||||||
}
|
|
||||||
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1700) {
|
|
||||||
DESTDIR = ./win64/vc11/bind
|
|
||||||
OBJECTS_DIR = ./win64/vc11/objd
|
|
||||||
MOC_DIR = ./win64/vc11/srcd
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
DEFINES += NDEBUG
|
DEFINES += NDEBUG
|
||||||
|
DESTDIR = ./win$(ARCH)/$(VCVER)/bin
|
||||||
|
OBJECTS_DIR = ./win$(ARCH)/$(VCVER)/obj
|
||||||
|
MOC_DIR = ./win$(ARCH)/$(VCVER)/moc
|
||||||
!contains(QMAKE_HOST.arch, x86_64) {
|
!contains(QMAKE_HOST.arch, x86_64) {
|
||||||
LIBS = -L$(CSF_OPT_LIB32)
|
LIBS = -L$(CSF_OPT_LIB32)
|
||||||
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1310) {
|
|
||||||
DESTDIR = ./win32/vc7/bin
|
|
||||||
OBJECTS_DIR = ./win32/vc7/obj
|
|
||||||
MOC_DIR = ./win32/vc7/src
|
|
||||||
}
|
|
||||||
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1400) {
|
|
||||||
DESTDIR = ./win32/vc8/bin
|
|
||||||
OBJECTS_DIR = ./win32/vc8/obj
|
|
||||||
MOC_DIR = ./win32/vc8/src
|
|
||||||
}
|
|
||||||
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1500) {
|
|
||||||
DESTDIR = ./win32/vc9/bin
|
|
||||||
OBJECTS_DIR = ./win32/vc9/obj
|
|
||||||
MOC_DIR = ./win32/vc9/src
|
|
||||||
}
|
|
||||||
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1600) {
|
|
||||||
DESTDIR = ./win32/vc10/bin
|
|
||||||
OBJECTS_DIR = ./win32/vc10/obj
|
|
||||||
MOC_DIR = ./win32/vc10/src
|
|
||||||
}
|
|
||||||
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1700) {
|
|
||||||
DESTDIR = ./win32/vc11/bin
|
|
||||||
OBJECTS_DIR = ./win32/vc11/obj
|
|
||||||
MOC_DIR = ./win32/vc11/src
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
LIBS = -L$(CSF_OPT_LIB64)
|
LIBS = -L$(CSF_OPT_LIB64)
|
||||||
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1400) {
|
|
||||||
DESTDIR = ./win64/vc8/bin
|
|
||||||
OBJECTS_DIR = ./win64/vc8/obj
|
|
||||||
MOC_DIR = ./win64/vc8/src
|
|
||||||
}
|
|
||||||
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1500) {
|
|
||||||
DESTDIR = ./win64/vc9/bin
|
|
||||||
OBJECTS_DIR = ./win64/vc9/obj
|
|
||||||
MOC_DIR = ./win64/vc9/src
|
|
||||||
}
|
|
||||||
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1600) {
|
|
||||||
DESTDIR = ./win64/vc10/bin
|
|
||||||
OBJECTS_DIR = ./win64/vc10/obj
|
|
||||||
MOC_DIR = ./win64/vc10/src
|
|
||||||
}
|
|
||||||
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1700) {
|
|
||||||
DESTDIR = ./win64/vc11/bin
|
|
||||||
OBJECTS_DIR = ./win64/vc11/obj
|
|
||||||
MOC_DIR = ./win64/vc11/src
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DEFINES +=WNT WIN32 NO_COMMONSAMPLE_EXPORTS NO_IESAMPLE_EXPORTS
|
DEFINES +=WNT WIN32 NO_COMMONSAMPLE_EXPORTS NO_IESAMPLE_EXPORTS
|
||||||
@ -199,3 +116,8 @@ copy_res.CONFIG += no_link target_predeps
|
|||||||
win32: copy_res.commands = type ${QMAKE_FILE_IN} > $${RES_DIR}/${QMAKE_FILE_BASE}${QMAKE_FILE_EXT}
|
win32: copy_res.commands = type ${QMAKE_FILE_IN} > $${RES_DIR}/${QMAKE_FILE_BASE}${QMAKE_FILE_EXT}
|
||||||
unix: copy_res.commands = cp -f ${QMAKE_FILE_IN} $${RES_DIR}
|
unix: copy_res.commands = cp -f ${QMAKE_FILE_IN} $${RES_DIR}
|
||||||
QMAKE_EXTRA_COMPILERS += copy_res
|
QMAKE_EXTRA_COMPILERS += copy_res
|
||||||
|
#QMAKE_CXXFLAGS += /wd4996
|
||||||
|
|
||||||
|
greaterThan(QT_MAJOR_VERSION, 4) {
|
||||||
|
QT += widgets
|
||||||
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
call "%~dp0..\..\..\env.bat" %1 %2 %3
|
call "%~dp0..\..\..\env.bat" %1 %2 %3
|
||||||
|
|
||||||
|
SET "SAMPLESROOT=%~dp0.."
|
||||||
SET "RES_DIR=%~dp0win%ARCH%\%VCVER%\res"
|
SET "RES_DIR=%~dp0win%ARCH%\%VCVER%\res"
|
||||||
SET "CSF_ResourcesDefaults=%RES_DIR%"
|
SET "CSF_ResourcesDefaults=%RES_DIR%"
|
||||||
SET "CSF_IEResourcesDefaults=%RES_DIR%"
|
SET "CSF_IEResourcesDefaults=%RES_DIR%"
|
||||||
|
@ -7,6 +7,8 @@ REM third argument specifies Debug or Release mode
|
|||||||
|
|
||||||
call "%~dp0env.bat" %1 %2 %3
|
call "%~dp0env.bat" %1 %2 %3
|
||||||
|
|
||||||
|
set EXT=vcproj
|
||||||
|
|
||||||
if not "%1" == "" (
|
if not "%1" == "" (
|
||||||
if /I "%1" == "vc8" (
|
if /I "%1" == "vc8" (
|
||||||
set VCVER=vc8
|
set VCVER=vc8
|
||||||
@ -16,9 +18,11 @@ if not "%1" == "" (
|
|||||||
set "VCVARS=%VS90COMNTOOLS%..\..\VC\vcvarsall.bat"
|
set "VCVARS=%VS90COMNTOOLS%..\..\VC\vcvarsall.bat"
|
||||||
) else if /I "%1" == "vc10" (
|
) else if /I "%1" == "vc10" (
|
||||||
set VCVER=vc10
|
set VCVER=vc10
|
||||||
|
set EXT=vcxproj
|
||||||
set "VCVARS=%VS100COMNTOOLS%..\..\VC\vcvarsall.bat"
|
set "VCVARS=%VS100COMNTOOLS%..\..\VC\vcvarsall.bat"
|
||||||
) else if /I "%1" == "vc11" (
|
) else if /I "%1" == "vc11" (
|
||||||
set VCVER=vc11
|
set VCVER=vc11
|
||||||
|
set EXT=vcxproj
|
||||||
set "VCVARS=%VS110COMNTOOLS%..\..\VC\vcvarsall.bat"
|
set "VCVARS=%VS110COMNTOOLS%..\..\VC\vcvarsall.bat"
|
||||||
) else (
|
) else (
|
||||||
echo Error: first argument ^(%1^) should specify supported version of Visual C++,
|
echo Error: first argument ^(%1^) should specify supported version of Visual C++,
|
||||||
@ -32,4 +36,4 @@ if ["%ARCH%"] == ["64"] set VCARCH=amd64
|
|||||||
|
|
||||||
call "%VCVARS%" %VCARCH%
|
call "%VCVARS%" %VCARCH%
|
||||||
|
|
||||||
qmake -tp vc -r IESample.pro
|
qmake -tp vc -o IESample.%EXT% IESample.pro
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <QMdiSubWindow>
|
||||||
|
|
||||||
ApplicationWindow::ApplicationWindow()
|
ApplicationWindow::ApplicationWindow()
|
||||||
: ApplicationCommonWindow( ),
|
: ApplicationCommonWindow( ),
|
||||||
@ -96,7 +97,7 @@ void ApplicationWindow::createTranslatePopups()
|
|||||||
|
|
||||||
void ApplicationWindow::updateFileActions()
|
void ApplicationWindow::updateFileActions()
|
||||||
{
|
{
|
||||||
if ( getWorkspace()->windowList().isEmpty() )
|
if ( myDocuments.isEmpty() )
|
||||||
{
|
{
|
||||||
if ( !isDocument() )
|
if ( !isDocument() )
|
||||||
{
|
{
|
||||||
@ -124,7 +125,7 @@ void ApplicationWindow::onImport()
|
|||||||
bool stat = translate( type, true );
|
bool stat = translate( type, true );
|
||||||
if ( stat )
|
if ( stat )
|
||||||
{
|
{
|
||||||
DocumentCommon* doc = ((MDIWindow*) getWorkspace()->activeWindow())->getDocument();
|
DocumentCommon* doc = qobject_cast<MDIWindow*>( getWorkspace()->activeSubWindow()->widget() )->getDocument();
|
||||||
doc->fitAll();
|
doc->fitAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -136,7 +137,7 @@ void ApplicationWindow::onExport()
|
|||||||
if ( type < 0 )
|
if ( type < 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool stat = translate( type, false );
|
translate( type, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
int ApplicationWindow::translationFormat( const QAction* a )
|
int ApplicationWindow::translationFormat( const QAction* a )
|
||||||
@ -181,7 +182,7 @@ int ApplicationWindow::translationFormat( const QAction* a )
|
|||||||
bool ApplicationWindow::translate( const int format, const bool import )
|
bool ApplicationWindow::translate( const int format, const bool import )
|
||||||
{
|
{
|
||||||
static Translate* anTrans = createTranslator();
|
static Translate* anTrans = createTranslator();
|
||||||
DocumentCommon* doc = ((MDIWindow*) getWorkspace()->activeWindow())->getDocument();
|
DocumentCommon* doc = qobject_cast<MDIWindow*>( getWorkspace()->activeSubWindow()->widget() )->getDocument();
|
||||||
Handle(AIS_InteractiveContext) context = doc->getContext();
|
Handle(AIS_InteractiveContext) context = doc->getContext();
|
||||||
bool status;
|
bool status;
|
||||||
if ( import )
|
if ( import )
|
||||||
@ -210,8 +211,8 @@ void ApplicationWindow::onSelectionChanged()
|
|||||||
{
|
{
|
||||||
ApplicationCommonWindow::onSelectionChanged();
|
ApplicationCommonWindow::onSelectionChanged();
|
||||||
|
|
||||||
QWorkspace* ws = getWorkspace();
|
QMdiArea* ws = getWorkspace();
|
||||||
DocumentCommon* doc = ((MDIWindow*)ws->activeWindow())->getDocument();
|
DocumentCommon* doc = qobject_cast<MDIWindow*>( ws->activeSubWindow()->widget() )->getDocument();
|
||||||
Handle(AIS_InteractiveContext) context = doc->getContext();
|
Handle(AIS_InteractiveContext) context = doc->getContext();
|
||||||
int numSel = context->NbSelected();
|
int numSel = context->NbSelected();
|
||||||
|
|
||||||
@ -225,13 +226,15 @@ void ApplicationWindow::onSelectionChanged()
|
|||||||
|
|
||||||
QString ApplicationWindow::getIEResourceDir()
|
QString ApplicationWindow::getIEResourceDir()
|
||||||
{
|
{
|
||||||
static QString resDir( ::getenv( "CSF_IEResourcesDefaults" ) );
|
static QString aResourceDir =
|
||||||
return resDir;
|
QString::fromUtf8 (qgetenv ("CSF_IEResourcesDefaults").constData());
|
||||||
|
|
||||||
|
return aResourceDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationWindow::onExportImage()
|
void ApplicationWindow::onExportImage()
|
||||||
{
|
{
|
||||||
MDIWindow* w = (MDIWindow*)getWorkspace()->activeWindow();
|
MDIWindow* w = qobject_cast<MDIWindow*>( getWorkspace()->activeSubWindow()->widget() );
|
||||||
if ( w )
|
if ( w )
|
||||||
w->dump();
|
w->dump();
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
#include <QStyleFactory>
|
||||||
|
|
||||||
#include <AIS_Shape.hxx>
|
#include <AIS_Shape.hxx>
|
||||||
#include <AIS_InteractiveObject.hxx>
|
#include <AIS_InteractiveObject.hxx>
|
||||||
@ -89,7 +90,9 @@ private:
|
|||||||
TranslateDlg::TranslateDlg( QWidget* parent, Qt::WindowFlags flags, bool modal )
|
TranslateDlg::TranslateDlg( QWidget* parent, Qt::WindowFlags flags, bool modal )
|
||||||
: QFileDialog( parent, flags )
|
: QFileDialog( parent, flags )
|
||||||
{
|
{
|
||||||
|
setOption( QFileDialog::DontUseNativeDialog );
|
||||||
setModal( modal );
|
setModal( modal );
|
||||||
|
|
||||||
QGridLayout* grid = ::qobject_cast<QGridLayout*>( layout() );
|
QGridLayout* grid = ::qobject_cast<QGridLayout*>( layout() );
|
||||||
|
|
||||||
if( grid )
|
if( grid )
|
||||||
@ -331,7 +334,7 @@ QString Translate::selectFileName( const int format, const bool import )
|
|||||||
|
|
||||||
if ( !QFileInfo( file ).completeSuffix().length() )
|
if ( !QFileInfo( file ).completeSuffix().length() )
|
||||||
{
|
{
|
||||||
QString selFilter = theDlg->selectedFilter();
|
QString selFilter = theDlg->selectedNameFilter();
|
||||||
int idx = selFilter.indexOf( "(*." );
|
int idx = selFilter.indexOf( "(*." );
|
||||||
if ( idx != -1 )
|
if ( idx != -1 )
|
||||||
{
|
{
|
||||||
@ -371,7 +374,7 @@ TranslateDlg* Translate::getDialog( const int format, const bool import )
|
|||||||
|
|
||||||
cout << filter.toLatin1().constData() << endl;
|
cout << filter.toLatin1().constData() << endl;
|
||||||
QStringList filters = filter.split( "\t" );
|
QStringList filters = filter.split( "\t" );
|
||||||
myDlg->setFilters( filters );
|
myDlg->setNameFilters ( filters );
|
||||||
|
|
||||||
if ( import )
|
if ( import )
|
||||||
{
|
{
|
||||||
@ -384,7 +387,7 @@ TranslateDlg* Translate::getDialog( const int format, const bool import )
|
|||||||
((QFileDialog*)myDlg)->setFileMode( QFileDialog::AnyFile );
|
((QFileDialog*)myDlg)->setFileMode( QFileDialog::AnyFile );
|
||||||
}
|
}
|
||||||
|
|
||||||
QString datadir = (QString(getenv("CASROOT")) + QObject::tr( QString("INF_PATH_%1").arg( format ).toLatin1().constData() ) );
|
QString datadir = (QString (qgetenv ("CASROOT").constData()) + QObject::tr( QString("INF_PATH_%1").arg( format ).toLatin1().constData() ) );
|
||||||
|
|
||||||
myDlg->clear();
|
myDlg->clear();
|
||||||
|
|
||||||
@ -459,7 +462,7 @@ Handle(TopTools_HSequenceOfShape) Translate::importSTEP( const QString& file )
|
|||||||
{
|
{
|
||||||
bool ok = aReader.TransferRoot( n );
|
bool ok = aReader.TransferRoot( n );
|
||||||
int nbs = aReader.NbShapes();
|
int nbs = aReader.NbShapes();
|
||||||
if ( nbs > 0 )
|
if ( ok == true && nbs > 0 )
|
||||||
{
|
{
|
||||||
aSequence = new TopTools_HSequenceOfShape();
|
aSequence = new TopTools_HSequenceOfShape();
|
||||||
for ( int i = 1; i <= nbs; i++ )
|
for ( int i = 1; i <= nbs; i++ )
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||||
# Visual Studio 2010
|
# Visual Studio 2010
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tutorial", "Tutorial.vcxproj", "{59DEDC8A-A5ED-31E8-8F2B-8D996E3A41D6}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tutorial", "Tutorial.vcxproj", "{E417B143-8CB4-3EF0-8247-DA6F67FA3FCE}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@ -8,10 +8,10 @@ Global
|
|||||||
Release|Win32 = Release|Win32
|
Release|Win32 = Release|Win32
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{59DEDC8A-A5ED-31E8-8F2B-8D996E3A41D6}.Debug|Win32.ActiveCfg = Debug|Win32
|
{E417B143-8CB4-3EF0-8247-DA6F67FA3FCE}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
{59DEDC8A-A5ED-31E8-8F2B-8D996E3A41D6}.Debug|Win32.Build.0 = Debug|Win32
|
{E417B143-8CB4-3EF0-8247-DA6F67FA3FCE}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
{59DEDC8A-A5ED-31E8-8F2B-8D996E3A41D6}.Release|Win32.ActiveCfg = Release|Win32
|
{E417B143-8CB4-3EF0-8247-DA6F67FA3FCE}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
{59DEDC8A-A5ED-31E8-8F2B-8D996E3A41D6}.Release|Win32.Build.0 = Release|Win32
|
{E417B143-8CB4-3EF0-8247-DA6F67FA3FCE}.Release|Win32.Build.0 = Release|Win32
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@ -3,7 +3,7 @@ CONFIG += debug_and_release qt
|
|||||||
|
|
||||||
TARGET = Tutorial
|
TARGET = Tutorial
|
||||||
|
|
||||||
SAMPLESROOT = $$(CASROOT)/samples/qt
|
SAMPLESROOT = $$(SAMPLESROOT)
|
||||||
|
|
||||||
HEADERS = src/*.h \
|
HEADERS = src/*.h \
|
||||||
$${SAMPLESROOT}/Common/src/*.h \
|
$${SAMPLESROOT}/Common/src/*.h \
|
||||||
@ -26,7 +26,9 @@ RES_DIR = $$quote($$(RES_DIR))
|
|||||||
INCLUDEPATH += $$quote($${SAMPLESROOT}/Common/src)
|
INCLUDEPATH += $$quote($${SAMPLESROOT}/Common/src)
|
||||||
INCLUDEPATH += $$quote($${SAMPLESROOT}/Interface/src)
|
INCLUDEPATH += $$quote($${SAMPLESROOT}/Interface/src)
|
||||||
|
|
||||||
DEFINES = CSFDB
|
OCCT_DEFINES = $$(CSF_DEFINES)
|
||||||
|
|
||||||
|
DEFINES = CSFDB $$split(OCCT_DEFINES, ;)
|
||||||
|
|
||||||
unix {
|
unix {
|
||||||
UNAME = $$system(uname -s)
|
UNAME = $$system(uname -s)
|
||||||
@ -40,11 +42,11 @@ unix {
|
|||||||
CONFIG(debug, debug|release) {
|
CONFIG(debug, debug|release) {
|
||||||
DESTDIR = ./$$UNAME/bind
|
DESTDIR = ./$$UNAME/bind
|
||||||
OBJECTS_DIR = ./$$UNAME/objd
|
OBJECTS_DIR = ./$$UNAME/objd
|
||||||
MOC_DIR = ./$$UNAME/srcd
|
MOC_DIR = ./$$UNAME/mocd
|
||||||
} else {
|
} else {
|
||||||
DESTDIR = ./$$UNAME/bin
|
DESTDIR = ./$$UNAME/bin
|
||||||
OBJECTS_DIR = ./$$UNAME/obj
|
OBJECTS_DIR = ./$$UNAME/obj
|
||||||
MOC_DIR = ./$$UNAME/src
|
MOC_DIR = ./$$UNAME/moc
|
||||||
}
|
}
|
||||||
|
|
||||||
MACOSX_USE_GLX = $$(MACOSX_USE_GLX)
|
MACOSX_USE_GLX = $$(MACOSX_USE_GLX)
|
||||||
@ -65,107 +67,23 @@ win32 {
|
|||||||
|
|
||||||
CONFIG(debug, debug|release) {
|
CONFIG(debug, debug|release) {
|
||||||
DEFINES += _DEBUG
|
DEFINES += _DEBUG
|
||||||
|
DESTDIR = ./win$(ARCH)/$(VCVER)/bind
|
||||||
|
OBJECTS_DIR = ./win$(ARCH)/$(VCVER)/objd
|
||||||
|
MOC_DIR = ./win$(ARCH)/$(VCVER)/mocd
|
||||||
!contains(QMAKE_HOST.arch, x86_64) {
|
!contains(QMAKE_HOST.arch, x86_64) {
|
||||||
LIBS = -L$(CSF_OPT_LIB32D)
|
LIBS = -L$(CSF_OPT_LIB32D)
|
||||||
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1310) {
|
|
||||||
DESTDIR = ./win32/vc7/bind
|
|
||||||
OBJECTS_DIR = ./win32/vc7/objd
|
|
||||||
MOC_DIR = ./win32/vc7/srcd
|
|
||||||
}
|
|
||||||
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1400) {
|
|
||||||
DESTDIR = ./win32/vc8/bind
|
|
||||||
OBJECTS_DIR = ./win32/vc8/objd
|
|
||||||
MOC_DIR = ./win32/vc8/srcd
|
|
||||||
}
|
|
||||||
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1500) {
|
|
||||||
DESTDIR = ./win32/vc9/bind
|
|
||||||
OBJECTS_DIR = ./win32/vc9/objd
|
|
||||||
MOC_DIR = ./win32/vc9/srcd
|
|
||||||
}
|
|
||||||
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1600) {
|
|
||||||
DESTDIR = ./win32/vc10/bind
|
|
||||||
OBJECTS_DIR = ./win32/vc10/objd
|
|
||||||
MOC_DIR = ./win32/vc10/srcd
|
|
||||||
}
|
|
||||||
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1700) {
|
|
||||||
DESTDIR = ./win32/vc11/bind
|
|
||||||
OBJECTS_DIR = ./win32/vc11/objd
|
|
||||||
MOC_DIR = ./win32/vc11/srcd
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
LIBS = -L$(CSF_OPT_LIB64D)
|
LIBS = -L$(CSF_OPT_LIB64D)
|
||||||
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1400) {
|
|
||||||
DESTDIR = ./win64/vc8/bind
|
|
||||||
OBJECTS_DIR = ./win64/vc8/objd
|
|
||||||
MOC_DIR = ./win64/vc8/srcd
|
|
||||||
}
|
|
||||||
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1500) {
|
|
||||||
DESTDIR = ./win64/vc9/bind
|
|
||||||
OBJECTS_DIR = ./win64/vc9/objd
|
|
||||||
MOC_DIR = ./win64/vc9/srcd
|
|
||||||
}
|
|
||||||
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1600) {
|
|
||||||
DESTDIR = ./win64/vc10/bind
|
|
||||||
OBJECTS_DIR = ./win64/vc10/objd
|
|
||||||
MOC_DIR = ./win64/vc10/srcd
|
|
||||||
}
|
|
||||||
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1700) {
|
|
||||||
DESTDIR = ./win64/vc11/bind
|
|
||||||
OBJECTS_DIR = ./win64/vc11/objd
|
|
||||||
MOC_DIR = ./win64/vc11/srcd
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
DEFINES += NDEBUG
|
DEFINES += NDEBUG
|
||||||
|
DESTDIR = ./win$(ARCH)/$(VCVER)/bin
|
||||||
|
OBJECTS_DIR = ./win$(ARCH)/$(VCVER)/obj
|
||||||
|
MOC_DIR = ./win$(ARCH)/$(VCVER)/moc
|
||||||
!contains(QMAKE_HOST.arch, x86_64) {
|
!contains(QMAKE_HOST.arch, x86_64) {
|
||||||
LIBS = -L$(CSF_OPT_LIB32)
|
LIBS = -L$(CSF_OPT_LIB32)
|
||||||
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1310) {
|
|
||||||
DESTDIR = ./win32/vc7/bin
|
|
||||||
OBJECTS_DIR = ./win32/vc7/obj
|
|
||||||
MOC_DIR = ./win32/vc7/src
|
|
||||||
}
|
|
||||||
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1400) {
|
|
||||||
DESTDIR = ./win32/vc8/bin
|
|
||||||
OBJECTS_DIR = ./win32/vc8/obj
|
|
||||||
MOC_DIR = ./win32/vc8/src
|
|
||||||
}
|
|
||||||
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1500) {
|
|
||||||
DESTDIR = ./win32/vc9/bin
|
|
||||||
OBJECTS_DIR = ./win32/vc9/obj
|
|
||||||
MOC_DIR = ./win32/vc9/src
|
|
||||||
}
|
|
||||||
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1600) {
|
|
||||||
DESTDIR = ./win32/vc10/bin
|
|
||||||
OBJECTS_DIR = ./win32/vc10/obj
|
|
||||||
MOC_DIR = ./win32/vc10/src
|
|
||||||
}
|
|
||||||
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1700) {
|
|
||||||
DESTDIR = ./win32/vc11/bin
|
|
||||||
OBJECTS_DIR = ./win32/vc11/obj
|
|
||||||
MOC_DIR = ./win32/vc11/src
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
LIBS = -L$(CSF_OPT_LIB64)
|
LIBS = -L$(CSF_OPT_LIB64)
|
||||||
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1400) {
|
|
||||||
DESTDIR = ./win64/vc8/bin
|
|
||||||
OBJECTS_DIR = ./win64/vc8/obj
|
|
||||||
MOC_DIR = ./win64/vc8/src
|
|
||||||
}
|
|
||||||
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1500) {
|
|
||||||
DESTDIR = ./win64/vc9/bin
|
|
||||||
OBJECTS_DIR = ./win64/vc9/obj
|
|
||||||
MOC_DIR = ./win64/vc9/src
|
|
||||||
}
|
|
||||||
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1600) {
|
|
||||||
DESTDIR = ./win64/vc10/bin
|
|
||||||
OBJECTS_DIR = ./win64/vc10/obj
|
|
||||||
MOC_DIR = ./win64/vc10/src
|
|
||||||
}
|
|
||||||
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1700) {
|
|
||||||
DESTDIR = ./win64/vc11/bin
|
|
||||||
OBJECTS_DIR = ./win64/vc11/obj
|
|
||||||
MOC_DIR = ./win64/vc11/src
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DEFINES +=WNT WIN32 NO_COMMONSAMPLE_EXPORTS NO_IESAMPLE_EXPORTS
|
DEFINES +=WNT WIN32 NO_COMMONSAMPLE_EXPORTS NO_IESAMPLE_EXPORTS
|
||||||
@ -201,4 +119,8 @@ copy_res.CONFIG += no_link target_predeps
|
|||||||
win32: copy_res.commands = type ${QMAKE_FILE_IN} > $${RES_DIR}/${QMAKE_FILE_BASE}${QMAKE_FILE_EXT}
|
win32: copy_res.commands = type ${QMAKE_FILE_IN} > $${RES_DIR}/${QMAKE_FILE_BASE}${QMAKE_FILE_EXT}
|
||||||
unix: copy_res.commands = cp -f ${QMAKE_FILE_IN} $${RES_DIR}
|
unix: copy_res.commands = cp -f ${QMAKE_FILE_IN} $${RES_DIR}
|
||||||
QMAKE_EXTRA_COMPILERS += copy_res
|
QMAKE_EXTRA_COMPILERS += copy_res
|
||||||
|
#QMAKE_CXXFLAGS += /wd4996
|
||||||
|
|
||||||
|
greaterThan(QT_MAJOR_VERSION, 4) {
|
||||||
|
QT += widgets
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
call "%~dp0..\..\..\env.bat" %1 %2 %3
|
call "%~dp0..\..\..\env.bat" %1 %2 %3
|
||||||
|
|
||||||
|
SET "SAMPLESROOT=%~dp0.."
|
||||||
SET "RES_DIR=%~dp0win%ARCH%\%VCVER%\res"
|
SET "RES_DIR=%~dp0win%ARCH%\%VCVER%\res"
|
||||||
SET "CSF_ResourcesDefaults=%RES_DIR%"
|
SET "CSF_ResourcesDefaults=%RES_DIR%"
|
||||||
SET "CSF_TutorialResourcesDefaults=%RES_DIR%"
|
SET "CSF_TutorialResourcesDefaults=%RES_DIR%"
|
||||||
|
|
||||||
|
@ -7,6 +7,8 @@ REM third argument specifies Debug or Release mode
|
|||||||
|
|
||||||
call "%~dp0env.bat" %1 %2 %3
|
call "%~dp0env.bat" %1 %2 %3
|
||||||
|
|
||||||
|
set EXT=vcproj
|
||||||
|
|
||||||
if not "%1" == "" (
|
if not "%1" == "" (
|
||||||
if /I "%1" == "vc8" (
|
if /I "%1" == "vc8" (
|
||||||
set VCVER=vc8
|
set VCVER=vc8
|
||||||
@ -16,9 +18,11 @@ if not "%1" == "" (
|
|||||||
set "VCVARS=%VS90COMNTOOLS%..\..\VC\vcvarsall.bat"
|
set "VCVARS=%VS90COMNTOOLS%..\..\VC\vcvarsall.bat"
|
||||||
) else if /I "%1" == "vc10" (
|
) else if /I "%1" == "vc10" (
|
||||||
set VCVER=vc10
|
set VCVER=vc10
|
||||||
|
set EXT=vcxproj
|
||||||
set "VCVARS=%VS100COMNTOOLS%..\..\VC\vcvarsall.bat"
|
set "VCVARS=%VS100COMNTOOLS%..\..\VC\vcvarsall.bat"
|
||||||
) else if /I "%1" == "vc11" (
|
) else if /I "%1" == "vc11" (
|
||||||
set VCVER=vc11
|
set VCVER=vc11
|
||||||
|
set EXT=vcxproj
|
||||||
set "VCVARS=%VS110COMNTOOLS%..\..\VC\vcvarsall.bat"
|
set "VCVARS=%VS110COMNTOOLS%..\..\VC\vcvarsall.bat"
|
||||||
) else (
|
) else (
|
||||||
echo Error: first argument ^(%1^) should specify supported version of Visual C++,
|
echo Error: first argument ^(%1^) should specify supported version of Visual C++,
|
||||||
@ -32,4 +36,4 @@ if ["%ARCH%"] == ["64"] set VCARCH=amd64
|
|||||||
|
|
||||||
call "%VCVARS%" %VCARCH%
|
call "%VCVARS%" %VCARCH%
|
||||||
|
|
||||||
qmake -tp vc -r Tutorial.pro
|
qmake -tp vc -o Tutorial.%EXT% Tutorial.pro
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QStatusBar>
|
#include <QStatusBar>
|
||||||
|
#include <QMdiSubWindow>
|
||||||
|
|
||||||
ApplicationTut::ApplicationTut()
|
ApplicationTut::ApplicationTut()
|
||||||
: ApplicationCommonWindow( )
|
: ApplicationCommonWindow( )
|
||||||
@ -33,7 +34,7 @@ void ApplicationTut::createMakeBottleOperation(){
|
|||||||
|
|
||||||
void ApplicationTut::updateFileActions()
|
void ApplicationTut::updateFileActions()
|
||||||
{
|
{
|
||||||
if ( getWorkspace()->windowList().isEmpty() )
|
if ( getWorkspace()->subWindowList().isEmpty() )
|
||||||
{
|
{
|
||||||
if ( !isDocument() )
|
if ( !isDocument() )
|
||||||
{
|
{
|
||||||
@ -49,8 +50,8 @@ void ApplicationTut::updateFileActions()
|
|||||||
|
|
||||||
void ApplicationTut::onMakeBottleAction()
|
void ApplicationTut::onMakeBottleAction()
|
||||||
{
|
{
|
||||||
QWorkspace* ws = ApplicationCommonWindow::getWorkspace();
|
QMdiArea* ws = ApplicationCommonWindow::getWorkspace();
|
||||||
DocumentTut* doc = (DocumentTut*)((MDIWindow*)ws->activeWindow())->getDocument();
|
DocumentTut* doc = (DocumentTut*)( qobject_cast<MDIWindow*>( ws->activeSubWindow()->widget() )->getDocument() );
|
||||||
statusBar()->showMessage( QObject::tr("INF_MAKE_BOTTLE"), 5000 );
|
statusBar()->showMessage( QObject::tr("INF_MAKE_BOTTLE"), 5000 );
|
||||||
doc->onMakeBottle();
|
doc->onMakeBottle();
|
||||||
statusBar()->showMessage(QObject::tr("INF_DONE"));
|
statusBar()->showMessage(QObject::tr("INF_DONE"));
|
||||||
@ -58,7 +59,7 @@ void ApplicationTut::onMakeBottleAction()
|
|||||||
|
|
||||||
QString ApplicationTut::getTutResourceDir()
|
QString ApplicationTut::getTutResourceDir()
|
||||||
{
|
{
|
||||||
static QString resDir( ::getenv( "CSF_TutorialResourcesDefaults" ) );
|
static QString resDir (qgetenv ("CSF_TutorialResourcesDefaults").constData());
|
||||||
return resDir;
|
return resDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user