VirtualBox

Changeset 55880 in vbox


Ignore:
Timestamp:
May 15, 2015 5:50:47 PM (10 years ago)
Author:
vboxsync
Message:

FE/Qt: 6278: Selector UI: Snapshot widget: Proper size-hint calculation taking into account HiDPI icon size.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/VBoxSnapshotsWgt.cpp

    r55214 r55880  
    103103                                         .arg (QTreeWidgetItem::data (aColumn, Qt::DisplayRole).toString())
    104104                                         .arg (QTreeWidgetItem::data (aColumn, Qt::UserRole).toString()));
     105            case Qt::SizeHintRole:
     106            {
     107                /* Determine the icon metric: */
     108                const QStyle *pStyle = QApplication::style();
     109                const int iIconMetric = pStyle->pixelMetric(QStyle::PM_SmallIconSize);
     110                /* Determine the minimum size-hint for this tree-widget-item: */
     111                const QSize baseSizeHint = QTreeWidgetItem::data(aColumn, aRole).toSize();
     112                /* Determine the effective height-hint for this tree-widget-item: */
     113                const int iEffectiveHeightHint = qMax(baseSizeHint.height(),
     114                                                      iIconMetric + 2 * 2 /* margins */);
     115                /* Return size-hint for this tree-widget-item: */
     116                return QSize(baseSizeHint.width(), iEffectiveHeightHint);
     117            }
    105118            default:
    106119                break;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette