1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-21 10:13:43 +03:00
nds 55a40de890 0028934: Coding - Eliminate compiler warnings in OCCT samples
- covering Qt warnings for compilation under MSVC 2013 and greater
- avoid warning about 'M_PI'(and others) redefinition warning of math.h: includes of QtWidgets should follow after other includes.
2018-04-09 10:18:38 +03:00

50 lines
1.4 KiB
C++
Executable File

#include "Application.h"
#include <OSD_Environment.hxx>
#include <Standard_WarningsDisable.hxx>
#include <QApplication>
#include <QTranslator>
#include <QPixmap>
#include <QLocale>
#include <Standard_WarningsRestore.hxx>
int main ( int argc, char* argv[] )
{
#if QT_VERSION > 0x050000
TCollection_AsciiString aPlugindsDirName = OSD_Environment ("QTDIR").Value();
if (!aPlugindsDirName.IsEmpty())
QApplication::addLibraryPath (QString (aPlugindsDirName.ToCString()) + "/plugins");
#endif
QApplication a( argc, argv );
QString resDir = ApplicationCommonWindow::getResourceDir();
QString resIEDir = ApplicationWindow::getIEResourceDir();
QTranslator strTrans( 0 );
Standard_Boolean isOK = strTrans.load( "Common-string", resDir );
if( isOK )
a.installTranslator( &strTrans );
QTranslator iconTrans( 0 );
isOK = iconTrans.load( "Common-icon", resDir );
if( isOK )
a.installTranslator( &iconTrans );
QTranslator strIETrans( 0 );
isOK = strIETrans.load( "Interface-string", resIEDir );
if( isOK )
a.installTranslator( &strIETrans );
QObject::connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
ApplicationWindow* mw = new ApplicationWindow();
mw->setWindowTitle( QObject::tr( "TIT_SAMPLE" ) );
mw->setWindowIcon( QPixmap( resDir + QString( "/" ) + QObject::tr( "ICON_SAMPLE" ) ) );
mw->show();
return a.exec();
}