View Full Version : Problems with a spinbox Qt creator
cmdg
16th July 2012, 20:51
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
wysota
16th July 2012, 21:34
spinbox->setValue(0);
cmdg
17th July 2012, 01:04
Thanks I probe it but the program show me '->' is not a pointer. What should be the problem?
airglide
17th July 2012, 01:52
there are two way of doing it
Spinbox = spin;
spin.setValue(0);
//or if you do it with a pointer
// in the Header: Spinbox *spin;
spin = new Spinbox;
spin->setValue
Santosh Reddy
17th July 2012, 06:33
How are you creating QSpinBox? Are you writing code or using Qt Designer?
cmdg
18th July 2012, 01:57
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.
Santosh Reddy
18th July 2012, 07:08
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
cmdg
30th July 2012, 18:07
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
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.