Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7971497
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:39:13+00:00 2026-06-04T07:39:13+00:00

I am displaying multiple QLabels on a QFrame , placed into a QScrollArea .

  • 0

I am displaying multiple QLabels on a QFrame, placed into a QScrollArea.

I am able to tell QScrollArea to make any of the QLabels visible with QScrollArea.ensureWidgetVisible(QLabel), but I cannot seem to find a method to find out whether the child widget is currently visible or not. I would expect something like QScrollArea.isWidgetVisible(QWidget).

I tried using the child’s own method, i.e. QLabel.isVisible() but no matter whether the QLabel is visible or not in the QScrollArea, it always returns True (see example below). What’s the solution to this?

#!/usr/bin/env python

import sys
from PyQt4 import QtGui, QtCore



application = QtGui.QApplication(sys.argv)

class Area(QtGui.QScrollArea):

    def __init__(self, child):
            super(Area, self).__init__()
        self.child = child
        self.setWidget(self.child)
        self.setFixedSize(100, 100)


class MainWidget(QtGui.QFrame):

    def __init__(self, parent=None):
            QtGui.QFrame.__init__(self, parent)
        self.layout = QtGui.QVBoxLayout()
        n = 1
        while n != 10:
            label = QtGui.QLabel('<h1>'+str(n)+'</h1>')
            self.layout.addWidget(label)
            n += 1
        self.setLayout(self.layout)

    def wheelEvent(self, event):
        print "Wheel Event:"
        for child in self.children()[1:]:
            print child.isVisible()
        event.ignore()

mainwidget = MainWidget()
area = Area(mainwidget)
area.show()
application.exec_()
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T07:39:14+00:00Added an answer on June 4, 2026 at 7:39 am

    isVisible is different from what you want to do. It tells whether the widget is hidden or not. Even though it is not in the viewport a widget is visible unless you hide it.

    You could use visibleRegion. It is the region of the widget that paint events should occur. If the label is outside of the viewport, then it’s region should be an empty region.

    def wheelEvent(self, event):
        print "Wheel Event:"
        for child in self.children()[1:]:
            print child.text(), 'is visible?', not child.visibleRegion().isEmpty()
        event.ignore()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a page displaying multiple banners on large-format displays. The banners are placed
Here I am facing a problem with the displaying of multiple pins at time
I am developing LOB application, where I will need multiple dialog windows (and displaying
Displaying Type here to ... until the user enters text into a TextBox is
I have a div container where I am displaying multiple images and now I
I have used Multiple select Box in edit form, displaying previously selected items in
In my project I am displaying the checkboxes dynamically . But I want to
I am using the following method for displaying the multiple select box and it
I have added multiple labels in My Tableview cell. I am displaying facebook message
I have a php application that serves multiple customers. Code is placed in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.