[Kde-bindings] C#, Qyoto, Qt - How to add icons to project?

linuxoidoz at yahoo.com.au linuxoidoz at yahoo.com.au
Sat Feb 20 04:52:24 UTC 2010

Ok, I got it. I made a resource file in Qt Creator and looked how they do that and then copied the idea:

1. Make a resources.qrc file in any text editor

    <qresource prefix="/myresources">

assuming the resources.qrc in in the main project folder /project and the icons are in /project/icons

2. Convert the Qt resource file into C#

csrcc -o resources.cs resources.qrc

3. Add resources.cs to your project and set 'Allow unsafe code' in the project settings.
4. Add this to main.cs


Qyoto rocks!.. most of the times

------------------  Original Message  ------------------
Subject: Re: [Kde-bindings] C#, Qyoto, Qt - How to add icons to project?
Date: Sat, 20 Feb 2010
From: linuxoidoz at yahoo.com.au
To: kde-bindings at kde.org

> Hello,
> I have a few icons which I add to my buttons:
> 	public QIcon iconVideo;
> 	public QIcon iconAudio;
> 	public QIcon iconImage;
> 	...
> 		iconVideo = new QIcon("icons/video.svg");
> 		iconAudio = new QIcon("icons/audio.svg");
> 		iconImage = new QIcon("icons/image.svg");
> 		btnVideo = new QPushButton(iconVideo, "", this);
> 		btnAudio = new QPushButton(iconAudio, "", this);
> 		btnImage = new QPushButton(iconImage, "", this);
> I store the icons in the project/icons folder + I also added the icons to the /bin/Debug/icons/ just in case.
> When I build and run the project, the application shows the icons fine. But when I run the executable by itself, none of the icons show up. I've tried a few things but none worked.
> 1. I added the /icons folder to the project and tried different build actions - no icons
> 2. I made a resources.qrc file:
> <!DOCTYPE RCC><RCC version="1.0">
>  <qresource>
>      <file>icons/video.svg</file>
>      <file>icons/audio.svg</file>
>      <file>icons/image.svg</file>
>  </qresource>
>  </RCC> 
> then compiled it with 'csrcc -o resources.cs resources.qrc', added the resources.cs file to the project - still no icons.
> Please help. Thank you.
> _______________________________________________
> Kde-bindings mailing list
> Kde-bindings at kde.org
> https://mail.kde.org/mailman/listinfo/kde-bindings

More information about the Kde-bindings mailing list