I can set the text of the status bar of the parent using this function that I wrote
void EditorWindow::setStatusBarText(const QString& text) {
statusBar()->showMessage(text);
}
Called like this (from a child)
((EditorWindow*) parent())->setStatusBarText(tr("%1, %2").arg(mousePos.x(), 0, 'f', 2).arg(mousePos.y(), 0, 'f', 2));
But I'm sure that violates several design principles. For example, what if parent()not EditorWindow*?
So what is the workaround for this? Force the user to pass a link to EditorWindowat creation to ensure that the parent type is of the correct type?
source
share