QPushButton and QLabel font size



  • Hi,
    I want to set font size 80 px, 100px, 200px in QLabel or QPushButton , but after 30px it is not working. My setting code:
    infolabel->setStyleSheet("QLabel { font : 100px; font-weight:600; background-color : lightblue; color : black; qproperty-alignment: AlignTop;}");

    Actually I want to set QPushButton font style like QLCDNumber's font.

    Please suggest me how to do these.

    Thanking you.



  • Maybe QFont class may help.



  • QFont is also working same way, after 40 its not working.



  • I want to set font like QLCDNumber text style of QPushButton. Is it posiible? if yes, how can I do it.


  • Moderators

    Maybe there's a cap for the size in the font you selected? What font are you using?
    The QLCDNumber does not use a font but just draws the numbers manually in paintEvent.

    If you want a similar font you might look for one on various sites like dafont, e.g. this one. Just check the license to make sure it suits you.



  • I am using font size 40, above this its not changing, i.e. 40 and 72 fonts are same size. I have tried many others 80, 90, 100, but its not changing. Below 40 its working OK.


  • Moderators

    As I said - maybe that's the cap for your font. Have you tried changing your font to something else ('Arial', 'Verdana' etc.)? Which font do you use?



  • I have tried for Arial Black, Times Roman etc but all are same.
    confButton = new QPushButton();
    QFont* font1 = new QFont("Verdana");
    //QFont* font1 = new QFont("Arial Black");
    //QFont* font1 = new QFont("Times Roman");
    //font1->setItalic(true);
    font1->setBold(true);
    font1->setPixelSize(60);
    font1->setPointSize(100);
    confButton->setStyleSheet("QPushButton {background-color : lightblue; color : black;}");
    confButton->setFont(*font1);
    confButton->setText("conf");
    //confButton->setMinimumWidth(68);
    confButton->setMinimumHeight(80);


Log in to reply
 

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