
Originally Posted by
wysota
Did you remove the call the Ui class generated by Designer/uic does as well?
Yes I did. I cleared a WindowTitle property in a designer, compiled and was convinced, that setWindowTitle was removed from ui_MainWindow.h file.
Finally I've done it. See, if setWindowFilePath is called from constructor title doesn't change because of (Qt sources)
void QWidgetPrivate
::setWindowTitle_helper(const QString &title
) {
if (q->testAttribute(Qt::WA_WState_Created))
setWindowTitle_sys(qt_setWindowTitle_helperHelper(title, q));
}
void QWidgetPrivate::setWindowTitle_helper(const QString &title)
{
Q_Q(QWidget);
if (q->testAttribute(Qt::WA_WState_Created))
setWindowTitle_sys(qt_setWindowTitle_helperHelper(title, q));
}
To copy to clipboard, switch view to plain text mode
I moved call of setWindowFilePath to showEvent
void MainWindow
::showEvent( QShowEvent * event
) { static bool first = true;
if ( first ) {
first = false;
setWindowFilePath( m_fileName );
}
}
void MainWindow::showEvent( QShowEvent * event ) {
QWidget::showEvent( event );
static bool first = true;
if ( first ) {
first = false;
setWindowFilePath( m_fileName );
}
}
To copy to clipboard, switch view to plain text mode
and it works fine, but... do you know a way to run some code once after Widget's class constructor, but without this ugly static bool ? And without calling singleShot from constructor ?
Bookmarks