VirtualBox

Changeset 72813 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Jul 3, 2018 9:41:00 AM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
123357
Message:

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

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
4 edited

Legend:

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

    r72022 r72813  
    5858}
    5959
    60 void UITakeSnapshotDialog::setPixmap(const QPixmap &pixmap)
    61 {
    62     m_pLabelIcon->setPixmap(pixmap);
     60void UITakeSnapshotDialog::setIcon(const QIcon &icon)
     61{
     62    m_icon = icon;
     63    updatePixmap();
    6364}
    6465
     
    7677{
    7778    return m_pEditorDescription->toPlainText();
     79}
     80
     81bool UITakeSnapshotDialog::event(QEvent *pEvent)
     82{
     83    /* Handle know event types: */
     84    switch (pEvent->type())
     85    {
     86        case QEvent::Show:
     87        case QEvent::ScreenChangeInternal:
     88        {
     89            /* Update pixmap: */
     90            updatePixmap();
     91            break;
     92        }
     93        default:
     94            break;
     95    }
     96
     97    /* Call to base-class: */
     98    return QIWithRetranslateUI<QIDialog>::event(pEvent);
    7899}
    79100
     
    273294    }
    274295}
     296
     297void UITakeSnapshotDialog::updatePixmap()
     298{
     299    const int iIconMetric = QApplication::style()->pixelMetric(QStyle::PM_LargeIconSize);
     300    m_pLabelIcon->setPixmap(m_icon.pixmap(windowHandle(), QSize(iIconMetric, iIconMetric)));
     301}
  • trunk/src/VBox/Frontends/VirtualBox/src/UITakeSnapshotDialog.h

    r72022 r72813  
    1818#ifndef ___UITakeSnapshotDialog_h___
    1919#define ___UITakeSnapshotDialog_h___
     20
     21/* Qt includes: */
     22#include <QIcon>
    2023
    2124/* GUI includes: */
     
    4346    UITakeSnapshotDialog(QWidget *pParent, const CMachine &comMachine);
    4447
    45     /** Defines snapshot @a pixmap. */
    46     void setPixmap(const QPixmap &pixmap);
     48    /** Defines snapshot @a icon. */
     49    void setIcon(const QIcon &icon);
    4750
    4851    /** Defines snapshot @a strName. */
     
    5558
    5659protected:
     60
     61    /** Handles any Qt @a pEvent. */
     62    virtual bool event(QEvent *pEvent) /* override */;
    5763
    5864    /** Handles translation event. */
     
    7177    void prepareContents();
    7278
     79    /** Updates pixmap. */
     80    void updatePixmap();
     81
    7382    /** Holds the wrapper of machine to take snapshot for. */
    7483    const CMachine &m_comMachine;
     84
     85    /** Holds the snapshot icon. */
     86    QIcon m_icon;
    7587
    7688    /** Holds the amount of immutable attachments. */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r71374 r72813  
    16901690    /* Assign corresponding icon: */
    16911691    if (uisession() && uisession()->machineWindowIcon())
    1692     {
    1693         const int iIconMetric = QApplication::style()->pixelMetric(QStyle::PM_LargeIconSize);
    1694         pDlg->setPixmap(uisession()->machineWindowIcon()->pixmap(QSize(iIconMetric, iIconMetric)));
    1695     }
     1692        pDlg->setIcon(*uisession()->machineWindowIcon());
    16961693
    16971694    /* Search for the max available filter index: */
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UISnapshotPane.cpp

    r72215 r72813  
    16041604
    16051605                /* Assign corresponding icon: */
    1606                 QPixmap pixmap = vboxGlobal().vmUserPixmapDefault(comMachine);
    1607                 if (pixmap.isNull())
    1608                     pixmap = vboxGlobal().vmGuestOSTypePixmapDefault(comMachine.GetOSTypeId());
    1609                 pDlg->setPixmap(pixmap);
     1606                QIcon icon = vboxGlobal().vmUserIcon(comMachine);
     1607                if (icon.isNull())
     1608                    icon = vboxGlobal().vmGuestOSTypeIcon(comMachine.GetOSTypeId());
     1609                pDlg->setIcon(icon);
    16101610
    16111611                /* Assign corresponding snapshot name: */
Note: See TracChangeset for help on using the changeset viewer.

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