i downloaded a book about qt programming but its outdated because its version is something like qt4. while i got the latest Qt5.0.2 creator and compiler which i downloaded from qt-project.org/downloads. I've read from chapter 1 and everything seems to work fine but when i reached chapter 2, which includes header, thebody and the main, i received a lot of errors so here is my code...im running windows

in the creator i clicked--File->New Project->Other Project->Empty Qt Project->then i named it finddialog->next2x->Finished

then in the project named finddialog i right clicked it->Add New->C++ Source File->i named it main.cpp->then finished.

then in the project named finddialog again i right clicked it->Add New->C++ Class->class name: finddialog, base class: i chose QWidget->then Finished.

so here is the code in the header file...
Qt Code:
  1. #ifndef FINDDIALOG_H
  2. 2 #define FINDDIALOG_H
  3.  
  4. 3 #include <QDialog>
  5.  
  6. 4 class QCheckBox;
  7. 5 class QLabel;
  8. 6 class QLineEdit;
  9. 7 class QPushButton;
  10. 8 class FindDialog : public QDialog
  11. 9 {
  12. 10 Q_OBJECT
  13.  
  14. 11 public:
  15. 12 FindDialog(QWidget *parent = 0);
  16. 13 signals:
  17. 14 void findNext(const QString &str, Qt::CaseSensitivity cs);
  18. 15 void findPrevious(const QString &str, Qt::CaseSensitivity cs);
  19. 16 private slots:
  20. 17 void findClicked();
  21. 18 void enableFindButton(const QString &text);
  22.  
  23. 19 private:
  24. 20 QLabel *label;
  25. 21 QLineEdit *lineEdit;
  26. 22 QCheckBox *caseCheckBox;
  27. 23 QCheckBox *backwardCheckBox;
  28. 24 QPushButton *findButton;
  29. 25 QPushButton *closeButton;
  30. 26 };
  31.  
  32. 27 #endif
To copy to clipboard, switch view to plain text mode 

then in the finddialog.cpp here is the code
Qt Code:
  1. 1 #include <QtGui>
  2.  
  3. 2 #include "finddialog.h"
  4. 3 FindDialog::FindDialog(QWidget *parent)
  5. 4 : QDialog(parent)
  6. 5 {
  7. 6 label = new QLabel(tr("Find &what:"));
  8. 7 lineEdit = new QLineEdit;
  9. 8 label->setBuddy(lineEdit);
  10.  
  11. 9 caseCheckBox = new QCheckBox(tr("Match &case"));
  12. 10 backwardCheckBox = new QCheckBox(tr("Search &backward"));
  13.  
  14. 11 findButton = new QPushButton(tr("&Find"));
  15. 12 findButton->setDefault(true);
  16. 13 findButton->setEnabled(false);
  17.  
  18. 14 closeButton = new QPushButton(tr("Close"));
  19.  
  20. 15 connect(lineEdit, SIGNAL(textChanged(const QString &)),
  21. 16 this, SLOT(enableFindButton(const QString &)));
  22. 17 connect(findButton, SIGNAL(clicked()),
  23. 18 this, SLOT(findClicked()));
  24. 19 connect(closeButton, SIGNAL(clicked()),
  25. 20 this, SLOT(close()));
  26. 21 QHBoxLayout *topLeftLayout = new QHBoxLayout;
  27. 22 topLeftLayout->addWidget(label);
  28. 23 topLeftLayout->addWidget(lineEdit);
  29.  
  30. 24 QVBoxLayout *leftLayout = new QVBoxLayout;
  31. 25 leftLayout->addLayout(topLeftLayout);
  32. 26 leftLayout->addWidget(caseCheckBox);
  33. 27 leftLayout->addWidget(backwardCheckBox);
  34.  
  35. 28 QVBoxLayout *rightLayout = new QVBoxLayout;
  36. 29 rightLayout->addWidget(findButton);
  37. 30 rightLayout->addWidget(closeButton);
  38. 31 rightLayout->addStretch();
  39.  
  40. 32 QHBoxLayout *mainLayout = new QHBoxLayout;
  41. 33 mainLayout->addLayout(leftLayout);
  42. 34 mainLayout->addLayout(rightLayout);
  43. 35 setLayout(mainLayout);
  44. 36 setWindowTitle(tr("Find"));
  45. 37 setFixedHeight(sizeHint().height());
  46. 38 }
  47. 39 void FindDialog::findClicked()
  48. 40 {
  49. 41 QString text = lineEdit->text();
  50. 42 Qt::CaseSensitivity cs =
  51. 43 caseCheckBox->isChecked() ? Qt::CaseSensitive
  52. 44 : Qt::CaseInsensitive;
  53. 45 if (backwardCheckBox->isChecked()) {
  54. 46 emit findPrevious(text, cs);
  55. 47 } else {
  56. 48 emit findNext(text, cs);
  57. 49 }
  58. 50 }
  59.  
  60. 51 void FindDialog::enableFindButton(const QString &text)
  61. 52 {
  62. 53 findButton->setEnabled(!text.isEmpty());
  63. 54 }
To copy to clipboard, switch view to plain text mode 

and the last one in is the main.cpp here it is....
Qt Code:
  1. 1 #include <QWidgets/QApplication>
  2.  
  3. 2 #include "finddialog.h"
  4.  
  5. 3 int main(int argc, char *argv[])
  6. 4 {
  7. 5 QApplication app(argc, argv);
  8. 6 FindDialog *dialog = new FindDialog;
  9. 7 dialog->show();
  10. 8 return app.exec();
  11. 9 }
To copy to clipboard, switch view to plain text mode 

When run and compile this i got 46 errors.
In the .pro file i did type this QT += widgets

Did i miss something more important? The codes the i entered above will surely works on qt4 but im currently running the latest Qt5.0.2 packaged which i thought will not give me problems...