Check if QWidget is currently in visible display area

  • This post is deleted!

  • Lifetime Qt Champion


    You can use visualRect for that task.

    Out of curiosity, why do you need that ?

  • @SGaist

    When I'm loading the items into my list, I have first the following behavior:

    The items are inside the displaying area at the loading items time, are correct drawn. But the items are not in the displaying area at the loading items time, are not drawn, as you can see. They are white, with thin gray top-border only.

    When I "open" one of the items in a new QMainWindow, and then I close it again, so I see the list again, ALL the items are drawn correct.

    I have a paint method for each item

    void PositionGroupbox::paintEvent(QPaintEvent*)
        QStyleOption opt;
        QPainter p(this);
        style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);

    Maybe this ist the reason, for the defective draw-behavior. Therefor I want to watch, when the Item comes into the visible display-area, I could tray to draw it again.

    It is a little complicated, sorry for that

Log in to reply