Qt World Summit: Register Today!

Notification Widget best practice

  • Hello community,

    I´m trying to implement a notification widget that shows some system information to the user. The notification is shown as a simple line at the top of the application (app is fullscreen and allwaysOnTop). After 10 seconds the notification line will by hidden.

    My problem is that notification line is activated when it´s shown. The focus of my actual item (most times a QLineEdit) is lost. After the notification is hidden the focus is set back to this item.

    I tried to set the FocusPolicy of my notification widget and all it´s children to Qt::NoFocus and set the WindowFlags Qt::X11BypassWindowManagerHint with no effect. Also I set the attribute Qt::WA_X11DoNotAcceptFocus

    Operating system is Windows 7
    Could someone give me a hint how to realize such a task the right way?

    Thanks and regards.

  • Found a way to do what I described:

    setWindowFlags(Qt::Tool | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::WindowSystemMenuHint);

    These two did the job.


Log in to reply