Important: Please read the Qt Code of Conduct -

Detecting any desktop state change

  • Hello,

    the requirement is to detect a desktop window visual change starting from a defined time moment.

    In the QPaintEvent documentation there's no exact information when it should be sent.
    However, I assume that it is sent whenever a widget is

    • resized;
    • moved;
    • exposed because a covering widget was moved.

    N.B. !!!
    I do not make assumptions whether a widget should be repainted in Qt if it is either partially or fully covered by a widget.
    However, since the desktop widget is the widget constituting the area for all widgets after an user is logged in and assumed that the widgets are children of the desktop widget, the desktop widget is the first QPaintEvent receival point. Hence, it should receive the QPaintEvent message when it is partially or fully covered.

    The idea is to use the QDesktopWidget class with an event filter expecting a paint event.

    I need thorough information (with sources) whether the assumptions are correct.

    If there is an input regarding the idea or another solution it would be greatly appreciated.

  • Moderators

    why not jsut relying on Qt?! Qt will send a QPaintEvent when needed. You can initiate a paint event with QWidget::update(), for example when data has changed inside your widget and you need to redraw it.

Log in to reply