I see no code that indicates that.
Did you forget to post the code that sets up the status bar?
thank you very much
The code as posted does not display a status bar. When you create the status bar it shows the specified text just fine (Linux, Qt 5.3).
thank you very much
Can you see a status bar in your window at all?
thank you very much
What happen when you derive a class from QMainWindow, but forget to include the Q_OBJECT macro in the class definition? (Look at the header file for any class derived from a Qt QObject class and compare that with the definition of your "widget" class in your header file).
thank you very much
the code is working well, Because I changed the code and I added the createStatusBar():
#include <QtWidgets>
#include "widget.h"
widget::widget()
resize(250,250);
setCentralWidget(text);
createaction();
createmenu();
createStatusBar();
}
void widget::createmenu()
{filemenu=menuBar()->addMenu(tr("File"));
filemenu->addAction(newact);
}
void widget::createaction()
{
newact
=new QAction(tr
("&New"),
this);
newact->setStatusTip("Open a new file");
}
void widget::createStatusBar()
{
statusBar()->showMessage(tr("Ready"));
}
#include <QtWidgets>
#include "widget.h"
widget::widget()
{text=new QTextEdit;
resize(250,250);
setCentralWidget(text);
createaction();
createmenu();
createStatusBar();
}
void widget::createmenu()
{filemenu=menuBar()->addMenu(tr("File"));
filemenu->addAction(newact);
}
void widget::createaction()
{
newact=new QAction(tr("&New"),this);
newact->setShortcut(QKeySequence::New);
newact->setStatusTip("Open a new file");
}
void widget::createStatusBar()
{
statusBar()->showMessage(tr("Ready"));
}
To copy to clipboard, switch view to plain text mode
Bookmarks