On Thu, Nov 12, 2015 at 09:14:02PM +0100, Georg Baum wrote:
> Vincent van Ravesteijn wrote:
> 
> > In any case, the logic is a bit strange. The icon names are defined
> > with the extension {png,svgz} so that any one matched, and getPixmap
> > checks whether the file can be loaded or not. However, iconName then
> > already decides on whether it is png or svgz just based on existence,
> > not on whether it can be loaded.
> > 
> > So, either we make QtSvg a "required" dependency, and cmake/autotools
> > should check for it, or we improve the logic to decide whether we lood
> > the png or svgz variant.
> 
> For 2.2 I'd prefer to improve the logic, since it is the first release which 
> includes the svg icons. For 2.3 we can get rid of the .pngs.
> 
> Does the attached patch help?

Note that Qt4 can deal perfectly fine with svgz. The only ways it
can fail are 1) the library was compiled without support for zlib;
2) the qsvg plugin is missing; 3) the library was compiled statically.

For case 1, the attached patch might help (I think it requires that
gunzip is in the path).
For case 2, simply put the qsvg.dll plugin where Qt expects it.
For case 3, the plugin is only available through a static library and
one needs to tweak the LyX sources for linking it. It suffices adding
the following two lines to (for example) main.cpp

#include <QtPlugin>
Q_IMPORT_PLUGIN(qsvg)

and then adding the libqsvg static library to the final link command.

-- 
Enrico
diff --git a/src/frontends/qt4/GuiApplication.cpp 
b/src/frontends/qt4/GuiApplication.cpp
index 5e213e6..51335a1 100644
--- a/src/frontends/qt4/GuiApplication.cpp
+++ b/src/frontends/qt4/GuiApplication.cpp
@@ -569,7 +569,13 @@ QString iconName(FuncRequest const & f, bool unknown)
 
 bool getPixmap(QPixmap & pixmap, QString const & path)
 {
-       if (pixmap.load(path)) {
+#if QT_VERSION < 0x050000 && defined(Q_OS_WIN) 
+    QString const fpath = path.endsWith(".svgz")
+           ? toqstr(unzipFile(FileName(fromqstr(path))).absFileName()) : path;
+#else
+    QString const & fpath = path;
+#endif
+       if (pixmap.load(fpath)) {
 #if QT_VERSION >= 0x050000
                if (path.endsWith(".svgz") || path.endsWith(".svg") ) {
                        GuiApplication const * guiApp = theGuiApp();

Reply via email to