I am trying to display a lineedit for 3 seconds and then make it disappear. The problem is that altough the code compiles properly the program crasses when i run it and sends the following error:
Object::connect: No such slot kentriko::diagrafi(grami2)
Object::connect: (receiver name: 'kentrikoClass')
the code:
Qt Code:
  1. #ifndef KENTRIKO_H
  2. #define KENTRIKO_H
  3.  
  4. #include <QtGui/QMainWindow>
  5. #include "ui_kentriko.h"
  6.  
  7. class kentriko : public QMainWindow
  8. {
  9. Q_OBJECT
  10.  
  11. public:
  12. kentriko(QWidget *parent = 0);
  13. ~kentriko();
  14.  
  15. public slots:
  16. void anixe();
  17. void diagrafi(QLineEdit* grami2);
  18.  
  19. private:
  20. Ui::kentrikoClass ui;
  21. };
  22.  
  23. #endif // KENTRIKO_H
  24.  
  25.  
  26. and the implementation:
  27. #include "kentriko.h"
  28. #include <QTimer>
  29. kentriko::kentriko(QWidget *parent)
  30. : QMainWindow(parent)
  31. {
  32. ui.setupUi(this);
  33. connect(ui.grami,SIGNAL(textChanged ( const QString &)),this,SLOT(anixe()));
  34. //
  35. }
  36.  
  37. void kentriko::anixe(){
  38. QLineEdit* grami2 = new QLineEdit(this);
  39. grami2->setObjectName(QString::fromUtf8("grami2"));
  40. grami2->setGeometry(QRect(60, 80, 180, 25));
  41. grami2->show();
  42. QTimer::singleShot(3000, this, SLOT(diagrafi(grami2 )));
  43. ui.label->setText("kalispera");
  44. }
  45.  
  46. void kentriko::diagrafi(QLineEdit* grami2){
  47. grami2->hide();
  48. }
To copy to clipboard, switch view to plain text mode 

Any ideas about why is the program crasing when the timer expires?

Many thanks in advance.
Regards.