[Solved] Specifying a font using CSS



  • In the constructor of my form I use the following code:
    @
    setStyleSheet("QPushButton:pressed { background-color: #FFFFFF; }"
    "QPushButton { background-color: #0099FF; border: 1px solid #909090; border-radius: 7px; }"
    "QLabel { background-color: #FFFF99; border-radius: 7px; font: "DejaVu Serif" 10pt; }"
    );
    @
    I'm trying to specify DejaVu Serif as my font. The quotation marks don't work because it fools the compiler into thinking it's the end of the line. No quotation marks don't work either. What character sequence do I need to use in order to have my font recognized?


  • Moderators

    You need to backslash escape " your quotes around the font name, perhaps?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.