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

QWidget::childAt returns empty children

    XMLWordPrintable

Details

    • Windows
    • 1731d8af7 (dev), 4a27d0fe0 (6.8), deadc8b1a (6.8.1)

    Description

      Calling QWidget::childAt on a widget that has empty children (width or height is 0) can return said children. The following code triggers the assert in 6.8.0, but not in 6.7:

      #include <QApplication>
      #include <QWidget>
      #include <cassert>
      
      int main(int argc, char **argv) {
        QApplication app(argc, argv);
      
        QWidget parent(nullptr, Qt::FramelessWindowHint);
        parent.resize(200, 200);
      
        QWidget *emptyChild = new QWidget(&parent);
        emptyChild->setGeometry(0, 100, 200, 0);
      
        assert(parent.childAt(100, 100) == nullptr);
      }
      

       

      Attachments

        Issue Links

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

          Activity

            People

              vhilshei Volker Hilsheimer
              nerixyz Tom Fors
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes