how to decrement spinbox values.
-
I know i have to use setValue but i want to increment and decrement by events.
I have inside a void:
m_ui->spinBox-> setValue(m_ui->spinBox-> value()+1)
this works perfect.Now I want to decrement with:
m_ui->spinBox-> setValue(m_ui->spinBox-> value()-1)
this does not work.
How can I solve that? -
Hello,
I don't want negative values, i want to decrement.
spinBox = 0.
m_ui->spinBox-> setValue(m_ui->spinBox-> value()+1)
spiBox=1
m_ui->spinBox-> setValue(m_ui->spinBox-> value()+1)
spinBox=2
m_ui->spinBox-> setValue(m_ui->spinBox-> value()-1)
spinBox stays at 2 should become 1 -
@mrjj
yes, direct settings work,
increment is good too but decrement with:
m_ui->spinBox-> setValue(m_ui->spinBox-> value()-1)
spinBox stays at 2 should become 1
is not working.
Any an other idea for decrementing by 1 step?
Decrementing by arrows is possible so it should be possible by code too. -
Hi
Try to do it outside a slot.
I think its related to the event loop and how you trigger setValue slot.
Setting the values directly works so it must drop a setValue or something
like that.