Skip to content

Commit

Permalink
更新二维码显示方式
Browse files Browse the repository at this point in the history
  • Loading branch information
cat committed Apr 25, 2023
1 parent 6afbc92 commit 0c4d42a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
8 changes: 4 additions & 4 deletions Examples/CatWidgetExamples/Resource/qml/CatQrenCode.qml
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ Item {
onWidthChanged: {
rectroot.width = root.width;
rectroot.height = root.height;
qrencode.x = 10;
qrencode.y = 10;
qrencode.x = 5;
qrencode.y = 5;
qrencode.width = root.width - 10;
qrencode.height = root.height - 10;
}

onHeightChanged: {
rectroot.width = root.width;
rectroot.height = root.height;
qrencode.x = 10;
qrencode.y = 10;
qrencode.x = 5;
qrencode.y = 5;
qrencode.width = root.width - 10;
qrencode.height = root.height - 10;
}
Expand Down
8 changes: 7 additions & 1 deletion Examples/CatWidgetExamples/WidgetTools/QrenCodeTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,13 @@ void QrenCodeTool::UpdateQrenCode()
QPixmap qrPixmap;
int width = ui->QrenCodeLabel->width();
int height = ui->QrenCodeLabel->height();
GernerateQRCode(ui->QrenCodeEdit->text(), qrPixmap, QSize(width, height), "", 5);
QRCODE qrproperty;
qrproperty.text = ui->QrenCodeEdit->text();
qrproperty.size = QSize(width, height);
qrproperty.qrpercent = 0;
qrproperty.backgroundColor = "#FFFFFF";
qrproperty.qrencodeColor = "#000000";
GernerateQRCode(qrproperty, qrPixmap);

ui->QrenCodeLabel->setPixmap(qrPixmap);
}
Expand Down

0 comments on commit 0c4d42a

Please sign in to comment.