Hi all! I'm new to Qt.I need you help.

It's a simple Dialog base app. the dialog has two lineEdits to receive input data.
And I use a 2 label to display the results of the transformation of the two lineEdits.

Qt Code:
  1. #include<QtGui>
  2. #include"dencaler.h"
  3.  
  4. Dencaler::Dencaler(QWidget *parent):QDialog(parent)
  5. {
  6. setupUi(this);
  7. //make lineedits only accepte a certain double
  8. knownTemperatureLineEdit->setValidator(new QDoubleValidator(15.0,101.0,2,knownTemperatureLineEdit));
  9. knowDensityLineEdit->setValidator(new QDoubleValidator(0.1,1.2,2,knowDensityLineEdit));
  10. // Are the above Validators OK? I found that they couldn't work properly. They can accept numbers like this:10000.0.
  11. // I just want the first lineEdit to accept double 15.00~101.00
  12. // and the second lineEdit to accept double range 0.10~1.20
  13.  
  14.  
  15. //connect sigal to slot to make update available
  16. connect(okButton, SIGNAL(clicked()), this, SLOT(update()));
  17. }
  18.  
  19. void Dencaler::on_knowDensityLineEdit_textChanged()
  20. {
  21. okButton->setEnabled(knownTemperatureLineEdit->hasAcceptableInput()&&knowDensityLineEdit->hasAcceptableInput());
  22. // Only the two lineEdit get proper numbers can enable the OK button.
  23. }
  24.  
  25. void Dencaler::update()
  26. {
  27. //implement calculation for the dialog
  28. double val1=(knownTemperatureLineEdit->text()).toDouble();
  29. double val2=(knowDensityLineEdit->text()).toDouble();
  30. double sum=val1+val2;
  31. // Implement plus to simulate data transformation.
  32.  
  33. char str[8];
  34. sprintf(str,"%f",sum);
  35. label20->setText(QString(str));
  36. sprintf(str,"%f",sum+0.3);
  37. label15->setText(QString(str));
  38. QDialog::update();
  39. //Update date in the dialog.
  40. }
To copy to clipboard, switch view to plain text mode 

I had posted the main questions inside the code.
By the way, I still want to set two icons for my app. one for the program, and the other in the dialog title bar following by the dialog title.

If you have any advises, please help! Thanks for your attention.