zoukankan      html  css  js  c++  java
  • 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("u2588u2588") : QString("  ");
            }
    
            result.append(QString("
    "));
        }
    
        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
  • 相关阅读:
    第四次作业
    第三次作业
    作业,11
    作业,10
    作业,9
    作业,8
    作业,7
    作业,6
    作业,5
    作业,4
  • 原文地址:https://www.cnblogs.com/judes/p/13629991.html
Copyright © 2011-2022 走看看