Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QSpinBox arrow buttons blank



  • I have a delegate, derived from a QAbstractItemDelegate, that provides a QSpinBox.

    When that QSpinBox is displayed, the up/down buttons are there, but they are blank. On the windows version, they have little arrow heads on them, so I'm guessing this is some kind of preference gathered from my Linux desktop.

    I really want the arrow heads to be there. I tried QSpinBox::setButtonSymbols, but it made no difference. How can I make the arrow heads appear on the buttons?

    I found a way to do it with style sheets, but it seems I can only apply one style at a time. By which I mean, if I do this:

    editor->setStyleSheet("QSpinBox::up-arrow {  width: 7px;  height: 7px; }");
    editor->setStyleSheet("QSpinBox::down-arrow {  width: 10px;  height: 7px; }");
    

    I get just the down arrow

    If I do this:

    editor->setStyleSheet("QSpinBox::down-arrow {  width: 10px;  height: 7px; }");
    editor->setStyleSheet("QSpinBox::up-arrow {  width: 7px;  height: 7px; }");
    

    I get just the up arrow.

    I want the up arrow AND the down arrow, but I can't find in the documentation how to apply both at the same time. What's the stylesheet string format to put the QSpinBox::down-arrow and the QSpinBox::up-arrow in at the same time?

    I'm also trying to use the stylesheet to set the size of the QSpinBox, but I'll be happy for the moment with just both arrows visible at the same time.



  • @Moschops
    Try it together

    spinBox->setStyleSheet("QSpinBox::up-arrow {  width: 7px;  height: 7px; }"
                         "QSpinBox::down-arrow {  width: 10px;  height: 7px; }");
    

Log in to reply