[solved] statusbar() was not declared in this scope.
-
Hi,
I just started QT so forgive noob question.
I created a MainWindow using QT designer designed to show a message in the status bar when a button is clicked.
Given below is the slot that I implemented:@
void MainWindow:: on_pushButton_clicked()
{
label = new QLabel("X");
statusbar->addWidget(label);}
@However, I get an error saying satusbar() was not declared in this scope.
Given below is my .h file:@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H#include <QMainWindow>
#include <QStatusBar>
#include <QLabel>namespace Ui {
class MainWindow;
}class MainWindow : public QMainWindow
{
Q_OBJECTpublic:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();private:
Ui::MainWindow *ui;
QLabel *label;private slots:
void on_pushButton_clicked();
};#endif // MAINWINDOW_H
@Kindly help. Thanks.
[edit: Code highlighted / Denis Kormalev]
-
Hey ritratt, nice to see you found the issue.
Could you please format the code you posted, using @ characters around it? Thanks =)