cbarmpar
30th September 2008, 01:24
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:
#ifndef KENTRIKO_H
#define KENTRIKO_H
#include <QtGui/QMainWindow>
#include "ui_kentriko.h"
class kentriko : public QMainWindow
{
Q_OBJECT
public:
kentriko(QWidget *parent = 0);
~kentriko();
public slots:
void anixe();
void diagrafi(QLineEdit* grami2);
private:
Ui::kentrikoClass ui;
};
#endif // KENTRIKO_H
and the implementation:
#include "kentriko.h"
#include <QTimer>
kentriko::kentriko(QWidget *parent)
: QMainWindow(parent)
{
ui.setupUi(this);
connect(ui.grami,SIGNAL(textChanged ( const QString &)),this,SLOT(anixe()));
//
}
void kentriko::anixe(){
QLineEdit* grami2 = new QLineEdit(this);
grami2->setObjectName(QString::fromUtf8("grami2"));
grami2->setGeometry(QRect(60, 80, 180, 25));
grami2->show();
QTimer::singleShot(3000, this, SLOT(diagrafi(grami2 )));
ui.label->setText("kalispera");
}
void kentriko::diagrafi(QLineEdit* grami2){
grami2->hide();
}
Any ideas about why is the program crasing when the timer expires?
Many thanks in advance.
Regards.
Object::connect: No such slot kentriko::diagrafi(grami2)
Object::connect: (receiver name: 'kentrikoClass')
the code:
#ifndef KENTRIKO_H
#define KENTRIKO_H
#include <QtGui/QMainWindow>
#include "ui_kentriko.h"
class kentriko : public QMainWindow
{
Q_OBJECT
public:
kentriko(QWidget *parent = 0);
~kentriko();
public slots:
void anixe();
void diagrafi(QLineEdit* grami2);
private:
Ui::kentrikoClass ui;
};
#endif // KENTRIKO_H
and the implementation:
#include "kentriko.h"
#include <QTimer>
kentriko::kentriko(QWidget *parent)
: QMainWindow(parent)
{
ui.setupUi(this);
connect(ui.grami,SIGNAL(textChanged ( const QString &)),this,SLOT(anixe()));
//
}
void kentriko::anixe(){
QLineEdit* grami2 = new QLineEdit(this);
grami2->setObjectName(QString::fromUtf8("grami2"));
grami2->setGeometry(QRect(60, 80, 180, 25));
grami2->show();
QTimer::singleShot(3000, this, SLOT(diagrafi(grami2 )));
ui.label->setText("kalispera");
}
void kentriko::diagrafi(QLineEdit* grami2){
grami2->hide();
}
Any ideas about why is the program crasing when the timer expires?
Many thanks in advance.
Regards.