Salome HOME
HYDROGUI_Wizard has been refactored and now uses QStackedWidget instead of QWizard.
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_PrsImage.cxx
index 90e54cf68acdb979535f67e67adc7d1b66cfd9b4..9e7be1425bceb3b3ad0d459d8e889020f2e24f0a 100644 (file)
 // name    : HYDROGUI_PrsImage
 // Purpose : Constructor
 //=======================================================================
-HYDROGUI_PrsImage::HYDROGUI_PrsImage( const Handle(HYDROData_Object)& theObject )
+HYDROGUI_PrsImage::HYDROGUI_PrsImage( const Handle(HYDROData_Entity)& theObject )
 : HYDROGUI_Prs( theObject ),
   myPixmapItem( 0 ),
+  myCaptionItem( 0 ),
   myPrsImageFrame( 0 ),
   myIsTransformationPointPreview( false ),
   myTransformationPointType( None )
@@ -73,6 +74,30 @@ QImage HYDROGUI_PrsImage::getImage() const
   return myImage;
 }
 
+//================================================================
+// Function : setCaption
+// Purpose  : 
+//================================================================
+void HYDROGUI_PrsImage::setCaption( const QString& theCaption )
+{
+  if( myCaptionItem )
+  {
+    myCaptionItem->setText( theCaption );
+    myCaptionItem->setVisible( !theCaption.isEmpty() );
+  }
+}
+
+//================================================================
+// Function : getCaption
+// Purpose  : 
+//================================================================
+QString HYDROGUI_PrsImage::getCaption() const
+{
+  if( myCaptionItem )
+    return myCaptionItem->text();
+  return QString();
+}
+
 //================================================================
 // Function : setIsTransformationPointPreview
 // Purpose  : 
@@ -150,12 +175,27 @@ void HYDROGUI_PrsImage::compute()
     myPixmapItem = new QGraphicsPixmapItem( this );
     addToGroup( myPixmapItem );
   }
+  if( !myCaptionItem )
+  {
+    myCaptionItem = new QGraphicsSimpleTextItem( this );
+
+    QFont aFont = myCaptionItem->font();
+    aFont.setPointSize( 14 );
+    myCaptionItem->setFont( aFont );
+
+    addToGroup( myCaptionItem );
+  }
   if( !myPrsImageFrame )
   {
     myPrsImageFrame = new HYDROGUI_PrsImageFrame( this );
     addToGroup( myPrsImageFrame );
   }
+
   myPixmapItem->setPixmap( QPixmap::fromImage( myImage ) );
+
+  myCaptionItem->setPos( 0, -30 );
+  myCaptionItem->setVisible( false );
+
   myPrsImageFrame->compute();
 }