On Friday, 3 June 2022 14:04:55 PDT Sean Murphy via Interest wrote: > The issue I'm seeing is that there doesn't appear to be any way to > initialize the "collage" QImage BEFORE the first call to addToCollage(). > Instead, it seems like behind the scenes, the mappedReduced() function > creates a default constructed QImage, and then passes that to > addToCollage(). Then the call to QPainter::drawImage() inside > addToCollage() can't actually do anything because the underlying QImage is > null. Each successive call to addToCollage() passes the previously > "modified" QImage in to be modified further, but since it's still a null > QImage, nothing actually happens.
Then you can detect the situation and initialise it to the right size on first use. But no, this is a limitation in the API. If we take the prototypical example of a reduction, std::accumulate, it does have an initial value: https://en.cppreference.com/w/cpp/algorithm/accumulate -- Thiago Macieira - thiago.macieira (AT) intel.com Cloud Software Architect - Intel DCAI Cloud Engineering _______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest