Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Find object by name
Forum Update on Monday, May 27th 2025

Find object by name

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 21.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    luca72
    wrote on 22 Mar 2011, 08:10 last edited by
    #1

    hello i have more than one progress dialog to update, and i need to find the exact one to update by object name, how i can find the correct one.

    1 Reply Last reply
    0
    • G Offline
      G Offline
      giesbert
      wrote on 22 Mar 2011, 08:40 last edited by
      #2

      you can ask an object for its child by name "QObject::findChidlren":http://doc.qt.nokia.com/4.7/qobject.html#findChildren

      This works for children of a widget als (as widgets are qobjects) and only if the objects have names "QObject::setObjectNames":http://doc.qt.nokia.com/4.7/qobject.html#objectName-prop

      From my point it would be easier to use member variables though, as you then have pointers to the objects. If you don't know how many you will have at design time, create maps to store the pointers. It will make life easier...

      Nokia Certified Qt Specialist.
      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andre
        wrote on 22 Mar 2011, 09:06 last edited by
        #3

        As an alternative approach, consider using signals and slots instead of directly updating your values. This way, you don't need to care about the name or keep maps with pointers around. You just make sure your progress dialog is connected to the right set of signals from whatever is progressing.

        1 Reply Last reply
        0

        1/3

        22 Mar 2011, 08:10

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved