VirtualBox

Changeset 72704 in vbox


Ignore:
Timestamp:
Jun 27, 2018 3:38:30 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
123233
Message:

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

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

Legend:

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

    r72215 r72704  
    243243        m_cSnaphot = m_machine.GetSnapshotCount();
    244244
    245         m_pixmap = vboxGlobal().vmUserPixmapDefault(m_machine, &m_logicalPixmapSize);
    246         if (m_pixmap.isNull())
    247             m_pixmap = vboxGlobal().vmGuestOSTypePixmapDefault(m_strOSTypeId, &m_logicalPixmapSize);
    248 
    249245        m_groups = m_machine.GetGroups().toList();
    250246
     
    297293        m_cSnaphot = 0;
    298294
    299         m_pixmap = vboxGlobal().vmGuestOSTypePixmapDefault("Other", &m_logicalPixmapSize);
    300295        m_groups.clear();
    301296        m_pid = (ULONG) ~0;
     
    312307    }
    313308
     309    /* Recache item pixmap: */
     310    recachePixmap();
     311
    314312    return needsResort;
     313}
     314
     315void UIVMItem::recachePixmap()
     316{
     317    /* If machine is accessible: */
     318    if (m_fAccessible)
     319    {
     320        /* First, we are trying to acquire personal machine guest OS type icon: */
     321        m_pixmap = vboxGlobal().vmUserPixmapDefault(m_machine, &m_logicalPixmapSize);
     322        /* If there is nothing, we are using icon corresponding to cached guest OS type: */
     323        if (m_pixmap.isNull())
     324            m_pixmap = vboxGlobal().vmGuestOSTypePixmapDefault(m_strOSTypeId, &m_logicalPixmapSize);
     325    }
     326    /* Otherwise: */
     327    else
     328    {
     329        /* We are using "Other" guest OS type icon: */
     330        m_pixmap = vboxGlobal().vmGuestOSTypePixmapDefault("Other", &m_logicalPixmapSize);
     331    }
    315332}
    316333
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVMItem.h

    r72215 r72704  
    6767    const QStringList &groups();
    6868    bool recache();
     69    /** Recaches item pixmap. */
     70    void recachePixmap();
    6971
    7072    bool canSwitchTo() const;
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemMachine.cpp

    r69714 r72704  
    2626
    2727/* GUI includes: */
     28# include "UIGChooser.h"
    2829# include "UIGChooserItemMachine.h"
    2930# include "UIGChooserItemGroup.h"
     
    254255    AssertReturnVoid(!stateIcon.isNull());
    255256    const QSize statePixmapSize = QSize(iIconMetric, iIconMetric);
    256     const QPixmap statePixmap = stateIcon.pixmap(statePixmapSize);
     257    const QPixmap statePixmap = stateIcon.pixmap(model()->chooser()->window()->windowHandle(), statePixmapSize);
    257258    /* Update linked values: */
    258259    if (m_statePixmapSize != statePixmapSize)
     
    810811{
    811812    return new UIGChooserItemMimeData(this);
     813}
     814
     815void UIGChooserItemMachine::showEvent(QShowEvent *pEvent)
     816{
     817    /* Call to base-class: */
     818    UIGChooserItem::showEvent(pEvent);
     819
     820    /* Recache and update pixmaps: */
     821    recachePixmap();
     822    updatePixmaps();
    812823}
    813824
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemMachine.h

    r69500 r72704  
    139139    QMimeData* createMimeData();
    140140
     141    /** Handles show @a pEvent. */
     142    virtual void showEvent(QShowEvent *pEvent) /* override */;
     143
    141144    /* Handler: Resize handling stuff: */
    142145    void resizeEvent(QGraphicsSceneResizeEvent *pEvent);
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