SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
// Import image from file
- myFileNameGroup = new QGroupBox( tr( "IMPORT_IMAGE_FROM_FILE" ) );
+ myFileNameGroup = new QGroupBox( tr( "IMPORT_IMAGE_FROM_FILE" ), this );
QLabel* aFileNameLabel = new QLabel( tr( "FILE_NAME" ), myFileNameGroup );
aFileNameLayout->addWidget( aBrowseBtn );
// Image name
- myImageNameGroup = new QGroupBox( tr( "IMAGE_NAME" ) );
+ myImageNameGroup = new QGroupBox( tr( "IMAGE_NAME" ), this );
QLabel* anImageNameLabel = new QLabel( tr( "NAME" ), myImageNameGroup );
myImageName = new QLineEdit( myImageNameGroup );
anImageNameLayout->addWidget( myImageName );
// Transform image
- myTransformGroup = new QGroupBox( tr( "TRANSFORM_IMAGE" ) );
+ myTransformGroup = new QGroupBox( tr( "TRANSFORM_IMAGE" ), this );
// Make a pixmap for arrow
QPixmap anArrowPixmap = aResMgr->loadPixmap( "HYDRO", tr( "ARROW_RIGHT_ICO" ) );
myRefImage = new QComboBox( myTransformGroup );
- QGridLayout* aModeLayout = new QGridLayout();
+ QGridLayout* aTransformLayout = new QGridLayout( myTransformGroup );
+ aTransformLayout->setMargin( 5 );
+ aTransformLayout->setSpacing( 5 );
+
+ QGridLayout* aModeLayout = new QGridLayout( myTransformGroup );
aModeLayout->setMargin( 0 );
aModeLayout->setSpacing( 5 );
aModeLayout->addWidget( aManualCartesianBtn, 0, 0 );
aModeLayout->addWidget( myRefImage, 2, 1 );
aModeLayout->setColumnStretch( 1, 1 );
- QGridLayout* aTransformLayout = new QGridLayout( myTransformGroup );
- aTransformLayout->setMargin( 5 );
- aTransformLayout->setSpacing( 5 );
aTransformLayout->addLayout( aModeLayout, 0, 0, 1, 9 );
QLabel* aImageCSLabel = new QLabel( tr( "IMAGE_CS" ), myTransformGroup );
- QLabel* aGeodesicLabel = new QLabel( "GEODESIC", myTransformGroup );
- QLabel* aLambertLabel = new QLabel( "LAMBERT93", myTransformGroup );
- QLabel* aRefImageLabel = new QLabel( "REFERENCE_IMAGE_CS", myTransformGroup );
+ QLabel* aGeodesicLabel = new QLabel( tr( "GEODESIC" ), myTransformGroup );
+ QLabel* aLambertLabel = new QLabel( tr( "LAMBERT93" ), myTransformGroup );
+ QLabel* aRefImageLabel = new QLabel( tr( "REFERENCE_IMAGE_CS" ), myTransformGroup );
aTransformLayout->addWidget( aImageCSLabel, 2, 1 );
aTransformLayout->addWidget( aGeodesicLabel, 2, 3, 1, 6 );
HYDROGUI_ImportImageDlg::~HYDROGUI_ImportImageDlg()
{
- delete myFileNameGroup;
- delete myImageNameGroup;
- delete myTransformGroup;
}
void HYDROGUI_ImportImageDlg::setIsEdit( const bool theIsEdit )
{
aViewPort = aViewer->getActiveViewPort();
connect( aViewer, SIGNAL( selectionChanged( GV_SelectionChangeStatus ) ),
- this, SLOT( onPointSelected() ) );
+ this, SLOT( onRefPointSelected() ) );
}
}
}
onPointSelected( myRefPreviewPrs && myRefPreviewPrs->isSelected() );
}
+void HYDROGUI_ImportImageOp::onRefPointSelected()
+{
+ onPointSelected( true );
+}
+
void HYDROGUI_ImportImageOp::onPointSelected( bool theIsRefImage )
{
HYDROGUI_PrsImage* aPrs = theIsRefImage ? myRefPreviewPrs : myPreviewPrs;
void HYDROGUI_ImportImageOp::closeView( GraphicsView_ViewManager* &aViewMgr )
{
- // It's very strange, but without calling this method (it's quite safe) a crash is stably reproduced.
- // Scenario: create any non-Graphics view, activate import op, click apply.
- // Result: a few SIGSEGVs coming from processEvents(), then crash.
if( aViewMgr )
{
+ GraphicsView_ViewPort* aViewPort = 0;
if( GraphicsView_Viewer* aViewer = aViewMgr->getViewer() )
{
- if( GraphicsView_ViewPort* aViewPort = aViewer->getActiveViewPort() )
- {
- aViewPort->onBoundingRectChanged();
- }
+ aViewPort = aViewer->getActiveViewPort();
}
disconnect( aViewMgr, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ),
this, SLOT( onLastViewClosed( SUIT_ViewManager* ) ) );
// Nullify appropriate presentation pointer
+ HYDROGUI_PrsImage* aPrs;
switch ( module()->getViewManagerRole( aViewMgr ) )
{
case HYDROGUI_Module::VMR_ReferenceImage:
+ aPrs = myRefPreviewPrs;
myRefPreviewPrs = 0;
break;
case HYDROGUI_Module::VMR_TransformImage:
+ aPrs = myPreviewPrs;
myPreviewPrs = 0;
}
- // Delete the view and all its presentations
+ // Remove the appropriate presentation from the view
+ if( aPrs && aViewPort )
+ {
+ aViewPort->removeItem( aPrs );
+ delete aPrs;
+ }
+
+ // Delete the view
module()->getApp()->removeViewManager( aViewMgr ); // aViewMgr is deleted here
aViewMgr = 0;
}