QlineEdit + textChanged ?
Verfasst: 23. August 2004 08:30
hi,
ich habe versucht das Beispiel von QLineEdit und dem textChange evtn nachzubauen und erhalte trotzdem folgendes:
QObject::connect: No such signal QLineEdit::textChanged(const QString&)
QObject::connect: (sender name: 'unnamed')
QObject::connect: (receiver name: 'unnamed')
das programm soll eigentlich nur folgendes tun wenn das textfeld nicht leer ist soll der weiter button aktiv werden.
ich habe versucht das Beispiel von QLineEdit und dem textChange evtn nachzubauen und erhalte trotzdem folgendes:
QObject::connect: No such signal QLineEdit::textChanged(const QString&)
QObject::connect: (sender name: 'unnamed')
QObject::connect: (receiver name: 'unnamed')
Code: Alles auswählen
/*************** question.cpp ************/
#include "question.h"
Iclass::Iclass(QWidget *, const char *)
{
myNextBtn = new QPushButton("Weiter >>",this);
myNextBtn->setGeometry(640,700,120,50);
myNextBtn->setFlat(true);
myNextBtn->setEnabled(false);
myNameEdt = new QLineEdit("",this);
myNameEdt->setGeometry(120,30,220,30);
QObject::connect(myNameEdt,SIGNAL(textChanged(const QString&)),this,SLOT(checkFill(const QString&)));
}
void Iclass::checkFill(const QString&)
{
if ( !myNameEdt->text().isEmpty() )
{
myNextBtn->setEnabled(true);
}
};
/*************** question.h ************/
#ifndef ICLASS_H
#define ICLASS_H
#include <qpushbutton.h>
#include <qlineedit.h>
class Iclass : public QWidget //create the class Iclass , copy the functions of QWidget
{
Q_OBJECT
public:
Iclass (QWidget *parent=0, const char *name=0);
~Iclass();
private:
QPushButton *myNextBtn;
QLineEdit *myNameEdt;
public slots:
void checkFill(const QString&);
};
#endif