Results 1 to 2 of 2

Thread: setStyleSheet

  1. #1
    Join Date
    Dec 2017
    Posts
    19
    Thanks
    10
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default setStyleSheet

    Hi,
    if I want to set a font-family:
    Qt Code:
    1. setStyleSheet("QLineEdit { font-family: "Times New Roman"; font-size: 14px; height: 120px; width: 30px; }");
    To copy to clipboard, switch view to plain text mode 
    Double quotations which inserted to define font-family, cause problem.
    I know that if I exchange them to single quotation code will be executed well.
    But is there anyway to define all stylesheet codes in a block and call them as needed, or any alternative solution?
    I'm beginner.

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: setStyleSheet

    It's basic C / C++: if you want to insert quotation marks into a string literal, you have to escape them "\"".
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

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

    CodeFreak (15th August 2018)

Similar Threads

  1. setStyleSheet not working
    By neel5481 in forum Qt Programming
    Replies: 3
    Last Post: 18th December 2015, 11:38
  2. Promlems with setStyleSheet
    By franco.amato in forum Qt Programming
    Replies: 1
    Last Post: 17th June 2011, 01:35
  3. QToolButton & setStyleSheet
    By kavinsiva in forum Newbie
    Replies: 1
    Last Post: 3rd June 2010, 15:52
  4. QTableWidget and setStyleSheet()
    By kazek3018 in forum Newbie
    Replies: 3
    Last Post: 30th December 2008, 09:52
  5. using setStyleSheet
    By Weilor in forum Qt Programming
    Replies: 11
    Last Post: 18th January 2008, 14:41

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.