Thanks fnmblot as well as Thanks again jpn .
It seems that I'm that kind of annoying students who won't stop questioning

I've made what you 've told me & separated the declaration from the implementation .
However , my slot didn't work yet ?!!
+ How does the header file which generated ,ui_Test.h , can call my CustomSlot ?!!

I've changed a little in my App :
Here are my Codes :

=> Main.cpp 's code is :

Qt Code:
  1. #include <QApplication>
  2. #include <QDialog>
  3.  
  4. #include "ui_Test.h"
  5.  
  6. int main(int argc, char *argv[])
  7. {
  8. QApplication app(argc, argv);
  9.  
  10.  
  11.  
  12. QWidget *widget = new QWidget;
  13. Ui_MyForm ui;
  14. ui.setupUi(widget);
  15.  
  16. widget->show();
  17. return app.exec();
  18. }
To copy to clipboard, switch view to plain text mode 

---------------------------------------------------------------------------------------------------------------


ui_Test.h 's code is :

Qt Code:
  1. /********************************************************************************
  2. ** Form generated from reading ui file 'Test.ui'
  3. **
  4. ** Created: Thu Jun 5 19:58:05 2008
  5. ** by: Qt User Interface Compiler version 4.4.0
  6. **
  7. ** WARNING! All changes made in this file will be lost when recompiling ui file!
  8. ********************************************************************************/
  9.  
  10. #ifndef UI_TEST_H
  11. #define UI_TEST_H
  12.  
  13. #include <QtCore/QVariant>
  14. #include <QtGui/QAction>
  15. #include <QtGui/QApplication>
  16. #include <QtGui/QButtonGroup>
  17. #include <QtGui/QLineEdit>
  18. #include <QtGui/QPushButton>
  19. #include <QtGui/QWidget>
  20.  
  21. QT_BEGIN_NAMESPACE
  22.  
  23. class Ui_MyForm
  24. {
  25. public:
  26. QPushButton *btnCreateFile;
  27. QLineEdit *txtData;
  28.  
  29. void setupUi(QWidget *MyForm)
  30. {
  31. if (MyForm->objectName().isEmpty())
  32. MyForm->setObjectName(QString::fromUtf8("MyForm"));
  33. MyForm->resize(533, 393);
  34. btnCreateFile = new QPushButton(MyForm);
  35. btnCreateFile->setObjectName(QString::fromUtf8("btnCreateFile"));
  36. btnCreateFile->setGeometry(QRect(170, 190, 75, 24));
  37. txtData = new QLineEdit(MyForm);
  38. txtData->setObjectName(QString::fromUtf8("txtData"));
  39. txtData->setGeometry(QRect(160, 90, 113, 20));
  40.  
  41. retranslateUi(MyForm);
  42. QObject::connect(btnCreateFile, SIGNAL(pressed()), MyForm, SLOT(CreateFile()));
  43.  
  44. QMetaObject::connectSlotsByName(MyForm);
  45. } // setupUi
  46.  
  47. void retranslateUi(QWidget *MyForm)
  48. {
  49. MyForm->setWindowTitle(QApplication::translate("MyForm", "Form", 0, QApplication::UnicodeUTF8));
  50. btnCreateFile->setText(QApplication::translate("MyForm", "PushButton", 0, QApplication::UnicodeUTF8));
  51. txtData->setText(QString());
  52. Q_UNUSED(MyForm);
  53. } // retranslateUi
  54.  
  55. };
  56.  
  57. namespace Ui {
  58. class MyForm: public Ui_MyForm {};
  59. } // namespace Ui
  60.  
  61. QT_END_NAMESPACE
  62.  
  63. #endif // UI_TEST_H
To copy to clipboard, switch view to plain text mode 
---------------------------------------------------------------------------------------------------------------

=> CustomSlot.h 's code is :

Qt Code:
  1. #ifndef CustmSlot_Declaration_H
  2. #define CustmSlot_Declaration_H
  3. #include "ui_Test.h"
  4.  
  5. class CustomSlot: public QWidget
  6. {
  7. Q_OBJECT
  8.  
  9. public:
  10. CustomSlot(QWidget *parent = 0);
  11.  
  12. private slots:
  13. void CreateFile();
  14.  
  15.  
  16. private:
  17. Ui_MyForm ui;
  18. };
  19. #endif
To copy to clipboard, switch view to plain text mode 

---------------------------------------------------------------------------------------------------------------

=> CustomSlot.cpp 's code is :

Qt Code:
  1. #include"CustomSlot.h"
  2. #include "ui_Test.h"
  3. #include <stdio.h>
  4.  
  5.  
  6.  
  7.  
  8. CustomSlot::CustomSlot(QWidget *parent)
  9. : QWidget(parent)
  10. {
  11. ui.setupUi(this);
  12. }
  13.  
  14. void CustomSlot:: CreateFile()
  15. {
  16. FILE * pFile;
  17. pFile = fopen ("C:/myfile.txt","w");
  18. }
To copy to clipboard, switch view to plain text mode 

Thanks