Is there a shorter way to initialize a QByteArray?
问题 In my program I work a lot with serial communication so QByteArray is used very often. I was wondering if there was a shorter way to initialize a QByteArray with specific bytes than: const char test_data[] = { static_cast<char>(0xB1), static_cast<char>(0xB2), 0x5, static_cast<char>(0xFF), static_cast<char>(0xEE), static_cast<char>(0xEE), static_cast<char>(0x0)}; // Note QByteArray should be able to hold 0 byte const QCanBusFrame frame = QCanBusFrame(0xA1, QByteArray(test_data)); The static