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:
int mapValue[10];
#include <QSignalMapper>
signals:
void clicked(int value);
public Q_SLOTS:
void changeIndex(int index);
private:
QSignalMapper *signalMapper;
int mapValue[10];
To copy to clipboard, switch view to plain text mode
in mapping.cpp
/* signal Mapper*/
mapValue[i] = 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)));
/* signal Mapper*/
mapValue[i] = 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)));
To copy to clipboard, switch view to plain text mode
it compiled perfectly but when i run core dumped
when i try execute it gives Segmentation fault ....
i dont know where i done the mistake ...it crashes here ..
connect(cicsButton, SIGNAL(clicked()), signalMapper, SLOT(map()));
connect(cicsButton, SIGNAL(clicked()), signalMapper, SLOT(map()));
To copy to clipboard, switch view to plain text mode
please help .... why in run time it give seg. fault ....
Bookmarks