bin Neuling in C++ und QT. Versuche mich gerade
mit der Erstellung eines Slots.
Ich erhalte beim Click auf den Button :
Signal erhalten
Der Prozess wurde nach Erhalt eines Signals vom Betriebssystem angehalten
Name des Signals: SIGSEGV
Bedeutung: Segmentation fault
Ich weiß leider überhaupt nicht woran dies liegen könnten?
Danke für jeden Hinweis
Mani
PS: Hier mal mein Code :
main.cpp
Code: Alles auswählen
#include <QtGui/QApplication>
#include "testmani.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
testmani bc;
bc.setAttribute(Qt::WA_QuitOnClose);
bc.show();
return a.exec();
}
manitest.h
Code: Alles auswählen
#ifndef TEST2_H
#define TEST2_H
#include <QDialog>
#include <QString>
#include <QLabel>
#include <QPushButton>
#include <QLineEdit>
class QPushButton;
class testmani : public QDialog
{
Q_OBJECT
private:
QLabel* l1;
QLabel* l2;
QLineEdit* e1;
QPushButton* b1;
private slots:
void btntest();
public:
testmani();
};
#endif // TEST2_Hmanitest.cpp
Code: Alles auswählen
#include "testmani.h"
#include <qlabel>
#include <QVBoxLayout>
#include <QLineEdit>
#include <QPushButton>
#include <QString>
testmani::testmani()
{
QVBoxLayout* meinlayout = new QVBoxLayout(this);
QLabel* l1 = new QLabel("test");
QLabel* l2 = new QLabel("test2");
QLineEdit* e1 = new QLineEdit();
QPushButton* b1 = new QPushButton("hallo");
meinlayout->addWidget(l1);
meinlayout->addWidget(l2);
meinlayout->addWidget(e1);
meinlayout->addWidget(b1);
connect(b1,SIGNAL(clicked()),this,SLOT(btntest()));
}
void testmani::btntest()
{
e1->setText("hallo222");
}