Skip to content

Commit

Permalink
Divide the pixmap size with device pixel ratio for labels size (#7850)
Browse files Browse the repository at this point in the history
Use QLabel::setScaledContents(true) to automatically scale the pixmap
Fixes #7768
  • Loading branch information
adeas31 committed Sep 2, 2021
1 parent c80f58e commit e6b71af
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions OMEdit/OMEditLIB/Element/ElementProperties.cpp
Expand Up @@ -595,6 +595,7 @@ GroupBox::GroupBox(const QString &title, QWidget *parent)
: QGroupBox(title, parent)
{
mpGroupImageLabel = new Label;
mpGroupImageLabel->setScaledContents(true);
mpGridLayout = new QGridLayout;
mpGridLayout->setObjectName(title);
mpGridLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
Expand All @@ -613,6 +614,8 @@ void GroupBox::setGroupImage(QString groupImage)
{
if (QFile::exists(groupImage)) {
QPixmap pixmap(groupImage);
mpGroupImageLabel->setMaximumWidth(pixmap.width() / qApp->devicePixelRatio());
mpGroupImageLabel->setMaximumHeight(pixmap.height() / qApp->devicePixelRatio());
mpGroupImageLabel->setPixmap(pixmap);
}
}
Expand Down

0 comments on commit e6b71af

Please sign in to comment.