Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    QPushButton and QLabel font size

    Mobile and Embedded
    3
    8
    4015
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Awadhesh Maurya
      Awadhesh Maurya last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • musimbate
        musimbate last edited by

        Maybe QFont class may help.

        Why join the navy if you can be a pirate?-Steve Jobs

        1 Reply Last reply Reply Quote 0
        • Awadhesh Maurya
          Awadhesh Maurya last edited by

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

          1 Reply Last reply Reply Quote 0
          • Awadhesh Maurya
            Awadhesh Maurya last edited by

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

            1 Reply Last reply Reply Quote 0
            • Chris Kawa
              Chris Kawa Moderators last edited by

              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.

              1 Reply Last reply Reply Quote 0
              • Awadhesh Maurya
                Awadhesh Maurya last edited by

                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.

                1 Reply Last reply Reply Quote 0
                • Chris Kawa
                  Chris Kawa Moderators last edited by

                  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?

                  1 Reply Last reply Reply Quote 0
                  • Awadhesh Maurya
                    Awadhesh Maurya last edited by

                    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);

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post