Salome HOME
Memory Leaks
[modules/superv.git] / src / SUPERVGUI / SUPERVGUI_Information.cxx
index 5ee9b3c774e39ef2c527f0d5b1777b933e4a40b1..fe1c270a124d7b2a65f7d01306f9e92dcdddac72 100644 (file)
@@ -147,18 +147,31 @@ SUPERVGUI_Information::SUPERVGUI_Information(SUPERV_CNode node, bool isReadOnly)
   GroupButtonsLayout->setAlignment( Qt::AlignTop );
   GroupButtonsLayout->setSpacing( 6 );
   GroupButtonsLayout->setMargin( 11 );
-  
-  QPushButton* okB     = new QPushButton( tr( "BUT_OK" ),     GroupButtons );
-  QPushButton* cancelB = new QPushButton( tr( "BUT_CANCEL" ), GroupButtons );
 
-  GroupButtonsLayout->addWidget( okB, 0, 0 );
-  GroupButtonsLayout->addItem  ( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
-  GroupButtonsLayout->addWidget( cancelB, 0, 2 );
+  // fix for PAL6904: when isReadOnly is set ON (the dataflow was imported) then only "CLOSE" button
+  // should be present instead of 2 buttons OK and Cancel.
+  QPushButton* cancelB;
+  if ( !isReadOnly || node->IsFactory() )  {
+    /*added node->IsFactory() because only for Factory nodes we ALWAYS have editable "Container" field  */
+    QPushButton* okB = new QPushButton( tr( "BUT_OK" ), GroupButtons );
+    connect( okB,     SIGNAL( clicked() ), this, SLOT( okButton() ) );
+    cancelB = new QPushButton( tr( "BUT_CANCEL" ), GroupButtons );
+    GroupButtonsLayout->addWidget( okB, 0, 0 );
+    GroupButtonsLayout->addItem  ( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
+    GroupButtonsLayout->addWidget( cancelB, 0, 2 );
+  }
+  else {
+    cancelB = new QPushButton( tr( "BUT_CLOSE" ), GroupButtons );
+    GroupButtonsLayout->addItem  ( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 0 );
+    GroupButtonsLayout->addWidget( cancelB, 0, 1 );
+    GroupButtonsLayout->addItem  ( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 2 );
+  }
 
   TopLayout->addWidget( TopGroup,     0, 0 );
   TopLayout->addWidget( GroupButtons, 1, 0 );
+  TopLayout->setRowStretch( 0, 1 );
+  TopLayout->setRowStretch( 1, 0 );
 
-  connect( okB,     SIGNAL( clicked() ), this, SLOT( okButton() ) );
   connect( cancelB, SIGNAL( clicked() ), this, SLOT( koButton() ) );
 }