PDA

View Full Version : My first app not working



Noks
2nd February 2010, 13:06
HEllo people,
I am following the book of qt4-the art of building qt applications..the below problem is of a byte converter ..but there is a logical error ...please help me rectify it...files uploaded.
Thanks

squidge
2nd February 2010, 13:31
What kind of logical error?

Noks
2nd February 2010, 15:12
You just try to run the program...you yourselves will find it..there is some problem with the code....but i cant figure it out.........

Archimedes
2nd February 2010, 15:15
Your problem lies in the constructor in 47-49 lines



connect(decEdit, SIGNAL(textChanged(const QString&)),this, SLOT(decChanged(const QString&)));
connect(hexEdit, SIGNAL(textChanged(const QString&)),this, SLOT(hexChanged(const QString&)));
connect(binEdit, SIGNAL(textChanged(const QString&)),this, SLOT(binChanged(const QString&)));


Replace with these:



connect(decEdit, SIGNAL(textEdited(const QString&)),this, SLOT(decChanged(const QString&)));
connect(hexEdit, SIGNAL(textEdited(const QString&)),this, SLOT(hexChanged(const QString&)));
connect(binEdit, SIGNAL(textEdited(const QString&)),this, SLOT(binChanged(const QString&)));


The difference is the signal that the lineEdit emits.
textEdit(...) isn't emitted when you call setText(), but textChanged(...) does. So your problem was everytime
you setText() in your class's slots the textChanged(...) signal was called again and again...

Noks
2nd February 2010, 16:00
By The Way ...where is the option to delete posts...i am not able to see it
Thanks

Noks
2nd February 2010, 16:07
Well thanks,
It started working....But could you please provide some more details.....i am a noob with Line edits.,.....basically what is textchanged and texedited?
Thanks

Archimedes
2nd February 2010, 16:34
A very detailed description of QLineEdit is here http://doc.qt.nokia.com/4.6/qlineedit.html :D