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 7194911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:28:18+00:00 2026-05-28T20:28:18+00:00

My Qt program uses a system of retrieving widget objectNames when clicked, by finding

  • 0

My Qt program uses a system of retrieving widget objectNames when clicked, by finding the coordinates of mousePressEvents and then finding the child widget (or the Window) at those coordinates.

This works perfectly for most widgets, but does not for the following widgets;
QScrollBox, QTableWidget, QGraphicsView, QTextEdit, QSpinBox.

These widgets (except QSpinBox) return ‘qt_scrollarea_viewport’ instead of their objectName, presumably because that is a child widget of those listed above.

Eg:
You have a QTextEdit with geometry (0,0,50,50).
Obviously the coordinates (10,10) are ‘on’ this widget.
Yet, calling parent.childAt( (10,10) ) does not return the QTextEdit.
Calling .objectName() shows that this instead is a ‘qt_scrollarea_viewport’.

If you had twenty different QTextEdits with twenty different object names, they’d all still return ‘qt_scrollarea_viewport’.

So, how do I retrieve the actual objectName of the QTextEdit, and not it’s graphical child widget (which is what I interpret a ‘viewport’ to be), given I have the coordinates of the widget?

Thanks!


PyQt4
Python 2.7.2
Windows 7

  • 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-05-28T20:28:19+00:00Added an answer on May 28, 2026 at 8:28 pm

    It is a child widget.

    Solution:

    if widget.objectName() == 'qt_scrollarea_viewport':    
        actual_obj = widget.parent().objectName()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have this full code: program List; {$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils, Generics.Collections;
I have a C# program that uses System.Data.OracleClient to access an oracle database. The
Can I combine code that uses System.Drawing.Bitmap together with other code in a program
I have a small command line program that uses the Team System API. When
I'm working on a program which uses the System.Diagnostics.Debugger.Break() method to allow the user
I've written a program in VB6 that uses System.Collections.ArrayList. The program runs fine on
I have a program that uses System.DirectoryServices.AccountManagement.PrincipalContext to verify that the information a user
When a program accesses files, uses system() , etc., how and where is the
My program uses wx.ProgressDialog to give feedback on a process that is in multiple
My program uses some external programs that i included in the Files folder. In

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.