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
							
						
					
					
						
    
    
    
    
    
    
  
    
    
    
    
  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
							
								
							
								
							
								
							
								
							
								
							
						
					
					
						
    
    
    
    
    
    
  
    
    
    
    
  What kind of logical error?
							
						
					
					
						
    
    
    
    
    
    
  
    
    
    
    
  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.........
							
						
					
					
						
    
    
    
    
    
    
  
    
    
      
    
    
      
    
    
    
  Your problem lies in the constructor in 47-49 lines
Qt Code:
 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&)));To copy to clipboard, switch view to plain text mode
Replace with these:
Qt Code:
 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&)));To copy to clipboard, switch view to plain text mode
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...
Misha R.evolution - High level Debugging IDE
Programming is about 2 basic principles: KISS and RTFM!!!
Noks (2nd February 2010)
							
						
					
					
						
    
    
    
    
    
    
  
    
    
    
    
  By The Way ...where is the option to delete posts...i am not able to see it
Thanks
Last edited by Noks; 2nd February 2010 at 17:15.
							
						
					
					
						
    
    
    
    
    
    
  
    
    
    
    
  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
							
						
					
					
						
    
    
    
    
    
    
  
    
    
      
    
    
      
    
    
    
  A very detailed description of QLineEdit is here http://doc.qt.nokia.com/4.6/qlineedit.html![]()
Misha R.evolution - High level Debugging IDE
Programming is about 2 basic principles: KISS and RTFM!!!
Bookmarks