Results 1 to 3 of 3

Thread: Stylesheets

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

    Default Stylesheets

    Hello, how to import a qss file into my application, i dont wanna use an internal string variable, I'm planning to import it from a file since there's gonna be a lot of customization...

    in setStyleSheet you can only specify a string, where can I specify a file name?

  2. #2
    Join Date
    Sep 2009
    Posts
    5
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Stylesheets

    i am sorry for being impatient but anyway i hope i am being useful, i figured it out by myself

    Qt Code:
    1. QFIle file("path/to/file.qss");
    2. file.open(QFile::ReadOnly);
    3. QString styleSheet = QLating1String(file.readAll());
    4. myapp->setStyleSheet(styleSheet);
    To copy to clipboard, switch view to plain text mode 

    sorry for troubles again

  3. #3
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Stylesheets

    Just as a side note
    Qt Code:
    1. QFile file("path/to/file.qss");
    2. file.open(QFile::ReadOnly);
    3. myapp->setStyleSheet(file.readAll());
    4. file.close();
    To copy to clipboard, switch view to plain text mode 
    saves a not used local variable and an unnecessary transformation.

Similar Threads

  1. StyleSheets: border-image performance
    By GuS in forum Qt Programming
    Replies: 3
    Last Post: 15th May 2013, 12:42
  2. Replies: 0
    Last Post: 10th August 2009, 20:21
  3. QToolButton and StyleSheets.
    By steb in forum Qt Programming
    Replies: 9
    Last Post: 28th May 2009, 20:51
  4. QScrollbar Stylesheets problems in Qt4.4
    By GuS in forum Qt Programming
    Replies: 2
    Last Post: 6th September 2008, 20:37
  5. Stylesheets on QSplashScreen
    By GuS in forum Qt Programming
    Replies: 0
    Last Post: 16th July 2008, 14:50

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
  •  
Qt is a trademark of The Qt Company.