VirtualBox

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


Ignore:
Timestamp:
May 24, 2021 3:14:21 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
144585
Message:

FE/Qt: bugref:10003: Update related to Chooser and Tool panes rework introduced in r144189 and directed to let items have native highlight foreground color depending on background luminance; A bit of fallback colors for foreground color calculation algorithm.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGlobal.cpp

    r89240 r89242  
    711711        const QColor simpleText = pal.color(QPalette::Active, QPalette::Text);
    712712        const QColor highlightText = pal.color(QPalette::Active, QPalette::HighlightedText);
    713         const QColor lightText = simpleText.black() < highlightText.black() ? simpleText : highlightText;
    714         const QColor darkText = simpleText.black() > highlightText.black() ? simpleText : highlightText;
     713        QColor lightText = simpleText.black() < highlightText.black() ? simpleText : highlightText;
     714        QColor darkText = simpleText.black() > highlightText.black() ? simpleText : highlightText;
     715        if (lightText.black() > 128)
     716            lightText = QColor(Qt::white);
     717        if (darkText.black() < 128)
     718            darkText = QColor(Qt::black);
    715719
    716720        /* Gather foreground color for background one: */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGroup.cpp

    r89241 r89242  
    17381738        const QColor simpleText = pal.color(QPalette::Active, QPalette::Text);
    17391739        const QColor highlightText = pal.color(QPalette::Active, QPalette::HighlightedText);
    1740         const QColor lightText = simpleText.black() < highlightText.black() ? simpleText : highlightText;
    1741         const QColor darkText = simpleText.black() > highlightText.black() ? simpleText : highlightText;
     1740        QColor lightText = simpleText.black() < highlightText.black() ? simpleText : highlightText;
     1741        QColor darkText = simpleText.black() > highlightText.black() ? simpleText : highlightText;
     1742        if (lightText.black() > 128)
     1743            lightText = QColor(Qt::white);
     1744        if (darkText.black() < 128)
     1745            darkText = QColor(Qt::black);
    17421746
    17431747        /* Gather foreground color for background one: */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemMachine.cpp

    r89240 r89242  
    10951095        const QColor simpleText = pal.color(QPalette::Active, QPalette::Text);
    10961096        const QColor highlightText = pal.color(QPalette::Active, QPalette::HighlightedText);
    1097         const QColor lightText = simpleText.black() < highlightText.black() ? simpleText : highlightText;
    1098         const QColor darkText = simpleText.black() > highlightText.black() ? simpleText : highlightText;
     1097        QColor lightText = simpleText.black() < highlightText.black() ? simpleText : highlightText;
     1098        QColor darkText = simpleText.black() > highlightText.black() ? simpleText : highlightText;
     1099        if (lightText.black() > 128)
     1100            lightText = QColor(Qt::white);
     1101        if (darkText.black() < 128)
     1102            darkText = QColor(Qt::black);
    10991103
    11001104        /* Gather foreground color for background one: */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsItem.cpp

    r88862 r89242  
    868868        const QColor simpleText = pal.color(QPalette::Active, QPalette::Text);
    869869        const QColor highlightText = pal.color(QPalette::Active, QPalette::HighlightedText);
    870         const QColor lightText = simpleText.black() < highlightText.black() ? simpleText : highlightText;
    871         const QColor darkText = simpleText.black() > highlightText.black() ? simpleText : highlightText;
     870        QColor lightText = simpleText.black() < highlightText.black() ? simpleText : highlightText;
     871        QColor darkText = simpleText.black() > highlightText.black() ? simpleText : highlightText;
     872        if (lightText.black() > 128)
     873            lightText = QColor(Qt::white);
     874        if (darkText.black() < 128)
     875            darkText = QColor(Qt::black);
    872876
    873877        /* Gather foreground color for background one: */
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