wagmare
17th March 2009, 06:53
hi friends,
i try to set the QPushButton() signal clicked() to connect
a slot changeIndex(int)
so i try signal Mapper so i do
mapping .h
#include <QSignalMapper>
signals:
void clicked(int value);
public Q_SLOTS:
void changeIndex(int index);
private:
QSignalMapper *signalMapper;
int mapValue[10];
in mapping.cpp
/* signal Mapper*/
mapValue = 2;
connect(cicsButton, SIGNAL(clicked()), signalMapper, SLOT(map()));
signalMapper->setMapping(cicsButton, mapValue[1]);
connect(signalMapper, SIGNAL(mapped(int)), this, SIGNAL(clicked(int)));
connect(this, SIGNAL(clicked(int)), this, SLOT(changeIndex(int)));
it compiled perfectly but when i run core dumped
when i try execute it gives [I]Segmentation fault ....
i dont know where i done the mistake ...it crashes here ..
connect(cicsButton, SIGNAL(clicked()), signalMapper, SLOT(map()));
please help .... why in run time it give seg. fault ....
i try to set the QPushButton() signal clicked() to connect
a slot changeIndex(int)
so i try signal Mapper so i do
mapping .h
#include <QSignalMapper>
signals:
void clicked(int value);
public Q_SLOTS:
void changeIndex(int index);
private:
QSignalMapper *signalMapper;
int mapValue[10];
in mapping.cpp
/* signal Mapper*/
mapValue = 2;
connect(cicsButton, SIGNAL(clicked()), signalMapper, SLOT(map()));
signalMapper->setMapping(cicsButton, mapValue[1]);
connect(signalMapper, SIGNAL(mapped(int)), this, SIGNAL(clicked(int)));
connect(this, SIGNAL(clicked(int)), this, SLOT(changeIndex(int)));
it compiled perfectly but when i run core dumped
when i try execute it gives [I]Segmentation fault ....
i dont know where i done the mistake ...it crashes here ..
connect(cicsButton, SIGNAL(clicked()), signalMapper, SLOT(map()));
please help .... why in run time it give seg. fault ....