From 5b5158fa94240f54398c6dc3d15fdd76b6349375 Mon Sep 17 00:00:00 2001 From: nds Date: Fri, 15 Apr 2016 15:42:07 +0300 Subject: [PATCH] #1309 Management of icons: loadIcon in icon factory, sketch->parallel icon processing --- src/ModuleBase/ModuleBase_IconFactory.cpp | 11 +++++++++++ src/ModuleBase/ModuleBase_IconFactory.h | 7 +++++++ src/PartSet/PartSet_icons.qrc | 1 - src/SketchPlugin/CMakeLists.txt | 5 +++++ src/{PartSet => SketchPlugin}/icons/parallel.png | Bin src/SketchPlugin/plugin-Sketch.xml | 3 ++- 6 files changed, 25 insertions(+), 2 deletions(-) rename src/{PartSet => SketchPlugin}/icons/parallel.png (100%) diff --git a/src/ModuleBase/ModuleBase_IconFactory.cpp b/src/ModuleBase/ModuleBase_IconFactory.cpp index ed2719816..479e681cc 100644 --- a/src/ModuleBase/ModuleBase_IconFactory.cpp +++ b/src/ModuleBase/ModuleBase_IconFactory.cpp @@ -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; +} diff --git a/src/ModuleBase/ModuleBase_IconFactory.h b/src/ModuleBase/ModuleBase_IconFactory.h index 1fda9b43b..5ea4c4273 100644 --- a/src/ModuleBase/ModuleBase_IconFactory.h +++ b/src/ModuleBase/ModuleBase_IconFactory.h @@ -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(); diff --git a/src/PartSet/PartSet_icons.qrc b/src/PartSet/PartSet_icons.qrc index fada5b9de..87a2d7dc9 100644 --- a/src/PartSet/PartSet_icons.qrc +++ b/src/PartSet/PartSet_icons.qrc @@ -45,7 +45,6 @@ icons/dimension_v.png icons/radius.png icons/perpendicular.png - icons/parallel.png icons/partition.png icons/length.png icons/distance.png diff --git a/src/SketchPlugin/CMakeLists.txt b/src/SketchPlugin/CMakeLists.txt index 77f7e1f32..165ad0f42 100644 --- a/src/SketchPlugin/CMakeLists.txt +++ b/src/SketchPlugin/CMakeLists.txt @@ -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/PartSet/icons/parallel.png b/src/SketchPlugin/icons/parallel.png similarity index 100% rename from src/PartSet/icons/parallel.png rename to src/SketchPlugin/icons/parallel.png diff --git a/src/SketchPlugin/plugin-Sketch.xml b/src/SketchPlugin/plugin-Sketch.xml index 725bc554b..38b0854d0 100644 --- a/src/SketchPlugin/plugin-Sketch.xml +++ b/src/SketchPlugin/plugin-Sketch.xml @@ -379,7 +379,8 @@ - + -- 2.39.2