Results 1 to 2 of 2

Thread: QT Dialog Localizing Images

  1. #1
    Join Date
    Sep 2008
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question QT Dialog Localizing Images

    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
    Qt Code:
    1. label = new QLabel(Dialog);
    2. label->setObjectName(QString::fromUtf8("label"));
    3. label->setGeometry(QRect(150, 60, 151, 131));
    4. label->setPixmap(QPixmap(QString::fromUtf8(":/newPrefix/pic1.jpg")));
    To copy to clipboard, switch view to plain text mode 

    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
    Last edited by jacek; 11th September 2008 at 20:47. Reason: changed [qtclass] to [code]

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,518 Times in 1,388 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QT Dialog Localizing Images

    Do you call
    Qt Code:
    1. label->setPixmap(QPixmap(QString::fromUtf8(":/newPrefix/pic1.jpg")));
    To copy to clipboard, switch view to plain text mode 
    after changing the locale?
    J-P Nurmi

Similar Threads

  1. Replies: 2
    Last Post: 4th February 2008, 11:00
  2. Open/Save dialog with images preview
    By mchara in forum Qt Programming
    Replies: 8
    Last Post: 5th November 2007, 07:25
  3. Replies: 3
    Last Post: 17th May 2007, 13:50
  4. dialog box
    By Bahar in forum Qt Programming
    Replies: 3
    Last Post: 31st January 2006, 14:52

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.