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
{
Q_OBJECT
public:
menuprocess();
~menuprocess();
private:
private slots:
int tester();
};
class menuprocess : public QWidget
{
Q_OBJECT
public:
menuprocess();
~menuprocess();
private:
QLabel *io_one;
private slots:
int tester();
};
To copy to clipboard, switch view to plain text mode
The CPP File
menuprocess::menuprocess()
{
testButton->setText("Test");
testButton->setGeometry(250,130,40,30);
}
int menuprocess::tester()
{
ios << "RFID" << "MagSwipe" << "RTC" << "IFD" <<"PM";
obs << "io_one" << "io_two" << "io_three" << "io_four";
QLabel *label
= parentWidget
()->findChild<QLabel
*>
(obs.
at(j
));
[B
]I have used both the Lines
this one and the next one by commenting one among
this[/B
] QLabel *label
= this
->findChild<QLabel
*>
(obs.
at(j
));
qDebug()<<"The OBJECT NAME is"<<label->objectName();//at this line i am getting error[B]The program has unexpectedly finished[/B]
label->setText(ios.at(i));[B]//And here too the same error if i comment the QDebug Line[/B]
}
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));[B]I have used both the Lines this one and the next one by commenting one among this[/B]
QLabel *label = this->findChild<QLabel *>(obs.at(j));
qDebug()<<"The OBJECT NAME is"<<label->objectName();//at this line i am getting error[B]The program has unexpectedly finished[/B]
label->setText(ios.at(i));[B]//And here too the same error if i comment the QDebug Line[/B]
}
To copy to clipboard, switch view to plain text mode
Is it possible todo so in this manner if yes
Please do need ful
Thanks in advance
Regards,
Rohith.G
Bookmarks