1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-21 10:13:43 +03:00
occt/samples/qt/Tutorial/src/ApplicationTut.cxx
vdn 3cb77da46e 0023459: Update QT samples
Removing Qt3Support layer of Qt 4
Changed all files for Qt4 and added file VoxelDemo.pro
Removed 'static' before the declaration of handling FSD_File.
2013-10-03 14:28:12 +04:00

65 lines
1.7 KiB
C++
Executable File

#include "ApplicationTut.h"
#include "DocumentTut.h"
#include <QFileDialog>
#include <QStatusBar>
ApplicationTut::ApplicationTut()
: ApplicationCommonWindow( )
{
createMakeBottleOperation();
}
ApplicationTut::~ApplicationTut()
{
}
void ApplicationTut::createMakeBottleOperation(){
QPixmap MakeBottleIcon;
QString dir = getTutResourceDir() + QString( "/" );
MakeBottleIcon = QPixmap( dir+QObject::tr( "ICON_MAKE_BOTTLE" ) );
QAction * MakeBottleAction = new QAction( MakeBottleIcon, QObject::tr("TBR_MAKEBOT"), this );
MakeBottleAction->setToolTip( QObject::tr( "TBR_MAKEBOT" ) );
MakeBottleAction->setStatusTip( QObject::tr("TBR_MAKEBOT") );
MakeBottleAction->setShortcut( QObject::tr( "CTRL+M" ) );
connect( MakeBottleAction, SIGNAL( triggered() ) , this, SLOT( onMakeBottleAction() ) );
myMakeBottleBar = addToolBar( tr( "Make Bottle" ) );
insertToolBar( getCasCadeBar(), myMakeBottleBar );
myMakeBottleBar->addAction( MakeBottleAction );
myMakeBottleBar->hide();
}
void ApplicationTut::updateFileActions()
{
if ( getWorkspace()->windowList().isEmpty() )
{
if ( !isDocument() )
{
myMakeBottleBar->show();
}
else
{
myMakeBottleBar->hide();
}
}
ApplicationCommonWindow::updateFileActions();
}
void ApplicationTut::onMakeBottleAction()
{
QWorkspace* ws = ApplicationCommonWindow::getWorkspace();
DocumentTut* doc = (DocumentTut*)((MDIWindow*)ws->activeWindow())->getDocument();
statusBar()->showMessage( QObject::tr("INF_MAKE_BOTTLE"), 5000 );
doc->onMakeBottle();
statusBar()->showMessage(QObject::tr("INF_DONE"));
}
QString ApplicationTut::getTutResourceDir()
{
static QString resDir( ::getenv( "CSF_TutorialResourcesDefaults" ) );
return resDir;
}