Solved get error
-
Hi
I put this code and get errorvoid MainWindow::on_pushButton_clicked() { QDate myDate= ui->dateEdit->date(); QString dateString = myDate.toString(); label->setText(dateString); }
Error:
C:\Users\armin\Documents\StoMar\mainwindow.cpp:21: error: 'label' was not declared in this scope
label->setText(dateString);
^ -
Hi,
It's the same error you already had in your other thread. You don't have any object named label.
-
Thanks but i create label
-
Thanks guys
I solved.
I added ui in my code.void MainWindow::on_pushButton_clicked() { QDate myDate= ui->dateEdit->date(); QString dateString = myDate.toString(); ui->label1->setText(dateString); }
-
@Armin
Hi
All you add via Designer is available via UI->
for the same class.
Its created when you run
ui ( new Ui::MainWindow ) {
ui->setupUi ( this );
Which is inserted when you create the widget via Designer/Creator
(in the constructor)