Hoffentlich könnt ihr mir helfen. Ich programmiere erst seit ein paar Tagen mit qt (unter Linux). Beim folgenden Programm funktioniert die connect Methode nicht. Bitte schaut nicht auf den Programmierstil.
Wo ist der Fehler?
mfg
Pauli
#include <qt3/qapplication.h>
#include <qt3/qpushbutton.h>
#include <qt3/qlineedit.h>
#include <qt3/qlabel.h>
class Form : public QWidget
{
private:
QLabel *Label;
public:
Form( QWidget *parent=0, const char *name=0 );
public slots:
void changeText();
};
Form::Form( QWidget *parent, const char*name ): QWidget( parent, name)
{
setMinimumSize(200, 120);
setMaximumSize(200, 120);
QPushButton *bttn = new QPushButton( "Klick", this, "Klick" );
bttn->setGeometry( 62, 20, 75, 30 );
Label = new QLabel( this );
Label->setText("TEST");
Label->setGeometry (0,0,60,20);
Label->setFrameStyle( QFrame::Panel | QFrame::Sunken );
QLineEdit *textBox = new QLineEdit("TextBox", this, "textBox" );
textBox->setGeometry(50,50,100,50);
connect( bttn, SIGNAL(clicked()), this, SLOT(changeText()) );
}
void Form::changeText()
{
Label->setText("XNJKLNK");
}
int main( int argc, char **argv)
{
QApplication a( argc, argv );
Form w;
a.setMainWidget( &w );
w.show();
return a.exec();
}