Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QPushButton and QLabel font size
Forum Updated to NodeBB v4.3 + New Features

QPushButton and QLabel font size

Scheduled Pinned Locked Moved Mobile and Embedded
8 Posts 3 Posters 4.4k Views 3 Watching
  • 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 MauryaA Offline
    Awadhesh MauryaA Offline
    Awadhesh Maurya
    wrote on last edited by
    #1

    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
    0
    • musimbateM Offline
      musimbateM Offline
      musimbate
      wrote on last edited by
      #2

      Maybe QFont class may help.

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

      1 Reply Last reply
      0
      • Awadhesh MauryaA Offline
        Awadhesh MauryaA Offline
        Awadhesh Maurya
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0
        • Awadhesh MauryaA Offline
          Awadhesh MauryaA Offline
          Awadhesh Maurya
          wrote on last edited by
          #4

          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
          0
          • Chris KawaC Offline
            Chris KawaC Offline
            Chris Kawa
            Lifetime Qt Champion
            wrote on last edited by
            #5

            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
            0
            • Awadhesh MauryaA Offline
              Awadhesh MauryaA Offline
              Awadhesh Maurya
              wrote on last edited by
              #6

              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
              0
              • Chris KawaC Offline
                Chris KawaC Offline
                Chris Kawa
                Lifetime Qt Champion
                wrote on last edited by
                #7

                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
                0
                • Awadhesh MauryaA Offline
                  Awadhesh MauryaA Offline
                  Awadhesh Maurya
                  wrote on last edited by
                  #8

                  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
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved