0

I have a similar question as asked in How to know if QListWidgetItem is hidden by scroll? and the answer to that question didn't fix my problem.

Basically I have a QScrollArea having QGridLayout. This layout has many QToolButtons. Based on some condition, all these QToolButtons need to be updated. To update all of them always is not so efficient, so I want to update only the buttons which are visible in the current active window. How can I achieve this? isVisible() doesn't help here.

Thanks in advance!

Community
  • 1
  • 1
Gangadhar
  • 3
  • 2

1 Answers1

1

You can use QWidget::visibleRegion() to check whether widget is visible and paint events can occur for widget.

if (!button->visibleRegion().isEmpty())
{
    //button is visible
}
Lahiru Chandima
  • 22,324
  • 22
  • 103
  • 179