Qt字符串转二维码字符串
QString toQRcode(const QString &plain) { /* Create the QR code */ QRCode qrcode; uint8_t qrcodeData[qrcode_getBufferSize(3)] = {0}; qrcode_initText(&qrcode, qrcodeData, 3, 0, plain.toStdString().c_str()); QString result; for (uint8_t y = 0; y < qrcode.size; y++) { /* Each horizontal module */ for (uint8_t x = 0; x < qrcode.size; x++) { /* Print each module (UTF-8 \u2588 is a solid block) */ result += qrcode_getModule(&qrcode, x, y) ? QString("\u2588\u2588") : QString(" "); } result.append(QString("\r\n")); } return result; } int main(int argc, char *argv[]) { QString result = toQRcode("http://weixin.qq.com/r/p0xudjXEUmgtrXEV9xm1"); qDebug().noquote()<<result; return 0; }
转:http://www.qtbig.com/page/10/
长风破浪会有时,直挂云帆济沧海!
可通过下方链接找到博主
https://www.cnblogs.com/judes/p/10875138.html