Results 1 to 3 of 3

Thread: How to add a plattform specific stylesheet to a window directly the designer

  1. #1
    Join Date
    Oct 2012
    Posts
    132
    Thanks
    10
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Question How to add a plattform specific stylesheet to a window directly the designer

    Hi,

    I have created a QT application using QT Creator and I compiled a Linux version and a Windows version. For the design of the windows/widgets I'm using a stylesheet. I added that stylesheet to the windows directly in the designer.

    My Question: Is it possible to assign different stylesheets for the different platforms directly in the designer or by modifying the XML-File which is created by the designer? I could simply use the setStyleSheet-Function of the window to set the different stylesheets manually but I would prefer to do that directly in the designer because then I have a preview of my design.

    Is it maybe possible to use a resource file as stylesheet via designer or by modifying the XML-File? If that was possible, is could simply use different stylesheets for the different plattforms by using a platform condition in the project file.

  2. The following user says thank you to Infinity for this useful post:


  3. #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: How to add a plattform specific stylesheet to a window directly the designer

    Quote Originally Posted by Infinity View Post
    My Question: Is it possible to assign different stylesheets for the different platforms directly in the designer or by modifying the XML-File which is created by the designer?
    No, I don't think so.

    Is it maybe possible to use a resource file as stylesheet via designer or by modifying the XML-File?
    Not in Designer. The tool only allows editing a stylesheet in a text window.

    What I can suggest is to have a stylesheet in external file and test it by running your application with a command line argument that will load the stylesheet from this file. Then you can edit the stylesheet in an external tool and still have a quick preview available.

    Another solution would be to implement a global shortcut that will ask the user for a stylesheet file or reload the current one. Then you'll have a live preview too.
    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.


  4. #3
    Join Date
    Oct 2012
    Posts
    132
    Thanks
    10
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: How to add a plattform specific stylesheet to a window directly the designer

    No, I don't think so.
    I already expected that because I found nothing on the Internet.

    But if someone else has an idea, let me know!
    Last edited by Infinity; 14th October 2012 at 21:25.

  5. The following user says thank you to Infinity for this useful post:


Similar Threads

  1. Replies: 4
    Last Post: 7th August 2011, 15:44
  2. Replies: 0
    Last Post: 29th April 2011, 08:24
  3. StyleSheet components using Qt designer
    By Kostanev in forum Qt Tools
    Replies: 1
    Last Post: 21st April 2008, 08:28
  4. Replies: 5
    Last Post: 7th November 2006, 15:01
  5. positioning a window at a specific screen position
    By nupul in forum Qt Programming
    Replies: 3
    Last Post: 29th March 2006, 20:21

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.