gunturrohith
23rd June 2016, 13:03
Hi i am trying to use the findChlid(), and i was getting error after running it that is
The program has unexpectedly finished
Here is my Code:
The Header File
class menuprocess : public QWidget
{
Q_OBJECT
public:
menuprocess();
~menuprocess();
private:
QLabel *io_one;
private slots:
int tester();
};
The CPP File
menuprocess::menuprocess()
{
io_one = new QLabel(this);
testButton = new QPushButton(this);
testButton->setText("Test");
testButton->setGeometry(250,130,40,30);
}
int menuprocess::tester()
{
QStringList ios;
ios << "RFID" << "MagSwipe" << "RTC" << "IFD" <<"PM";
QStringList obs;
obs << "io_one" << "io_two" << "io_three" << "io_four";
QLabel *label = parentWidget()->findChild<QLabel *>(obs.at(j));I have used both the Lines this one and the next one by commenting one among this
QLabel *label = this->findChild<QLabel *>(obs.at(j));
qDebug()<<"The OBJECT NAME is"<<label->objectName();//at this line i am getting errorThe program has unexpectedly finished
label->setText(ios.at(i));//And here too the same error if i comment the QDebug Line
}
Is it possible todo so in this manner if yes
Please do need ful
Thanks in advance
Regards,
Rohith.G
The program has unexpectedly finished
Here is my Code:
The Header File
class menuprocess : public QWidget
{
Q_OBJECT
public:
menuprocess();
~menuprocess();
private:
QLabel *io_one;
private slots:
int tester();
};
The CPP File
menuprocess::menuprocess()
{
io_one = new QLabel(this);
testButton = new QPushButton(this);
testButton->setText("Test");
testButton->setGeometry(250,130,40,30);
}
int menuprocess::tester()
{
QStringList ios;
ios << "RFID" << "MagSwipe" << "RTC" << "IFD" <<"PM";
QStringList obs;
obs << "io_one" << "io_two" << "io_three" << "io_four";
QLabel *label = parentWidget()->findChild<QLabel *>(obs.at(j));I have used both the Lines this one and the next one by commenting one among this
QLabel *label = this->findChild<QLabel *>(obs.at(j));
qDebug()<<"The OBJECT NAME is"<<label->objectName();//at this line i am getting errorThe program has unexpectedly finished
label->setText(ios.at(i));//And here too the same error if i comment the QDebug Line
}
Is it possible todo so in this manner if yes
Please do need ful
Thanks in advance
Regards,
Rohith.G