]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
#1309 Management of icons: loadIcon in icon factory, sketch->parallel icon processing
authornds <nds@opencascade.com>
Fri, 15 Apr 2016 12:42:07 +0000 (15:42 +0300)
committernds <nds@opencascade.com>
Fri, 15 Apr 2016 12:42:07 +0000 (15:42 +0300)
src/ModuleBase/ModuleBase_IconFactory.cpp
src/ModuleBase/ModuleBase_IconFactory.h
src/PartSet/PartSet_icons.qrc
src/PartSet/icons/parallel.png [deleted file]
src/SketchPlugin/CMakeLists.txt
src/SketchPlugin/icons/parallel.png [new file with mode: 0644]
src/SketchPlugin/plugin-Sketch.xml

index ed2719816e245dba947607a30edce4ed24e98c57..479e681cce7bbbfa839f34abba1e4f2781f1f528 100644 (file)
@@ -34,3 +34,14 @@ QIcon ModuleBase_IconFactory::getIcon(ObjectPtr theIcon)
 {
   return QIcon();
 }
+
+QIcon ModuleBase_IconFactory::loadIcon(const QString& theValue)
+{
+  QIcon anIcon(theValue);
+
+  if (anIcon.isNull()) {
+    
+  }
+
+  return anIcon;
+}
index 1fda9b43b44ef773455b874404ce4be3d6f24cc5..5ea4c4273ac9669ee17f0569c18f6aff19a43cfa 100644 (file)
@@ -25,6 +25,13 @@ public:
   /// \param theObj an object
   virtual QIcon getIcon(ObjectPtr theObj);
 
+  /// Finds an icon for the given object. The icon is loaded: firstly from qrc file,
+  /// then by the icon path. If the path contains ":" , it will be treated as absolute path to
+  /// the icon, or relative path from the plugin library
+  /// \param theValue an icon information
+  /// \return a loaded or empty icon
+  static QIcon loadIcon(const QString& theValue);
+
 protected:
   ModuleBase_IconFactory();
 
index fada5b9de22373fb1e611a98e8fda2df4e22e454..87a2d7dc9242c476aa5231bf4aff3b325cab47f2 100644 (file)
@@ -45,7 +45,6 @@
      <file>icons/dimension_v.png</file>
      <file>icons/radius.png</file>
      <file>icons/perpendicular.png</file>
-     <file>icons/parallel.png</file>
      <file>icons/partition.png</file>
      <file>icons/length.png</file>
      <file>icons/distance.png</file>
diff --git a/src/PartSet/icons/parallel.png b/src/PartSet/icons/parallel.png
deleted file mode 100644 (file)
index 8d152d3..0000000
Binary files a/src/PartSet/icons/parallel.png and /dev/null differ
index 77f7e1f327488f289476f990347f5f427a0b43b2..165ad0f4262b8d5f616a1bdb262a646233f286f5 100644 (file)
@@ -101,8 +101,13 @@ INCLUDE_DIRECTORIES(
   ../SketcherPrs
 )
 
+SET(ICON_RESOURCES
+  icons/parallel.png
+)
+
 INSTALL(TARGETS SketchPlugin DESTINATION ${SHAPER_INSTALL_PLUGIN_FILES})
 INSTALL(FILES ${XML_RESOURCES} DESTINATION ${SHAPER_INSTALL_XML_RESOURCES})
+INSTALL(FILES ${ICON_RESOURCES} DESTINATION ${SHAPER_INSTALL_XML_RESOURCES})
 
 ADD_UNIT_TESTS(TestSketchPointLine.py
                TestSketchArcCircle.py
diff --git a/src/SketchPlugin/icons/parallel.png b/src/SketchPlugin/icons/parallel.png
new file mode 100644 (file)
index 0000000..8d152d3
Binary files /dev/null and b/src/SketchPlugin/icons/parallel.png differ
index 725bc554b3879467143adf478da9815ea5691d27..38b0854d055c941fcab2618bc6ec1d569227a7f3 100644 (file)
       </feature>
 
       <!--  SketchConstraintParallel  -->
-      <feature id="SketchConstraintParallel" title="Parallel" tooltip="Create constraint defining two parallel lines" icon=":icons/parallel.png">
+      <feature id="SketchConstraintParallel" title="Parallel" tooltip="Create constraint defining two parallel lines"
+               icon="parallel.png">
         <sketch_shape_selector id="ConstraintEntityA" 
             label="First line" tooltip="Select a line" shape_types="edge">
           <validator id="GeomValidators_ShapeType" parameters="line"/>