VirtualBox

Ignore:
Timestamp:
Jul 3, 2018 9:49:09 AM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:8694: Adjust icons when moving GUI between screen with different DPI: UIPopupBox.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/widgets
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupBox.cpp

    r71484 r72814  
    239239{
    240240    return m_fOpened;
     241}
     242
     243bool UIPopupBox::event(QEvent *pEvent)
     244{
     245    /* Handle know event types: */
     246    switch (pEvent->type())
     247    {
     248        case QEvent::Show:
     249        case QEvent::ScreenChangeInternal:
     250        {
     251            /* Update pixmaps: */
     252            updateTitleIcon();
     253            updateWarningIcon();
     254            break;
     255        }
     256        default:
     257            break;
     258    }
     259
     260    /* Call to base-class: */
     261    return QWidget::event(pEvent);
    241262}
    242263
     
    316337{
    317338    /* Assign title-icon: */
    318     const QStyle *pStyle = QApplication::style();
    319     const int iIconMetric = pStyle->pixelMetric(QStyle::PM_SmallIconSize);
    320     m_pTitleIcon->setPixmap(m_titleIcon.pixmap(iIconMetric, iIconMetric));
     339    const int iIconMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize);
     340    m_pTitleIcon->setPixmap(m_titleIcon.pixmap(window()->windowHandle(), QSize(iIconMetric, iIconMetric)));
    321341}
    322342
     
    325345    /* Hide warning-icon if its null: */
    326346    m_pWarningIcon->setHidden(m_warningIcon.isNull());
     347
    327348    /* Assign warning-icon: */
    328     const QStyle *pStyle = QApplication::style();
    329     const int iIconMetric = pStyle->pixelMetric(QStyle::PM_SmallIconSize);
    330     m_pWarningIcon->setPixmap(m_warningIcon.pixmap(iIconMetric, iIconMetric));
     349    const int iIconMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize);
     350    m_pWarningIcon->setPixmap(m_warningIcon.pixmap(window()->windowHandle(), QSize(iIconMetric, iIconMetric)));
    331351}
    332352
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupBox.h

    r71630 r72814  
    106106
    107107protected:
     108
     109    /** Handles any Qt @a pEvent. */
     110    virtual bool event(QEvent *pEvent) /* override */;
    108111
    109112    /** Pre-handles standard Qt @a pEvent for passed @a pObject. */
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