bapt
1st June 2016, 10:16
Hi all,
I have an issue : When I want to execute a QLabel->setText() in the method "modifItem", it causes a program crash.
When I execute the lcd4->setText() in the constructor, it works, but not in the method "modifItem". --> lcd4 attribute seems to not be recognized even if lcd4 lights in red... It only happens with a QLabel or a QLCDNumber... I tried with a QTableWidgetItem->setItem() and it works well.
Caisse3.cpp
Caisse3::Caisse3():QWidget()
{
QLabel*lcd4 = new QLabel();
lcd4->setFixedSize(200,30);
lcd4->setFrameStyle(QFrame::Panel | QFrame::Sunken);
QVBoxLayout *layout5 = new QVBoxLayout;
layout5->addWidget(lcd4);
}
void Caisse3::modifItem(int row, int column)
{
QString nomArticle=listBoissonsDenom[row];
lcd4->setText(nomArticle);
}
Caisse3.h
class Caisse3:public QWidget{
Q_OBJECT
public:
Caisse3();
public slots:
void modifItem(int row, int column)
private:
QLabel *lcd4;
QVBoxLayout *layout5;
Thanks for your help.
I have an issue : When I want to execute a QLabel->setText() in the method "modifItem", it causes a program crash.
When I execute the lcd4->setText() in the constructor, it works, but not in the method "modifItem". --> lcd4 attribute seems to not be recognized even if lcd4 lights in red... It only happens with a QLabel or a QLCDNumber... I tried with a QTableWidgetItem->setItem() and it works well.
Caisse3.cpp
Caisse3::Caisse3():QWidget()
{
QLabel*lcd4 = new QLabel();
lcd4->setFixedSize(200,30);
lcd4->setFrameStyle(QFrame::Panel | QFrame::Sunken);
QVBoxLayout *layout5 = new QVBoxLayout;
layout5->addWidget(lcd4);
}
void Caisse3::modifItem(int row, int column)
{
QString nomArticle=listBoissonsDenom[row];
lcd4->setText(nomArticle);
}
Caisse3.h
class Caisse3:public QWidget{
Q_OBJECT
public:
Caisse3();
public slots:
void modifItem(int row, int column)
private:
QLabel *lcd4;
QVBoxLayout *layout5;
Thanks for your help.