Simplify code for showing QR code
This commit is contained in:
parent
8fe0c9ab75
commit
bd3158b285
|
@ -46,20 +46,18 @@ static void setupOwnDeviceIdDialog(Data::SyncthingConnection &connection, int si
|
||||||
copyPushButton, &QPushButton::clicked, bind(&QClipboard::setText, QGuiApplication::clipboard(), connection.myId(), QClipboard::Clipboard));
|
copyPushButton, &QPushButton::clicked, bind(&QClipboard::setText, QGuiApplication::clipboard(), connection.myId(), QClipboard::Clipboard));
|
||||||
layout->addWidget(copyPushButton);
|
layout->addWidget(copyPushButton);
|
||||||
connection.requestQrCode(connection.myId());
|
connection.requestQrCode(connection.myId());
|
||||||
QObject::connect(dlg, &QObject::destroyed,
|
QObject::connect(&connection, &SyncthingConnection::qrCodeAvailable, pixmapLabel,
|
||||||
bind(static_cast<bool (*)(const QMetaObject::Connection &)>(&QObject::disconnect),
|
[pixmapLabel, devId = connection.myId(), size](const QString &text, const QByteArray &data) {
|
||||||
QObject::connect(&connection, &SyncthingConnection::qrCodeAvailable,
|
if (text != devId) {
|
||||||
[pixmapLabel, devId = connection.myId(), size](const QString &text, const QByteArray &data) {
|
return;
|
||||||
if (text != devId) {
|
}
|
||||||
return;
|
auto pixmap = QPixmap();
|
||||||
}
|
pixmap.loadFromData(data);
|
||||||
auto pixmap = QPixmap();
|
if (size) {
|
||||||
pixmap.loadFromData(data);
|
pixmap = pixmap.scaledToHeight(size, Qt::SmoothTransformation);
|
||||||
if (size) {
|
}
|
||||||
pixmap = pixmap.scaledToHeight(size, Qt::SmoothTransformation);
|
pixmapLabel->setPixmap(pixmap);
|
||||||
}
|
});
|
||||||
pixmapLabel->setPixmap(pixmap);
|
|
||||||
})));
|
|
||||||
dlg->setLayout(layout);
|
dlg->setLayout(layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue