Reputation: 3
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!
Upvotes: 0
Views: 253
Reputation: 24068
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
}
Upvotes: 1