Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-113341

Generator / Visitor version of QObject::findChildren

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • None
    • Core: Object Model
    • None

    Description

      QObject::findChildren returns a QList of the objects that match the search criteria.

      One could instead imagine

      1. a visitChildren function:

      object->visitChildren<QLabel *>(QString(), [](QLabel *label) { label->setText("42"); });
      

      2. a generator API:

      for (QLabel *label : object->children<QLabel *>())  // not sure about a good name here
        label->setText("42");
      

      Because if the point is to do an action for each child found this way, then one doesn't need to allocate and return a QList of results.

      Do we want both? Only 2.?

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            peppe Giuseppe D'Angelo
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes