I am a newbie for c++ as well as qt. I am trying some example, which i pasted it for
easy understanding. I am trying to compile it through qmake and make command line tool. It compiles successfully but when i try to execute it no form is displayed.
please look into the code help me where i am doing mistake....

Qt Code:
  1. //finddialog.h file
  2.  
  3. #ifndef FINDDIALOG_H
  4. #define FINDDIALOG_H
  5.  
  6. #include<QDialog>
  7.  
  8. class QLineEdit;
  9. class QCheckBox;
  10. class QLabel;
  11.  
  12. class FindDialog:public QDialog
  13. {
  14. Q_OBJECT
  15. public:
  16. FindDialog(QWidget *parent=0);
  17.  
  18. signals:
  19. void findNext(const QString &str,Qt::CaseSensitivity cs);
  20. void findPrevious(const QString &str,Qt::CaseSensitivity cs);
  21.  
  22. public slots:
  23. void findClicked();
  24. void enableFindButton(const QString &text);
  25.  
  26. private:
  27. QLabel *label;
  28. QLineEdit *lineEdit;
  29. QCheckBox *caseCheckBox;
  30. QCheckBox *backwardCheckBox;
  31. QPushButton *findButton;
  32. QPushButton *closeButton;
  33. };
  34. #endif
  35. //************************************************
  36. //finddialog.cpp
  37. #include<QtGui>
  38. #include "finddialog.h"
  39.  
  40. FindDialog::FindDialog(QWidget *parent):QDialog(parent)
  41. {
  42. label=new QLabel("Find &what: ");
  43. lineEdit=new QLineEdit;
  44. label->setBuddy(lineEdit);
  45.  
  46. caseCheckBox=new QCheckBox("Match &case");
  47. backwardCheckBox=new QCheckBox("Search &backward");
  48.  
  49. findButton=new QPushButton("&Find");
  50. findButton->setDefault(true);
  51. findButton->setEnabled(false);
  52.  
  53. closeButton=new QPushButton("Close");
  54.  
  55. connect(lineEdit,SIGNAL(textChanged(const QString &)),
  56. this,SLOT(enableFindButton(const QString &)));
  57. connect(findButton,SIGNAL(clicked()),
  58. this,SLOT(findClicked()));
  59. connect(closeButton,SIGNAL(clicked()),
  60. this,SLOT(close()));
  61.  
  62. QHBoxLayout *topleftLayout=new QHBoxLayout;
  63. topleftLayout->addWidget(label);
  64. topleftLayout->addWidget(lineEdit);
  65.  
  66. QVBoxLayout *leftLayout=new QVBoxLayout;
  67. leftLayout->addLayout(topleftLayout);
  68. leftLayout->addWidget(caseCheckBox);
  69. leftLayout->addWidget(backwardCheckBox);
  70.  
  71. QVBoxLayout *rightLayout=new QVBoxLayout;
  72. rightLayout->addWidget(findButton);
  73. rightLayout->addWidget(closeButton);
  74. rightLayout->addStretch();
  75.  
  76. QHBoxLayout *mainLayout=new QHBoxLayout;
  77. rightLayout->addLayout(leftLayout);
  78. rightLayout->addLayout(rightLayout);
  79. setLayout(mainLayout);
  80.  
  81. setWindowTitle("Find");
  82. setFixedHeight(sizeHint().height());
  83. }
  84.  
  85. void FindDialog::findClicked()
  86. {
  87. QString text=lineEdit->text();
  88. Qt::CaseSensitivity cs=caseCheckBox->isChecked()?
  89. Qt::CaseSensitive:Qt::CaseInsensitive;
  90.  
  91. if(backwardCheckBox->isChecked())
  92. {
  93. emit findPrevious(text,cs);
  94. }
  95. else
  96. {
  97. emit findNext(text,cs);
  98. }
  99. }
  100.  
  101. void FindDialog::enableFindButton(const QString &text)
  102. {
  103. findButton->setEnabled(!text.isEmpty());
  104. }
  105. //*****************************************************
  106. //main.cpp file
  107.  
  108. #include<QApplication>
  109. #include "finddialog.h"
  110.  
  111. int main(int argc,char *argv[])
  112. {
  113. QApplication app(argc,argv);
  114. FindDialog *dialog=new FindDialog;
  115. dialog->show();
  116. return app.exec();
  117. }
  118. //****************************
  119.  
  120. //subdialog.pro file
  121.  
  122. ######################################################################
  123. # Automatically generated by qmake (2.01a) Sat Oct 16 23:27:20 2010
  124. ######################################################################
  125.  
  126. TEMPLATE = app
  127. TARGET =
  128. DEPENDPATH += .
  129. INCLUDEPATH += .
  130.  
  131. # Input
  132. HEADERS += finddialog.h
  133. SOURCES += finddialog.cpp main.cpp
  134. //*********************
To copy to clipboard, switch view to plain text mode