Hi guys pls how do i acces a class property from another class in qt c++ ve tried but it give me an empty string and a 0 value when i try to -

Viewed 20
class Dialog : QDialog { 
public:
    QString prodname;

    qint32 id;
}

Here is the implementation.

void Dialog::on_clicked(){
    Prodname = ui->qty_label->text(); 

    id = ui->id_label->text().toint();
}

But when I access it from another class:

#include dialog.h

void secwin::on_clicked(){
    Dialog dlg;

    Ui->qty->settext(dlg.Prodname);

    Ui->id->settext (QString::number (dlg.id);
}
0 Answers
Related