In the class of the main window declare the inscription
QLabel *lblStatus;
In the constructor of the main window class, I initialize and add an inscription to the status panel:

 lblStatus = new QLabel(this); ui->statusBar->addWidget(lblStatus); 

There is a function updateStatusInfo (), which is called in resizeEvent:

 void MainWindow::resizeEvent(QResizeEvent *event) { Q_UNUSED(event) ra->redraw(); updateStatusInfo(); } 

it displays information on the panel:

 void MainWindow::updateStatusInfo() { QString info; ... //Здесь формируем текст и выводим его на надпись lblStatus->setText(info); } 

The program falls on the line `lblStatus-> setText (info); as if the label does not exist. I would like to understand how it turns out.

  • 2
    debugger in order to come up with .... - rikimaru2013
  • And the pointer on this line you have the right? Did you get up there debugger? If wrong, where is it lost or not initialized? Also debugger find out. Or you have a mistake not a pointer? In general, telepaths are already on NG :) - Mira
  • The resizeEvent event is raised before the constructor. How can this be? Pointers are fine. - maxspb89

1 answer 1

All figured out. This is not the message loop that was run before the constructor; it is the showMaximized function showMaximized called resizeEvent and, accordingly, the program crash.