VirtualBox

Changeset 74962 in vbox


Ignore:
Timestamp:
Oct 21, 2018 1:48:50 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
125980
Message:

FE/Qt: bugref:9241: VirtualBox Manager: Tools pane: A bit of handling for disabled items.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsItem.cpp

    r74599 r74962  
    3232
    3333/* GUI includes: */
     34# include "UIImageTools.h"
    3435# include "UITools.h"
    3536# include "UIToolsItem.h"
     
    713714        bgGrad.setColorAt(1, backgroundColor.lighter(m_iHighlightLightnessMin));
    714715        pPainter->fillRect(rectangle, bgGrad);
    715     }
     716        }
    716717    /* Hovering background: */
    717718    else if (isHovered())
     
    726727        bgGrad.setColorAt(1, backgroundColor.lighter(m_iHoverLightnessMin));
    727728        pPainter->fillRect(rectangle, bgGrad);
    728     }
     729        }
    729730    /* Default background: */
    730731    else
     
    747748void UIToolsItem::paintFrame(QPainter *pPainter, const QRect &rectangle) const
    748749{
     750    /* Don't paint frame for disabled items: */
     751    if (!isEnabled())
     752        return;
     753
    749754    /* Save painter: */
    750755    pPainter->save();
     
    827832        int iPixmapY = (iFullHeight - m_pixmap.height() / m_pixmap.devicePixelRatio()) / 2;
    828833        /* Paint pixmap: */
    829         paintPixmap(/* Painter: */
    830                     pPainter,
    831                     /* Point to paint in: */
    832                     QPoint(iPixmapX, iPixmapY),
    833                     /* Pixmap to paint: */
    834                     m_pixmap);
     834        // WORKAROUND:
     835        // We have no disabled tool icons for now.
     836        // So we will emulate that functionality.
     837        // Maybe one day we should do that everywhere?
     838        /// @todo just use proper icons!
     839        if (!isEnabled())
     840            paintPixmap(/* Painter: */
     841                        pPainter,
     842                        /* Point to paint in: */
     843                        QPoint(iPixmapX, iPixmapY),
     844                        /* Pixmap to paint: */
     845                        QPixmap::fromImage(toGray(m_pixmap.toImage())));
     846        else
     847            paintPixmap(/* Painter: */
     848                        pPainter,
     849                        /* Point to paint in: */
     850                        QPoint(iPixmapX, iPixmapY),
     851                        /* Pixmap to paint: */
     852                        m_pixmap);
    835853    }
    836854
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