1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-04 13:13:25 +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:
dbp
2014-01-22 19:07:53 +04:00
committed by bugmaster
parent c5d477170e
commit 861a7b03e1
23 changed files with 435 additions and 634 deletions

View File

@@ -4,6 +4,7 @@
#include <QMessageBox>
#include <stdlib.h>
#include <QMdiSubWindow>
ApplicationWindow::ApplicationWindow()
: ApplicationCommonWindow( ),
@@ -96,7 +97,7 @@ void ApplicationWindow::createTranslatePopups()
void ApplicationWindow::updateFileActions()
{
if ( getWorkspace()->windowList().isEmpty() )
if ( myDocuments.isEmpty() )
{
if ( !isDocument() )
{
@@ -124,7 +125,7 @@ void ApplicationWindow::onImport()
bool stat = translate( type, true );
if ( stat )
{
DocumentCommon* doc = ((MDIWindow*) getWorkspace()->activeWindow())->getDocument();
DocumentCommon* doc = qobject_cast<MDIWindow*>( getWorkspace()->activeSubWindow()->widget() )->getDocument();
doc->fitAll();
}
}
@@ -136,7 +137,7 @@ void ApplicationWindow::onExport()
if ( type < 0 )
return;
bool stat = translate( type, false );
translate( type, false );
}
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 )
{
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();
bool status;
if ( import )
@@ -210,8 +211,8 @@ void ApplicationWindow::onSelectionChanged()
{
ApplicationCommonWindow::onSelectionChanged();
QWorkspace* ws = getWorkspace();
DocumentCommon* doc = ((MDIWindow*)ws->activeWindow())->getDocument();
QMdiArea* ws = getWorkspace();
DocumentCommon* doc = qobject_cast<MDIWindow*>( ws->activeSubWindow()->widget() )->getDocument();
Handle(AIS_InteractiveContext) context = doc->getContext();
int numSel = context->NbSelected();
@@ -225,13 +226,15 @@ void ApplicationWindow::onSelectionChanged()
QString ApplicationWindow::getIEResourceDir()
{
static QString resDir( ::getenv( "CSF_IEResourcesDefaults" ) );
return resDir;
static QString aResourceDir =
QString::fromUtf8 (qgetenv ("CSF_IEResourcesDefaults").constData());
return aResourceDir;
}
void ApplicationWindow::onExportImage()
{
MDIWindow* w = (MDIWindow*)getWorkspace()->activeWindow();
MDIWindow* w = qobject_cast<MDIWindow*>( getWorkspace()->activeSubWindow()->widget() );
if ( w )
w->dump();
}

View File

@@ -15,6 +15,7 @@
#include <QFileDialog>
#include <QApplication>
#include <QWidget>
#include <QStyleFactory>
#include <AIS_Shape.hxx>
#include <AIS_InteractiveObject.hxx>
@@ -89,7 +90,9 @@ private:
TranslateDlg::TranslateDlg( QWidget* parent, Qt::WindowFlags flags, bool modal )
: QFileDialog( parent, flags )
{
setOption( QFileDialog::DontUseNativeDialog );
setModal( modal );
QGridLayout* grid = ::qobject_cast<QGridLayout*>( layout() );
if( grid )
@@ -331,7 +334,7 @@ QString Translate::selectFileName( const int format, const bool import )
if ( !QFileInfo( file ).completeSuffix().length() )
{
QString selFilter = theDlg->selectedFilter();
QString selFilter = theDlg->selectedNameFilter();
int idx = selFilter.indexOf( "(*." );
if ( idx != -1 )
{
@@ -371,7 +374,7 @@ TranslateDlg* Translate::getDialog( const int format, const bool import )
cout << filter.toLatin1().constData() << endl;
QStringList filters = filter.split( "\t" );
myDlg->setFilters( filters );
myDlg->setNameFilters ( filters );
if ( import )
{
@@ -384,7 +387,7 @@ TranslateDlg* Translate::getDialog( const int format, const bool import )
((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();
@@ -459,7 +462,7 @@ Handle(TopTools_HSequenceOfShape) Translate::importSTEP( const QString& file )
{
bool ok = aReader.TransferRoot( n );
int nbs = aReader.NbShapes();
if ( nbs > 0 )
if ( ok == true && nbs > 0 )
{
aSequence = new TopTools_HSequenceOfShape();
for ( int i = 1; i <= nbs; i++ )