Planned maintenance has been done but it did not solve the problem. So work will continue on this and a new time for trying updates will be announced asap.

QSplashScreen - Focus lost

  • I have always started my application with a splash screen and clicking on the splash screen closed it normally and the main window was left on show.

    Recently clicking on the splash screen leaves the main window behind whatever window was previously on top.

    I am looking for a way to make sure my main window is on top when the splash screen is closed. If I wait for the splash screen to close on its timer this is the case.


  • This post is deleted!

  • Lifetime Qt Champion


    What version of Qt ?
    On what platform ?
    Can you provide a minimal compile example that reproduce that behaviour ?

  • Sorry for the delay answering.

    Windows QT5.12.

    If I run this application and wait 5s the splash screen that was on top closes and my dialog is visible and on top. If I instead click on the splash screen my dialog is one layer behind whichever task was previously active. In this case Qt Creator.

    For a few years it did not have this behaviour but it started recently. Sorry I cant be specific as to which version caused the issue.

    #include "dialog.h"
    #include <QApplication>
    #include <QPixmap>
    #include <QSplashScreen>
    #include <QTimer>

    int main(int argc, char *argv[])
    QApplication a(argc, argv);

    QPixmap pixmap;
    QSplashScreen *splash = new QSplashScreen;
    Dialog w;;
    // Kill the splash screen after 5s
    QTimer::singleShot(5000, splash, SLOT(close()));
    return a.exec();




  • Lifetime Qt Champion

    What is Dialog ?

  • Hi,

    I just started from a bare bones application as a test program.

    #ifndef DIALOG_H
    #define DIALOG_H

    #include <QDialog>

    namespace Ui {
    class Dialog;

    class Dialog : public QDialog

    explicit Dialog(QWidget *parent = nullptr);

    Ui::Dialog *ui;

    #endif // DIALOG_H

    #include "dialog.h"
    #include "ui_dialog.h"

    Dialog::Dialog(QWidget *parent) :
    ui(new Ui::Dialog)

    delete ui;

  • Lifetime Qt Champion

    Tested on macOS but it's working fine...

    Can you test with the 5.13 preview ?

Log in to reply