VirtualBox

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


Ignore:
Timestamp:
Sep 11, 2014 4:29:54 PM (10 years ago)
Author:
vboxsync
Message:

FE/Qt: 3646: Runtime UI: Status-bar editor: Icon-size bug-fix for r95954.

File:
1 edited

Legend:

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

    r52649 r52708  
    9696    /** Holds the button pixmap. */
    9797    QPixmap m_pixmap;
     98    /** Holds the button pixmap size. */
     99    QSize m_pixmapSize;
    98100    /** Holds whether button is checked. */
    99101    bool m_fChecked;
     
    205207    /* Prepare icon for assigned type: */
    206208    const QIcon icon = gpConverter->toIcon(m_type);
     209    m_pixmapSize = icon.availableSizes().first();
     210    m_pixmap = icon.pixmap(m_pixmapSize);
     211
    207212    /* Cache button size-hint: */
    208213    QStyleOptionButton option;
    209214    option.initFrom(this);
    210215    const QRect minRect = QApplication::style()->subElementRect(QStyle::SE_CheckBoxIndicator, &option);
    211     m_size = icon.availableSizes().first().expandedTo(minRect.size());
    212     /* Cache pixmap of same size: */
    213     m_pixmap = icon.pixmap(m_size);
     216    m_size = m_pixmapSize.expandedTo(minRect.size());
    214217
    215218    /* Translate finally: */
     
    253256    /* Draw pixmap for unhovered-state: */
    254257    else
    255         painter.drawItemPixmap(option.rect, Qt::AlignCenter, m_pixmap);
     258    {
     259        QRect pixmapRect = QRect(QPoint(0, 0), m_pixmapSize);
     260        pixmapRect.moveCenter(option.rect.center());
     261        painter.drawItemPixmap(pixmapRect, Qt::AlignCenter, m_pixmap);
     262    }
    256263}
    257264
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