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. QSpinBox behaves strangely when padding is set
Qt 6.11 is out! See what's new in the release blog

QSpinBox behaves strangely when padding is set

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 305 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.
  • R Offline
    R Offline
    rida_zouga
    wrote last edited by
    #1

    in QtDesigner, I am styling a QSpinBox with just simply padding: 5px, but this happens when cursor enters or leaves the QSpinBox:
    413c7b28-8876-45b1-b05a-cc638df29a37-image.png
    I hope you can see that gray kind of padding surrounding it (since I can't post an .avif which shows better the flickering). I tried manipulating the values exactly as well as demonstrated in qt documentation like this:

    QSpinBox {
    	font-size: 18px;
    	border-width: 1px;
    	padding: 5px;
    }
    
    QSpinBox::up-button {
        subcontrol-origin: border;
        subcontrol-position: top right; /* position at the top right corner */
        width: 4px; /* 4 + 2*1px border-width = 5px padding + 1px parent border */
        border-width: 1px;
    }
    
    QSpinBox::down-button {
        subcontrol-origin: border;
        subcontrol-position: bottom right; /* position at the top right corner */
        width: 4px; /* 4 + 2*1px border-width = 5px padding + 1px parent border */
        border-width: 1px;
    }
    

    but this completly hides the up and down buttons and so is the border of QSpinBox and couldn't find any similar issue out there.

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

      What style do you use and did you enable scaling for your monitor?

      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
      • R Offline
        R Offline
        rida_zouga
        wrote last edited by
        #3

        I don't know what you mean by style but for monitor scaling even though I changed it to 100% still the same effect

        Christian EhrlicherC 1 Reply Last reply
        0
        • R rida_zouga

          I don't know what you mean by style but for monitor scaling even though I changed it to 100% still the same effect

          Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote last edited by
          #4

          @rida_zouga said in QSpinBox behaves strangely when padding is set:

          don't know what you mean by style

          Style: https://doc.qt.io/qt-6/qapplication.html#setStyle
          What OS do you use?

          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
          • R Offline
            R Offline
            rida_zouga
            wrote last edited by
            #5

            using windows 10, and for style not using anything at all, so default for windows 10 I suppose

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

              So it's the windowsvista style. I can reproduce it but no idea how to fix it. You might create a bug report -> bugreports.qt.io

              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