Didn't add the list... I guess the closest you get with a pure QByteArray solution is a two-step operation: auto x = QByteArray::Number(6).rightJustified(10, '0');
-Even -----Original Message----- From: Interest [mailto:[email protected]] On Behalf Of Kristoffersen, Even (NO14) via Interest Sent: onsdag 18. september 2019 14:28 To: Jason H <[email protected]>; [email protected] Subject: Re: [Interest] [External] QByteArray vs QString, arg, why is there no arg()? Just use the fill() function: https://doc.qt.io/qt-5/qbytearray.html#fill -Even -----Original Message----- From: Interest [mailto:[email protected]] On Behalf Of Jason H Sent: onsdag 18. september 2019 13:16 To: [email protected] Subject: [External] [Interest] QByteArray vs QString, arg, why is there no arg()? Shiver me timbers! I often find myself using QString::arg() overloads for formatting, but nothing like that exists for when I'm working with just bytes, say for a socket or serial port. So I find myself constructing it as a QString and then .toLocal8bit() , which just seems wasteful. What's the best way to zero-pad a QByteArray? What I want is QByteArray("%1").arg(6, 10, 10, '0') I'm guessing they is a good reason it hasn't been added yet? _______________________________________________ Interest mailing list [email protected] https://lists.qt-project.org/listinfo/interest _______________________________________________ Interest mailing list [email protected] https://lists.qt-project.org/listinfo/interest _______________________________________________ Interest mailing list [email protected] https://lists.qt-project.org/listinfo/interest
