0029571: Samples: build qt samples together with OCCT
[occt.git] / samples / qt / IESample / src / Main.cxx
CommitLineData
7fd59977 1#include "Application.h"
2
1fa16152 3#include <OSD_Environment.hxx>
4
7fd59977 5#include <QApplication>
6#include <QTranslator>
7#include <QPixmap>
8#include <QLocale>
9
10
7fd59977 11int main ( int argc, char* argv[] )
12{
1fa16152 13#if QT_VERSION > 0x050000
14 TCollection_AsciiString aPlugindsDirName = OSD_Environment ("QTDIR").Value();
15 if (!aPlugindsDirName.IsEmpty())
16 QApplication::addLibraryPath (QString (aPlugindsDirName.ToCString()) + "/plugins");
17#endif
7fd59977 18 QApplication a( argc, argv );
19
20 QString resDir = ApplicationCommonWindow::getResourceDir();
21 QString resIEDir = ApplicationWindow::getIEResourceDir();
22
23 QTranslator strTrans( 0 );
24 Standard_Boolean isOK = strTrans.load( "Common-string", resDir );
25 if( isOK )
26 a.installTranslator( &strTrans );
27
28 QTranslator iconTrans( 0 );
29 isOK = iconTrans.load( "Common-icon", resDir );
30 if( isOK )
31 a.installTranslator( &iconTrans );
32
33 QTranslator strIETrans( 0 );
34 isOK = strIETrans.load( "Interface-string", resIEDir );
35 if( isOK )
36 a.installTranslator( &strIETrans );
37
38 QObject::connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
39
40 ApplicationWindow* mw = new ApplicationWindow();
41 mw->setWindowTitle( QObject::tr( "TIT_SAMPLE" ) );
42 mw->setWindowIcon( QPixmap( resDir + QString( "/" ) + QObject::tr( "ICON_SAMPLE" ) ) );
43 mw->show();
44
45 return a.exec();
46}
47