Showing negative values of axis on the progress bar
-
Hi everyone. I have 8 different progress bar. In the code below, im showing the positive values of my array. I want to display negative values also. How can i do it?
When i put else and write the other progress bar on gui, it didnt work true```
if(dizi[1] > 0 || dizi[2] > 0 || dizi[3] > 0 || dizi[4] > 0) { ui->progressBarAx->setValue(dizi[1]); ui->progressBarAy->setValue(dizi[2]); ui->progressBarBx->setValue(dizi[3]); ui->progressBarBy->setValue(dizi[4]); }
-
@suslucoder well, have you set your minimum of the progress bar beforehand to a value, that is below 0?
-
@suslucoder said in Showing negative values of axis on the progress bar:
can i put this
AFAIK yes, why don't you try it ?
-
int main(int argc, char *argv[]) { QApplication app(argc, argv); QProgressBar pbar; pbar.setRange( -50,50); pbar.setValue(-50); pbar.setOrientation(Qt::Horizontal); pbar.show(); pbar.resize(200,50); QTimer t; QObject::connect(&t, &QTimer::timeout, [&t, &pbar]()->void{ auto nextValue = pbar.value()+1; if(nextValue > pbar.maximum()){ t.stop(); return; } pbar.setValue(nextValue); }); t.start(500); return app.exec(); }
-
@suslucoder said in Showing negative values of axis on the progress bar:
It doesnt work true still.
Show your code.
-
@suslucoder said in Showing negative values of axis on the progress bar:
if(dizi[1] > 0 || dizi[2] > 0 || dizi[3] > 0 || dizi[4] > 0)
If this is from your code, then it will only update the progress bars if at least one of the 4 values is greater 0. Furthermore, if your array/vector
dizi
has 4 entries you need to use indices 0 through 3. -
@SimonSchroeder I want to update my progress bar, if one of these values greater than 0. For example if the dizi[1] > 0, update.
I dont want to see dizi[0]. Because of it i started from 1