[Solved]Getting error "statusBar was not declared in this scope"?!
- 
Since You haven't told what is statusBar exactly. I am assuming that you are using statusBar() function. then please check that have you declared statusBar() method in header file correctly or not. 
- 
I am tryieng to implement what I need from this example @#include <QGridLayout> 
 #include <QLabel>
 #include <QFrame>
 #include <QStatusBar>
 #include "statusbar.h"Statusbar::Statusbar(QWidget *parent) 
 : QMainWindow(parent)
 {
 QFrame *frame = new QFrame(this);
 setCentralWidget(frame);ok = new QPushButton("OK", frame); 
 ok->move(20, 50);apply = new QPushButton("Apply", frame); 
 apply->move(120, 50);statusBar(); connect(ok, SIGNAL(clicked()), this, SLOT(OnOkPressed())); 
 connect(apply, SIGNAL(clicked()), this, SLOT(OnApplyPressed()));
 }void Statusbar::OnOkPressed() 
 {
 statusBar()->showMessage("OK button pressed", 2000);
 }void Statusbar::OnApplyPressed() 
 {
 statusBar()->showMessage("Apply button pressed", 2000);
 }@
 [quote author="SGaist" date="1405505571"]Hi,And when I compile the code I get this error Can you show the code that is failing ?[/quote] 
- 
The name of your widget is not really a good idea, MainWindow would be more meaningful and less error prone. Do you have by any chance a member variable that's name statusBar ? 
- 
In the constructor , you are calling statusBar() method. But it is not defined in the class. I think that's why it is showing this error. 
- 
ankursaxena It is: "QMainWindow::statusBar()":http://qt-project.org/doc/qt-5/qmainwindow.html#statusBar 
- 
Ohk Gaist sir. Now i got it. I have run this code. and It is working perfectly. 
- 
Yes the code is work when I create a project with base class QMainWindow , however when I implement that on my project which the base class is QDialog the error is appear .. [quote author="SGaist" date="1405510932"]ankursaxena It is: "QMainWindow::statusBar()":http://qt-project.org/doc/qt-5/qmainwindow.html#statusBar[/quote] 
- 
Because statusBar() is defined in the QMainWindow class and I searched and found that it is not defined in QDialog. 
- 
thanks all for your replies .. 
 I find a solution Yes as you said statusBar() is defined in QMainWindow class and it is not define in QDialog class.what I did is adding status bar manually using a layout @ QLayout *l = new QVBoxLayout(ui->frame); QStatusBar *bar = new QStatusBar; l->addWidget(bar);@ 
 [quote author="ankursaxena" date="1405575930"]Because statusBar() is defined in the QMainWindow class and I searched and found that it is not defined in QDialog.[/quote]
- 
That's the kind of "minor" detail that you should mention from start 
