Unsolved Access statisBar from member function
-
Hello QT-world,
how can I access the statusbar in my mainwindow from any member or nonmember function. I have no clue how do accomplish that. It exceeds my actual knowledge base.
This is what I have so far:QtDemo::QtDemo(QWidget *parent) : QMainWindow(parent)
{
QWidget *widget = new QWidget;
...
// set a message into staticBar
statusBar()->showMessage(any_message);
...
any_function();
}void QtDemo :: any_function()
{
QtDemo *n;
n->statusbar->showMessage(...); // does not work, not that member showMessage() !!
...
}Who has the right solution?
Best wishes
MatFox -
Hi and welcome to devnet,
@MatFox said in Access statisBar from member function:
void QtDemo :: any_function()
{
QtDemo *n;
n->statusbar->showMessage(...); // does not work, not that member showMessage() !!
...
}Why are you creating
n
in the first place ?
Just do the same thing you did in the constructor. -
Hi SGaist,
what do you mean? Could you be more specific?
Do mean QtDemo* n = new ... ; etc. -
Well, why are you creating a local pointer to a QtDemo object within a method that is part of QtDemo ?