Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Check if QWidget is currently in visible display area



  • This post is deleted!

  • Lifetime Qt Champion

    Hi,

    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:
    0_1551427641943_IMG_FC3A3195E04F-1.jpeg

    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;
        opt.init(this);
        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