Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. when setting the style buttons change size
Forum Updated to NodeBB v4.3 + New Features

when setting the style buttons change size

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 4 Posters 786 Views 1 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.
  • M Offline
    M Offline
    Mikeeeeee
    wrote on last edited by
    #1

    Hi.
    In the designer created 4 buttons. The buttons are the same size.
    In the designer I set the style of the buttons. After that, the buttons change their size under the borders of the text.
    How to fix it?

    ui->button0Page6->setStyleSheet(QString::fromUtf8("background-color: rgb(43, 104, 255); color:white; border: 3px solid white; border-radius: 10px;"));
        ui->button1Page6->setStyleSheet(QString::fromUtf8("background-color: rgb(43, 104, 255); color:white; border: 3px solid white; border-radius: 10px;"));
        ui->button2Page6->setStyleSheet(QString::fromUtf8("background-color: rgb(43, 104, 255); color:white; border: 3px solid white; border-radius: 10px;"));
        ui->button3Page6->setStyleSheet(QString::fromUtf8("background-color: rgb(43, 104, 255); color:white; border: 3px solid white; border-radius: 10px;"));
    
    KillerSmathK 1 Reply Last reply
    0
    • M Mikeeeeee

      Hi.
      In the designer created 4 buttons. The buttons are the same size.
      In the designer I set the style of the buttons. After that, the buttons change their size under the borders of the text.
      How to fix it?

      ui->button0Page6->setStyleSheet(QString::fromUtf8("background-color: rgb(43, 104, 255); color:white; border: 3px solid white; border-radius: 10px;"));
          ui->button1Page6->setStyleSheet(QString::fromUtf8("background-color: rgb(43, 104, 255); color:white; border: 3px solid white; border-radius: 10px;"));
          ui->button2Page6->setStyleSheet(QString::fromUtf8("background-color: rgb(43, 104, 255); color:white; border: 3px solid white; border-radius: 10px;"));
          ui->button3Page6->setStyleSheet(QString::fromUtf8("background-color: rgb(43, 104, 255); color:white; border: 3px solid white; border-radius: 10px;"));
      
      KillerSmathK Offline
      KillerSmathK Offline
      KillerSmath
      wrote on last edited by
      #2

      @Mikeeeeee

      After that, the buttons change their size under the borders of the text.

      Can you provide us a better explanation of what is your issue?

      @Computer Science Student - Brazil
      Web Developer and Researcher
      “Sometimes it’s the people no one imagines anything of who do the things that no one can imagine.” - Alan Turing

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Mikeeeeee
        wrote on last edited by
        #3

        @KillerSmath said in when setting the style buttons change size:

        Can you provide us a better explanation of what is your issue?

        Before I change StyleSheet, the ratio of buttons is 1: 1: 1: 1.
        After changing StyleSheet the ratio of buttons is 2: 3: 1: 3 (depending on the length of the text in the button).

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          When using stylesheets, the system style is not used anymore so the rendering will change. So if you want your button to have a specific size, you may have set it yourself.

          Can you show a picture of your buttons with and without the style sheet ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • M Offline
            M Offline
            Mikeeeeee
            wrote on last edited by
            #5

            @SGaist said in when setting the style buttons change size:

            Hi,
            When using stylesheets, the system style is not used anymore so the rendering will change. So if you want your button to have a specific size, you may have set it yourself.
            Can you show a picture of your buttons with and without the style sheet ?

            Yes, she is drawn.
            How to set the desired property in the style? How is the default?

            1 Reply Last reply
            0
            • Christian EhrlicherC Offline
              Christian EhrlicherC Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Mikeeeeee said in when setting the style buttons change size:

              How to set the desired property in the style?

              See Qt Stylesheet Reference for QPushButton

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              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