PDA

View Full Version : QT Dialog Localizing Images



nomad1980
10th September 2008, 19:34
Hello , I am a QT newbie. I am experimenting with QT localization support , so i am facing some problems in localizing images for a label .

I created a QDialog with a label in it . I am creating the label using the following code


label = new QLabel(Dialog);
label->setObjectName(QString::fromUtf8("label"));
label->setGeometry(QRect(150, 60, 151, 131));
label->setPixmap(QPixmap(QString::fromUtf8(":/newPrefix/pic1.jpg")));


The QRC file referenced above is like this


<RCC>
<qresource prefix="newPrefix" lang="en" >
<file>pic1.jpg</file>
</qresource>
<qresource prefix="newPrefix" lang="fi" >
<file>pic2 .jpg</file>
</qresource>
<qresource prefix="newPrefix" lang="de" >
<file>pic2 .jpg</file>
</qresource>
</RCC>


I created pro ( added RESOURCES += test.qrc also ) , makefiles and run mingw32-make to generate the binaries . When i run the program in default locale( en) it is displaying the Label with Image .

But if i changed the Locale to DE or FI and run the app , the image is not displaying in the label . Ideally if i choose DE , pic2.jpg should display as per the QRC contract ?

Any idea what is the problem , am i missing anything ?

can some one help

jpn
12th September 2008, 18:53
Do you call


label->setPixmap(QPixmap(QString::fromUtf8(":/newPrefix/pic1.jpg")));

after changing the locale?