Important: Please read the Qt Code of Conduct -

Find object by name

  • 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.

  • you can ask an object for its child by name "QObject::findChidlren":

    This works for children of a widget als (as widgets are qobjects) and only if the objects have names "QObject::setObjectNames":

    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...

  • 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.

Log in to reply