Loop mathematics
-
I got a combo box representing values from 50-90 in a combo.
However the combo lists every value between those two numbers e.i. 50,51,52,53,54.....
How can i modify my code to have the box only show multiples of 5.
This is my code at the moment
for (int i = 50; i < 91; i++) { ui->comboBox_Alert->addItem(QString::number(i) + "%"); }
-
[quote author="davidrhcp" date="1399296936"]i'm using a combo box but i'm sure that shouldn't change much.[/quote]
It does! The QSpinBox is made specifically for entering numbers. And it has a configurable “singleStep” property. Should be exactly what you need :-)
See here:
http://qt-project.org/doc/qt-4.8/qspinbox.html[quote author="davidrhcp" date="1399296936"]I'm very beginner at this i would not know where to start implementing that command[/quote]
What command?