qt, refactor: Inline GUIUtil::GetImage function

This commit is contained in:
Hennadii Stepanov 2025-04-02 20:48:36 +01:00
parent 4b36ab3a6a
commit d1ec6db249
No known key found for this signature in database
GPG Key ID: 410108112E7EA81F
3 changed files with 5 additions and 11 deletions

View File

@ -962,15 +962,6 @@ bool HasPixmap(const QLabel* label)
return !label->pixmap(Qt::ReturnByValue).isNull();
}
QImage GetImage(const QLabel* label)
{
if (!HasPixmap(label)) {
return QImage();
}
return label->pixmap(Qt::ReturnByValue).toImage();
}
QString MakeHtmlLink(const QString& source, const QString& link)
{
return QString(source).replace(

View File

@ -347,7 +347,6 @@ namespace GUIUtil
* QPixmap* QLabel::pixmap() is deprecated since Qt 5.15.
*/
bool HasPixmap(const QLabel* label);
QImage GetImage(const QLabel* label);
/**
* Splits the string into substrings wherever separator occurs, and returns

View File

@ -92,7 +92,11 @@ bool QRImageWidget::setQR(const QString& data, const QString& text)
QImage QRImageWidget::exportImage()
{
return GUIUtil::GetImage(this);
if (!GUIUtil::HasPixmap(this)) {
return QImage();
}
return this->pixmap(Qt::ReturnByValue).toImage();
}
void QRImageWidget::mousePressEvent(QMouseEvent *event)