Hi Im a new user of qt creator and Im creating my first interface, I need to reset the values of 16 doublespinboxes to 0 with a botton, I dont know how to set the values of a spinbox to 0 in qt creator
Hi Im a new user of qt creator and Im creating my first interface, I need to reset the values of 16 doublespinboxes to 0 with a botton, I dont know how to set the values of a spinbox to 0 in qt creator
cmdg (17th July 2012)
Thanks I probe it but the program show me '->' is not a pointer. What should be the problem?
there are two way of doing it
Qt Code:
Spinbox = spin; spin.setValue(0); //or if you do it with a pointer // in the Header: Spinbox *spin; spin = new Spinbox; spin->setValueTo copy to clipboard, switch view to plain text mode
How are you creating QSpinBox? Are you writing code or using Qt Designer?
When you know how to do it then you may do it wrong.
When you don't know how to do it then it is not that you may do it wrong but you may not do it right.
Im working on qt designer. The problem is that I put a value manually in each one of the 16 spinboxes and I need to put all in 0 with a button like a reset but the codes I found in the web dont work.
Set the QSpinBox object name by right click on QSpinBox in Qt Designer and "Change objectName", set to "spinXX", where XX is the number of spin box.
Then write a slot with code like spinXX->setValue(0); for all the spinboxes, and then connect this slot to the pushbutton clicked signal
When you know how to do it then you may do it wrong.
When you don't know how to do it then it is not that you may do it wrong but you may not do it right.
I've already connected that slot to the pushbutton clicked signal but I also need to put spinXX->setValue(0) inside the function and it doesn't work. This is my code
int MainWindow::new_file()
{
angle_1->setValue(0.0);
}
It show me again the same mistake: /home/vivi/Documentos/tesis/Codigo Interfaces Vivi/MSR-build-desktop/../MSR/mainwindow.cpp:310: error: base operand of ‘->’ is not a pointer
Bookmarks