From: rkv Date: Mon, 2 Dec 2013 12:01:41 +0000 (+0000) Subject: Icons are shown in the object browser tree. X-Git-Tag: BR_hydro_v_0_4~103 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7198f2622fe1a08821e554f2e478e4764ab625c6;p=modules%2Fhydro.git Icons are shown in the object browser tree. --- diff --git a/src/HYDROGUI/HYDROGUI_DataObject.cxx b/src/HYDROGUI/HYDROGUI_DataObject.cxx index c35afa88..64f579ff 100644 --- a/src/HYDROGUI/HYDROGUI_DataObject.cxx +++ b/src/HYDROGUI/HYDROGUI_DataObject.cxx @@ -24,6 +24,9 @@ #include #include +#include +#include +#include HYDROGUI_DataObject::HYDROGUI_DataObject( SUIT_DataObject* theParent, Handle(HYDROData_Entity) theData, @@ -99,6 +102,27 @@ QColor HYDROGUI_DataObject::color( const ColorRole theRole, const int theId ) co return aColor; } +QPixmap HYDROGUI_DataObject::icon( const int theId ) const +{ + SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); + if ( theId == NameId ) + { + QString anIcon; + Handle(HYDROData_Entity) aDataObject = modelObject(); + if( aDataObject.IsNull() ) + { + anIcon = QObject::tr( "HYDRO_TYPE0_ICO" ); // KIND_UNKNOWN + } + else + { + anIcon = QObject::tr( QString("HYDRO_TYPE%1_ICO").arg( (int)aDataObject->GetKind() ).toAscii() ); + } + + return aResMgr->loadPixmap( "HYDRO", anIcon ); + } + return LightApp_DataObject::icon( theId ); +} + QString HYDROGUI_DataObject::dataObjectEntry( const Handle(HYDROData_Entity)& theObject, const bool theWithPrefix ) { @@ -147,10 +171,19 @@ QString HYDROGUI_NamedObject::name() const return myName; } +QPixmap HYDROGUI_NamedObject::icon( const int theId ) const +{ + SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); + if ( theId == NameId ) + { + return aResMgr->loadPixmap( "HYDRO", QObject::tr( "PARTITION_ICO" ) ); + } + return LightApp_DataObject::icon( theId ); +} + HYDROGUI_DropTargetObject::HYDROGUI_DropTargetObject( SUIT_DataObject* theParent, const QString& theName, const QString& theParentEntry ) : HYDROGUI_NamedObject( theParent, theName, theParentEntry ), CAM_DataObject( theParent ) { } - diff --git a/src/HYDROGUI/HYDROGUI_DataObject.h b/src/HYDROGUI/HYDROGUI_DataObject.h index 72f31ed5..ea9fb38c 100644 --- a/src/HYDROGUI/HYDROGUI_DataObject.h +++ b/src/HYDROGUI/HYDROGUI_DataObject.h @@ -85,6 +85,11 @@ public: */ virtual QColor color( const ColorRole, const int = NameId ) const; + /** + * Returns the object icon. + */ + virtual QPixmap icon( const int = NameId ) const; + /** * Returns the model data object. */ @@ -121,6 +126,7 @@ protected: Handle(HYDROData_Entity) myData; ///< object from data model QString myParentEntry; bool myIsValid; ///< indicates if the object is valid + QPixmap myIcon; }; /** @@ -154,9 +160,15 @@ public: */ virtual QString name() const; + /** + * Returns the object icon. + */ + virtual QPixmap icon( const int = NameId ) const; + private: QString myName; ///< name in the OB QString myParentEntry; + QPixmap myIcon; }; /** diff --git a/src/HYDROGUI/resources/HYDROGUI_images.ts b/src/HYDROGUI/resources/HYDROGUI_images.ts index 633906cf..c2b9f7a8 100644 --- a/src/HYDROGUI/resources/HYDROGUI_images.ts +++ b/src/HYDROGUI/resources/HYDROGUI_images.ts @@ -22,5 +22,93 @@ UNDO_ICO icon_undo.png + + PARTITION_ICO + icon_partition.png + + + HYDRO_TYPE0_ICO + icon_hydro_obj.png + + + HYDRO_TYPE1_ICO + icon_image.png + + + HYDRO_TYPE2_ICO + icon_polyline.png + + + HYDRO_TYPE3_ICO + icon_bathymetry.png + + + HYDRO_TYPE4_ICO + icon_hydro_obj.png + + + HYDRO_TYPE5_ICO + icon_hydro_obj.png + + + HYDRO_TYPE6_ICO + icon_river.png + + + HYDRO_TYPE7_ICO + icon_stream.png + + + HYDRO_TYPE8_ICO + icon_hydro_obj.png + + + HYDRO_TYPE9_ICO + icon_hydro_obj.png + + + HYDRO_TYPE10_ICO + icon_obstacle.png + + + HYDRO_TYPE11_ICO + icon_hydro_obj.png + + + HYDRO_TYPE12_ICO + icon_profile.png + + + HYDRO_TYPE13_ICO + icon_hydro_obj.png + + + HYDRO_TYPE14_ICO + icon_polyline_xy.png + + + HYDRO_TYPE15_ICO + icon_calculation.png + + + HYDRO_TYPE16_ICO + icon_hydro_obj.png + + + HYDRO_TYPE17_ICO + icon_hydro_obj.png + + + HYDRO_TYPE18_ICO + icon_vis_state.png + + + HYDRO_TYPE19_ICO + icon_artobj.png + + + HYDRO_TYPE20_ICO + icon_hydro_obj.png + diff --git a/src/HYDROGUI/resources/icon_artobj.png b/src/HYDROGUI/resources/icon_artobj.png new file mode 100644 index 00000000..6dd0b2aa Binary files /dev/null and b/src/HYDROGUI/resources/icon_artobj.png differ diff --git a/src/HYDROGUI/resources/icon_bathymetry.png b/src/HYDROGUI/resources/icon_bathymetry.png new file mode 100644 index 00000000..59c4544d Binary files /dev/null and b/src/HYDROGUI/resources/icon_bathymetry.png differ diff --git a/src/HYDROGUI/resources/icon_calculation.png b/src/HYDROGUI/resources/icon_calculation.png new file mode 100644 index 00000000..005fdd1f Binary files /dev/null and b/src/HYDROGUI/resources/icon_calculation.png differ diff --git a/src/HYDROGUI/resources/icon_hydro_obj.png b/src/HYDROGUI/resources/icon_hydro_obj.png new file mode 100644 index 00000000..e48ff95e Binary files /dev/null and b/src/HYDROGUI/resources/icon_hydro_obj.png differ diff --git a/src/HYDROGUI/resources/icon_image.png b/src/HYDROGUI/resources/icon_image.png new file mode 100644 index 00000000..e8b8d51c Binary files /dev/null and b/src/HYDROGUI/resources/icon_image.png differ diff --git a/src/HYDROGUI/resources/icon_obstacle.png b/src/HYDROGUI/resources/icon_obstacle.png new file mode 100644 index 00000000..44279dce Binary files /dev/null and b/src/HYDROGUI/resources/icon_obstacle.png differ diff --git a/src/HYDROGUI/resources/icon_partition.png b/src/HYDROGUI/resources/icon_partition.png new file mode 100644 index 00000000..f1ed9abe Binary files /dev/null and b/src/HYDROGUI/resources/icon_partition.png differ diff --git a/src/HYDROGUI/resources/icon_polyline.png b/src/HYDROGUI/resources/icon_polyline.png new file mode 100644 index 00000000..7ab0765e Binary files /dev/null and b/src/HYDROGUI/resources/icon_polyline.png differ diff --git a/src/HYDROGUI/resources/icon_polyline_xy.png b/src/HYDROGUI/resources/icon_polyline_xy.png new file mode 100644 index 00000000..e33487d9 Binary files /dev/null and b/src/HYDROGUI/resources/icon_polyline_xy.png differ diff --git a/src/HYDROGUI/resources/icon_profile.png b/src/HYDROGUI/resources/icon_profile.png new file mode 100644 index 00000000..83f75d91 Binary files /dev/null and b/src/HYDROGUI/resources/icon_profile.png differ diff --git a/src/HYDROGUI/resources/icon_river.png b/src/HYDROGUI/resources/icon_river.png new file mode 100644 index 00000000..0f23f0ee Binary files /dev/null and b/src/HYDROGUI/resources/icon_river.png differ diff --git a/src/HYDROGUI/resources/icon_stream.png b/src/HYDROGUI/resources/icon_stream.png new file mode 100644 index 00000000..cff29e0e Binary files /dev/null and b/src/HYDROGUI/resources/icon_stream.png differ diff --git a/src/HYDROGUI/resources/icon_vis_state.png b/src/HYDROGUI/resources/icon_vis_state.png new file mode 100644 index 00000000..b17fe38c Binary files /dev/null and b/src/HYDROGUI/resources/icon_vis_state.png differ