|
From: Mojca M. <moj...@gm...> - 2012-03-12 03:59:58
|
On Mon, Mar 12, 2012 at 04:29, sfeam (Ethan Merritt) wrote:
> On Sunday, 11 March 2012, Mojca Miklavec wrote:
>
>> I think that simply replacing xpm file with svg file either in
>> QtGnuplotResource.qrc or in source code should work
>
> The documentation says:
> "First, create an ICO format bitmap file that contains the icon image."
Where exactly does it say that?
> So I don't think svg is going to work.
I'm not sure how it is under windows or linux, but it definitely works
under Mac.
(After all, gnuplot includes "export to SVG", so Qt must have SVG support.)
> The documentation then goes on to note that installation of icons under
> OSX and linux varies widely with the platform. Here's what it says about
> OSX:
> "To ensure that the correct icon appears, both when the application
> is being launched, and in the Finder, it is necessary to employ a
> platform-dependent technique."
Sure. But this is hardly related. I'm not talking about icon "in the
Finder" and I'm not talking about icon under Windows. I'm only talking
about the icon that is seen when Qt window pops up and that one must
be way less platform-dependent if dependent at all.
I have no problem creating Mac-specific icon, but at the moment there
is no single place where I could put it. One has to create a bundled
application and we don't have that, so Mac-specific solution wouldn't
help anyone.
> I have no idea what that means in the context of OSX (isn't it all one
> "platform"?) but anyhow I have no idea how to do anything that works
> cross-platform, and it least from the docs it seems svg is not supported.
I tested it last time and it worked fine for me. But I didn't test on
windows or linux. On the sourceforge page there is a sample program:
#include <QApplication>
#include <QTextEdit>
#include <QIcon>
int main(int argv, char **args)
{
QApplication app(argv, args);
QTextEdit textEdit;
textEdit.show();
QIcon appIcon;
appIcon.addFile("icon.svg");
QApplication::setWindowIcon(appIcon);
app.exec();
}
I can compile it with (I just copied the flags from gnuplot, some may
not be necessary):
g++ hello.cpp -I/Library/Frameworks/QtCore.framework/Headers
-I/Library/Frameworks/QtGui.framework/Headers
-I/Library/Frameworks/QtNetwork.framework/Headers
-I/Library/Frameworks/QtSvg.framework/Headers -F/Library/Frameworks
-framework QtCore -framework QtGui -framework QtNetwork -framework
QtSvg -o hello
and when I run it, I get an application with that SVG image as an icon
(when switching between programs with alt-tab and as displayed on
dock). But I can send a patch for gnuplot that does the same.
I didn't test it yet, but in principle it's just about replacing
setWindowIcon(QIcon(":/images/gnuplot"));
with
QIcon appIcon;
appIcon.addFile("icon.svg");
setWindowIcon(appIcon);
or about changing resource file.
Mojca
|