Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. [solved] statusbar() was not declared in this scope.
Forum Updated to NodeBB v4.3 + New Features

[solved] statusbar() was not declared in this scope.

Scheduled Pinned Locked Moved Qt Creator and other tools
3 Posts 2 Posters 5.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    ritratt
    wrote on last edited by
    #1

    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_OBJECT

    public:
    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]

    1 Reply Last reply
    0
    • R Offline
      R Offline
      ritratt
      wrote on last edited by
      #2

      Found the issue. Typo.
      It's supposed to be statusBar not statusbar.
      Silly me.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        anselmolsm
        wrote on last edited by
        #3

        Hey ritratt, nice to see you found the issue.
        Could you please format the code you posted, using @ characters around it? Thanks =)

        Anselmo L. S. Melo (anselmolsm)

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved