1
votes

I am attempting to make the arrow buttons on a spinbox appear disabled when the value in the spin box is at either the maximum or minimum.

I am using a QStyleSheet which contains:

QAbstractSpinBox::up-arrow:off, QAbstractSpinBox::up-arrow:disabled {
    background: #131313;
}

However, the 'off' pseudo state is not being set when I set the spinbox to the maximum value. Thus, this style is never being applied.

I have tried:

  • Using QSpinBox, QDoubleSpinBox selectors as above
  • setting other properties such as width and height

I know the style is reading correctly because if I disable the SpinBox altogether, this styling shows up.

Any ideas?

1

1 Answers

0
votes

Most spin boxes are directional, but QSpinBox can also operate as a circular spin box, i.e. if the range is 0-99 and the current value is 99, clicking "up" will give 0 if wrapping() is set to true. Use setWrapping() if you want circular behavior.