基本信息
源码名称:qt使用barcode库
源码大小:0.05M
文件格式:.rar
开发语言:C/C++
更新时间:2024-05-27
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 10 元 
   源码介绍
qt使用barcode库

    QRcode *qrcode;
    qrcode = QRcode_encodeString(strUrl.toStdString().c_str(), 2, QR_ECLEVEL_Q, QR_MODE_8, 1);

    qint32 temp_width = 500;
    qint32 temp_height = 500;
    qDebug() << "temp_width=" << temp_width << ";temp_height=" << temp_height;

    qint32 qrcode_width = qrcode->width > 0 ? qrcode->width : 1;
    double scale_x = (double)temp_width / (double)qrcode_width;
    double scale_y = (double)temp_height / (double)qrcode_width;

    int offset = 14;
    QImage mainimg = QImage(temp_width offset * 2, temp_height offset * 2, QImage::Format_ARGB32);
    QPainter painter(&mainimg);
    QColor background(Qt::white);
    painter.setBrush(background);
    painter.setPen(Qt::NoPen);
    painter.drawRect(offset, offset, temp_width, temp_height);
    QColor foreground(Qt::black);
    painter.setBrush(foreground);