MCPcopy Create free account
hub / github.com/IJHack/QtPass / showTextAsQRCode

Method showTextAsQRCode

src/qtpass.cpp:522–541  ·  view source on GitHub ↗

* @brief displays the text as qrcode * @param text */

Source from the content-addressed store, hash-verified

520 * @param text
521 */
522void QtPass::showTextAsQRCode(const QString &text) {
523 QProcess qrencode;
524 qrencode.start(QtPassSettings::getQrencodeExecutable("/usr/bin/qrencode"),
525 QStringList() << "-o-"
526 << "-tPNG");
527 qrencode.write(text.toUtf8());
528 qrencode.closeWriteChannel();
529 qrencode.waitForFinished();
530 QByteArray output(qrencode.readAllStandardOutput());
531
532 if (qrencode.exitStatus() || qrencode.exitCode()) {
533 QString error(qrencode.readAllStandardError());
534 m_mainWindow->showStatusMessage(error);
535 } else {
536 QPixmap image;
537 image.loadFromData(output, "PNG");
538 QDialog *popup = createQRCodePopup(image);
539 popup->exec();
540 }
541}
542
543/**
544 * @brief QtPass::createQRCodePopup creates a popup dialog with the given QR

Callers

nothing calls this directly

Calls 1

showStatusMessageMethod · 0.80

Tested by

no test coverage detected