spinbox up/down buttons not hidding correctly
-
I'm using a spinbox of which I want to hide the up/down buttons. So I use this NoButtons symbol as follow :
distanceBox->setButtonSymbols(QAbstractSpinBox::NoButtons);
The buttons seems hidden, but their layout is still here. I mean the space they should occupy is still here. And so the text appear truncated. See my text which should be '116.96 mm'.
Is there a way to fix this? Thanks !!
-
I'm using a spinbox of which I want to hide the up/down buttons. So I use this NoButtons symbol as follow :
distanceBox->setButtonSymbols(QAbstractSpinBox::NoButtons);
The buttons seems hidden, but their layout is still here. I mean the space they should occupy is still here. And so the text appear truncated. See my text which should be '116.96 mm'.
Is there a way to fix this? Thanks !!
-
I'm using a spinbox of which I want to hide the up/down buttons. So I use this NoButtons symbol as follow :
distanceBox->setButtonSymbols(QAbstractSpinBox::NoButtons);
The buttons seems hidden, but their layout is still here. I mean the space they should occupy is still here. And so the text appear truncated. See my text which should be '116.96 mm'.
Is there a way to fix this? Thanks !!
-
Thanks.
Yes the docs don't advertize this noButton as an option, so it's probably not supported and known to work not correctly@Paddle Both Qt 5 and Qt 6 document QAbstractSpinBox::NoButtons. Since the spin button flags are part of the abstract class, it comes down to the concrete class and the relevant style to honour the intent of the flags.
If you do not want a QSpinBox, which seems evident given you will not have the controls, then why use one? A QTextEdit sub-class with a validator and suffix handling may be a better option.
-