VirtualBox

Changeset 9779 in vbox


Ignore:
Timestamp:
Jun 17, 2008 4:02:42 PM (17 years ago)
Author:
vboxsync
Message:

FE/Qt4: Fixed the wrong text color bug of the panel labels if they have the focus (VDM).

Location:
trunk/src/VBox/Frontends/VirtualBox4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox4/include/QILabel_p.h

    r9729 r9779  
    9090    void mouseMoveEvent (QMouseEvent *aEvent);
    9191    void contextMenuEvent (QContextMenuEvent *aEvent);
     92    void focusInEvent (QFocusEvent *aEvent);
     93    void focusOutEvent (QFocusEvent *aEvent);
    9294
    9395protected slots:
  • trunk/src/VBox/Frontends/VirtualBox4/src/QILabel.cpp

    r9392 r9779  
    258258        /* The label should be able to get the focus */
    259259        setFocusPolicy (Qt::StrongFocus);
    260         /* Change the appearance in focus state a little bit */
     260        /* Change the appearance in focus state a little bit.
     261         * Note: Unfortunately QLabel, precisely the text of a QLabel isn't
     262         * styleable. The trolls have forgotten the simplest case ... So this
     263         * is done by changing the current used palette in the In/Out-focus
     264         * events below. */
    261265        setStyleSheet (QString("QLabel::focus {\
    262                                color: palette(highlighted-text);\
    263266                               background-color: palette(highlight);\
    264267                               }"));
     
    327330        QLabel::contextMenuEvent (aEvent);
    328331}
     332
     333void QILabelPrivate::focusInEvent (QFocusEvent * /* aEvent */)
     334{
     335    if (mFullSizeSeclection)
     336    {
     337        /* Set the text color to the current used highlight text color. */
     338        QPalette pal = qApp->palette();
     339        pal.setBrush (QPalette::WindowText, pal.brush (QPalette::HighlightedText));
     340        setPalette (pal);
     341    }
     342}
     343
     344void QILabelPrivate::focusOutEvent (QFocusEvent *aEvent)
     345{
     346    /* Reset to the default palette */
     347    if (mFullSizeSeclection &&
     348        aEvent->reason() != Qt::PopupFocusReason) /* For right mouse click */
     349        setPalette (qApp->palette());
     350}
     351
    329352
    330353void QILabelPrivate::copy()
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