Hello!

I have a small problem with connecting the custom signal and the custom slot(Object::connect: No such signal)

Here is the code, what I have:

datedialog.h:

Qt Code:
  1. #ifndef DATEDIALOG_H
  2. #define DATEDIALOG_H
  3.  
  4. #include <QDialog>
  5. class QLineEdit;
  6.  
  7. class DateDialog:public QDialog
  8. {
  9. Q_OBJECT
  10.  
  11. public:
  12. DateDialog(QWidget *parent = 0);
  13. signals:
  14. void SendText(const QString &text);
  15.  
  16. private:
  17. void Initialization();
  18. void PlacingElements();
  19.  
  20. private slots:
  21. void EnableOKButton(const QString &text);
  22. void GetDateToLine();
  23. void BeforeShowMsg();
  24. void ShowMessageBox(const QString &text);
  25.  
  26. private:
  27. QCalendarWidget *calendar;
  28. QLineEdit *line;
  29. QPushButton *OkButton;
  30.  
  31. };
  32.  
  33. #endif // DATEDIALOG_H
To copy to clipboard, switch view to plain text mode 

datedialog.cpp

Qt Code:
  1. #include "datedialog.h"
  2. #include <QHBoxLayout>
  3. #include <QCalendarWidget>
  4. #include <QLineEdit>
  5. #include <QPushButton>
  6. #include <QIcon>
  7. #include <QString>
  8. #include <QMessageBox>
  9.  
  10. DateDialog::DateDialog(QWidget *parent):QDialog(parent)
  11. {
  12. Initialization();
  13. }
  14.  
  15. void DateDialog::Initialization()
  16. {
  17. calendar = new QCalendarWidget();
  18. line = new QLineEdit();
  19. line->setFocus();
  20. OkButton = new QPushButton(QObject::tr("Press me!"));
  21. OkButton->setDefault(true);
  22. OkButton->setEnabled(false);
  23. connect(this->calendar, SIGNAL(selectionChanged()),
  24. this, SLOT(GetDateToLine()));
  25. connect(this->line, SIGNAL(textChanged(const QString &)),
  26. this, SLOT(EnableOKButton(const QString &)));
  27. connect(this->OkButton, SIGNAL(clicked()),
  28. this, SLOT(BeforeShowMsg()));
  29. connect(this, SIGNAL(SendText(cosnt QString &)),
  30. this, SLOT(ShowMessageBox(const QString &)));
  31. PlacingElements();
  32. }
  33.  
  34. void DateDialog::PlacingElements()
  35. {
  36. QHBoxLayout *leftTop = new QHBoxLayout;
  37. leftTop->addWidget(this->line);
  38. QHBoxLayout *leftDown = new QHBoxLayout;
  39. leftDown->addWidget(OkButton);
  40.  
  41. QVBoxLayout *left = new QVBoxLayout;
  42. left->addLayout(leftTop);
  43. left->addStretch();
  44. left->addLayout(leftDown);
  45.  
  46. QVBoxLayout *right = new QVBoxLayout;
  47. right->addWidget(this->calendar);
  48.  
  49. QHBoxLayout *main = new QHBoxLayout;
  50. main->addLayout(left);
  51. main->addLayout(right);
  52.  
  53. this->setLayout(main);
  54. this->setWindowTitle(QObject::tr("Date"));
  55.  
  56. QString FilePath = "E:\\linux-penguin-computing.jpg";
  57. this->setWindowIcon(QIcon(FilePath));
  58. this->setFixedSize(sizeHint().width(), sizeHint().height());
  59. }
  60.  
  61. void DateDialog::EnableOKButton(const QString &text)
  62. {
  63. this->OkButton->setEnabled(!text.isEmpty());
  64. OkButton->setEnabled(true);
  65. }
  66.  
  67. void DateDialog::GetDateToLine()
  68. {
  69. this->line->setText(calendar->selectedDate().toString("dd/MM/yyyy dddd"));
  70. }
  71.  
  72. void DateDialog::ShowMessageBox(const QString &text)
  73. {
  74. msg.setText(text);
  75. msg.setWindowTitle(QObject::tr("Information before closing"));
  76. msg.setIcon(QMessageBox::Warning);
  77. msg.exec();
  78. this->close();
  79. }
  80.  
  81. void DateDialog::BeforeShowMsg()
  82. {
  83. if(!line->text().isEmpty())
  84. {
  85. emit SendText(line->text());
  86. }
  87. }
To copy to clipboard, switch view to plain text mode 

main.cpp:

Qt Code:
  1. #include <QtGui/QApplication>
  2. #include "datedialog.h"
  3.  
  4. int main(int argc, char *argv[])
  5. {
  6. QApplication app(argc, argv);
  7.  
  8. DateDialog date;
  9. date.exec();
  10.  
  11. return app.exec();
  12. }
To copy to clipboard, switch view to plain text mode 

The first question that I have is: why?
And the second one is: How it can be rectified?

Thank you beforehand for answers.