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. How to reduce spacing/padding/margin of the text inside QDoubleSpinBox or QSpinBox to zero?

How to reduce spacing/padding/margin of the text inside QDoubleSpinBox or QSpinBox to zero?

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 1.3k 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.
  • F Offline
    F Offline
    FrozenTarzan
    wrote on last edited by
    #1

    This question is a duplicate of this one on stackoverflow.

    Using Qt 4.8. I would like to set the space between the text of a QSpinBoxes/QDoubleSpinBoxes and the right border of the widget to zero. The left one of the following images is what I got, the right one is what I want:
    QSpinBox, QDoubleSpinBox text padding
    Note that I use setButtonSymbols(QAbstractSpinBox::NoButtons) to remove the up/down arrows.

    The spinboxes are styled using QSS where I can set:

    • The padding of the QSpinBox/QDoubleSpinBox to 0px.
    • The padding, the margin and the border of the QLineEdit inside the spinbox to 0px.
    • I have also created a custom QProxyStyle for the QLineEdit but I'm not able to find any related pixel metric enum that I can use to reduce the space
    • I can also try to mess around with the internal QLineControl class which is not possible without fiddling inside Qt's code base. (I have not tried this yet!)
    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