The problem is that your icon is just in a folder on your classpath. I'm having 
the same problem in my program. Try to put your program and icon in a jar file 
and then run the program. You will see that everything works then fine. Can you 
try that?

I've put a lot of file one the classpath: configuration, images, stylesheets, 
etc. When I create a jar-file of my program, everything works like expected, 
but if I just put everything in a folder on the classpath, none of my files our 
found. It seems there is a bug in the refactoring that was done in Qt Jambi 4.4

I've posted my problem in the post: "[Qt Jambi 4.4] QFile bug" of 12 March 2008

/Dimitri


Bruno Janvier <[EMAIL PROTECTED]> wrote:
 
> Bruno Janvier <[EMAIL PROTECTED]> wrote:
 
> Hello,
> 
> the icons do not appear anymore using qt jambi 4.4 preview.
> In the following program, I see the following text printed on system.out:
> bmp
> gif
> jpeg
> jpg
> mng
> pbm
> pgm
> png
> ppm
> tif
> tiff
> xbm
> xpm
> 
> and I see the push button without any icon: it is all grey. I attach the 
> png icon I want to display.
> I have checked and the "images/iconshock/48/file_48.png" is definitely 
> in the classpath...
> 
> here is my sample code:
> 
> import java.util.List;
> 
> import com.trolltech.qt.core.QByteArray;
> import com.trolltech.qt.gui.QApplication;
> import com.trolltech.qt.gui.QIcon;
> import com.trolltech.qt.gui.QImageReader;
> import com.trolltech.qt.gui.QPushButton;
> 
> public class Test {
>     public static void main(String[] args) {
>         QApplication.initialize(args);
>         showSupportedImageFormats();
>         QPushButton but = new QPushButton();
>         but.resize(50,50);
>         but.setIcon(new QIcon("classpath:images/iconshock/48/file_48.png"));
>         but.show();
>         QApplication.exec();
>     }
>    
>     public static void showSupportedImageFormats() {
>         final List<QByteArray> QtAcceleratedImageFormats = 
> QImageReader.supportedImageFormats();
> 
>         for (int i = 0; i < QtAcceleratedImageFormats.size(); ++i) {
>             System.out.println(QtAcceleratedImageFormats.get(i).toString());
>         }
>     }
> }
>  
> 
> 

_______________________________________________
Qt-jambi-interest mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest

Reply via email to