forked from qt-creator/qt-creator
QmlDesigner: Fix font preview tooltip image
The preview tooltip was recently reduced in size, but font previews were still being rendered the old size and scaled down, degrading image quality. The new default size is bit too small to render the sample text of fonts nicely, so added an option to set unscaled image to the tooltip, allowing us to use twice as wide preview images for fonts. Fixes: QDS-6486 Change-Id: Ieaabfbea11e47509de7cd6aed93464d8595ea541 Reviewed-by: Samuel Ghinet <samuel.ghinet@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io> Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -62,10 +62,16 @@ void PreviewImageTooltip::setInfo(const QString &info)
|
||||
m_ui->infoLabel->setText(info);
|
||||
}
|
||||
|
||||
void PreviewImageTooltip::setImage(const QImage &image)
|
||||
void PreviewImageTooltip::setImage(const QImage &image, bool scale)
|
||||
{
|
||||
m_ui->imageLabel->setPixmap(QPixmap::fromImage({image}).scaled(m_ui->imageLabel->width(),
|
||||
m_ui->imageLabel->height(),
|
||||
Qt::KeepAspectRatio));
|
||||
QPixmap pm = QPixmap::fromImage({image});
|
||||
if (scale) {
|
||||
m_ui->imageLabel->setPixmap(pm.scaled(m_ui->imageLabel->width(),
|
||||
m_ui->imageLabel->height(),
|
||||
Qt::KeepAspectRatio));
|
||||
} else {
|
||||
m_ui->imageLabel->setPixmap(pm);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user