I'm creating my first app with my own slot .
Everything goes sooo fine till now . However when I want to create my own slot , nothing is happened (i.e. slot didn't work !! )

The purpose of my App : when the user press a button , an empty .txt file 'll be created .

I'm working under MS Win XP , & I've tried to run it over Linux to find out the problem . I've such that output :

Object::connect: No such slot QDialog::Custom()
Object::connect: (sender name: 'pushButton')
Object::connect: (receiver name: 'Form')

Though , I've add such this slot "Custom" @ QTDesign .

I've got .exe BUT the slot never responds ( i.e. Createing the file )

I've added a little piece of code @ the header file which was generated , is that true !!
I'm using :
- qt-win-opensource-4.4.0
- qmake to build the project
-MinGw
N.B. : I've created the slot , according to what I've understand from QT Assistant

So , What' the problem @ My Code :

Qt Code:
  1. /********************************************************************************
  2. ** Form generated from reading ui file 'Test.ui'
  3. **
  4. ** Created: Mon Jun 2 06:29:48 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. // **************** My Own Code *********************
  22. #include <stdio.h>
  23.  
  24. // **************** My Own Code *********************
  25.  
  26. QT_BEGIN_NAMESPACE
  27.  
  28. class Ui_Form
  29. {
  30.  
  31. public:
  32. QPushButton *pushButton;
  33. QLineEdit *lineEdit;
  34.  
  35. void setupUi(QWidget *Form)
  36. {
  37. if (Form->objectName().isEmpty())
  38. Form->setObjectName(QString::fromUtf8("Form"));
  39. Form->resize(475, 393);
  40. pushButton = new QPushButton(Form);
  41. pushButton->setObjectName(QString::fromUtf8("pushButton"));
  42. pushButton->setGeometry(QRect(170, 190, 75, 24));
  43. lineEdit = new QLineEdit(Form);
  44. lineEdit->setObjectName(QString::fromUtf8("lineEdit"));
  45. lineEdit->setGeometry(QRect(160, 90, 113, 20));
  46.  
  47. retranslateUi(Form);
  48. QObject::connect(pushButton, SIGNAL(pressed()), Form, SLOT(Custom()));
  49. QMetaObject::connectSlotsByName(Form);
  50. } // setupUi
  51.  
  52. void retranslateUi(QWidget *Form)
  53. {
  54. Form->setWindowTitle(QApplication::translate("Form", "Form", 0, QApplication::UnicodeUTF8));
  55. pushButton->setText(QApplication::translate("Form", "PushButton", 0, QApplication::UnicodeUTF8));
  56. lineEdit->setText(QString());
  57. Q_UNUSED(Form);
  58. } // retranslateUi
  59.  
  60.  
  61. // **************** My Own Code *********************
  62. public slots:
  63. void Custom();
  64. //******* My Own Code *********************
  65.  
  66. };
  67.  
  68. // **************** My Own Code *********************
  69. void Ui_Form::Custom()
  70. {
  71. FILE * pFile;
  72. pFile = fopen ("C:/Documents and Settings/Ahmed Osama/Desktop/myfile.txt","w");
  73. }
  74. // **************** My Own Code *********************
  75.  
  76. namespace Ui {
  77. class Form: public Ui_Form {};
  78. } // namespace Ui
  79.  
  80. QT_END_NAMESPACE
  81.  
  82. #endif // UI_TEST_H
To copy to clipboard, switch view to plain text mode 


Thanks