Arrays in C (and C++) are defined to have a fixed length, requiring the argument passed to [] to be a build-time constant (numeric literal, numeric constant, enum value, C++ const-expr).
E.g. in your case making qty a "const int"

If the length is only available at run time, then the obvious way in C++ is a vector, e.g. QVector or std::vector

Cheers,
_