Important: Please read the Qt Code of Conduct -

Qt resources doesn't work in windows platform

  • Hi Guys:
    I met a problem. I compiled Qt 4.8.5 with MinGW 4.8.1. When I used an embeded resources in my project, I found that I can't use code like @ QPixmap pixmap(":/images/abc.jpg")@ to create a Pixmap. I know that pixmap already created but which's width() and height() is 0, and used same code in Linux, I found that it works.
    I don't why it doesn't work in windows. And I don't how can I makt it worked.
    Help me.

  • And if you try through a QLabel like this:
    QLabel *label = new QLabel(this);
    Does it work?

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Since you compiled Qt yourself, are you sure the jpeg plugin was compiled ? (should be but one never knows)

    You can get a list of known readable image format using:

    @qDebug() << QImageReader::supportedImageFormats();@

  • thanks for SGaist, I saw it, witch can not support jpeg. I'm compling qt project with -qt-jpeg -qt-tiff -qt-png. Maybe tomorrow I will know the answer.

  • Thank you, SGaist. you helped me lot. I recompiled the qt project, it's still compiling. But jpeg format worked.

  • Lifetime Qt Champion

    Glad you have it working now

    Can you also please update the thread title prepending [solved] so other forum users may know a solution has been found :)

Log in to reply