Results 1 to 2 of 2

Thread: Dynamic Translation of resource based images used for style sheet ?

  1. #1
    Join Date
    Feb 2011
    Posts
    6
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question Dynamic Translation of resource based images used for style sheet ?

    I'm modifying a splitter handle by assigning an image from a resource.
    Qt Code:
    1. setStyleSheet(QString("QSplitter::handle {image: url(:/images/zoom-in.png)} \
    2. QSplitter::handle:pressed {image: url(:/images/star.png)}"));
    To copy to clipboard, switch view to plain text mode 
    The resource file uses locale dependent aliases.
    Qt Code:
    1. <RCC>
    2. <qresource prefix="images">
    3. <file>star.png</file>
    4. <file>zoom-in.png</file>
    5. </qresource>
    6. <qresource prefix="images" lang="de">
    7. <file alias="star.png">star_de.png</file>
    8. <file alias="zoom-in.png">zoom-in_de.png</file>
    9. </qresource>
    10. <qresource prefix="images" lang="en">
    11. <file alias="star.png">star_en.png</file>
    12. <file alias="zoom-in.png">zoom-in_en.png</file>
    13. </qresource>
    14. </RCC>
    To copy to clipboard, switch view to plain text mode 
    This works fine as long as I do a QLocale::setDefault() at application launch (main).
    Questions: Is it possible to make the style sheet consider the different images
    when changing the language/locale at runtime ?

    Joerg

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Dynamic Translation of resource based images used for style sheet ?

    Stylesheet is evaluated only once when it is applied.If you want to re-evaluate it you need to set (the same) stylesheet again.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    rantanplan (14th February 2011)

Similar Threads

  1. Problems with Gradient style used through Style sheet on ARM platform
    By puneet.narsapur in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 25th January 2010, 12:48
  2. Translation for qt based libraries
    By elektritter in forum Installation and Deployment
    Replies: 3
    Last Post: 15th August 2009, 07:46
  3. Problem with dynamic translation
    By keo in forum Qt Programming
    Replies: 2
    Last Post: 29th July 2009, 10:36
  4. Dynamic translation for ComboBox
    By Rakesh_Kumar in forum Qt Programming
    Replies: 1
    Last Post: 24th February 2009, 11:27
  5. multiple images in style sheet
    By CopyrightPhilly in forum Qt Programming
    Replies: 2
    Last Post: 2nd October 2007, 17:28

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.