Trouble building after image size preservation update

When building the releases after the SVG oddity was patched, (2026.10.12 & 2026.10.19,) I get an error instead of a successful build:

svg_generator.cpp: In member function ‘void SvgGenerator::removeEmptyGroups(QDomElement&)’:
svg_generator.cpp:122:37: error: ‘begin’ was not declared in this scope
  122 |         for (const QDomNode &node : groups)

Is that when seamly upgraded past qt 6.8.2?

:unicorn:

What Qt are you trying to build with? We are currently using Qt 6.11.1 soon to be 6.11.3.

Gemini says:

The error ‘begin’ was not declared in this scope occurs because you are trying to use a range-based for loop (for (const QDomNode &node : groups)) on a QDomNodeList, which does not support standard C++ iterators (begin() and end()) in older versions of Qt, or requires a specific header update depending on the Qt version being used on your Linux build.

Range-based for loops in C++ look for std::begin() and std::end() functions for the object container. Because QDomNodeList traditionally lacked these, the compiler cannot expand the loop structure.

The Fix

To resolve this, replace the range-based for loop with a traditional indexed for loop, which QDomNodeList natively supports via .count() (or .size()) and .item().

Here is the corrected routine:

while(!svg_cleaned) { svg_cleaned = true; QDomNodeList groups = main_group.elementsByTagName(“g”);

// Fix: Use a traditional indexed loop
for (int i = 0; i < groups.count(); ++i) { 
    QDomNode node = groups.item(i);
    QDomElement group = node.toElement(); 
    
    if (group.childNodes().isEmpty()) { 
        if (main_group.removeChild(group).isNull()) { 
            qDebug() << "Error : could not remove empty group"; 
        } 
        svg_cleaned = false; 
        break; 
    } 
} 

// If we just removed a group, restart from the beginning immediately 
if (!svg_cleaned) { 
    continue; 
} 

}

In other words at some Qt ver… probably with or after 6.8.2 added the Ragneg loops for dom nodes. Range based loops are much easier to read. They eliminate the while i, j, k iterators. Which is why I switch to them when I can.