VirtualBox

Ignore:
Timestamp:
Sep 23, 2024 5:39:34 PM (5 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
164899
Message:

FE/Qt: bugref:10513: Global Preferences / VM Settings: Make disabled labels/editors more distinguishable by rendering their fonts italic; That is the 1st step of improving visual accessibility for disabled widgets.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UIAdvancedSettingsDialog.cpp

    r106064 r106121  
    3636#include <QCoreApplication>
    3737#include <QGridLayout>
     38#include <QLabel>
    3839#include <QPainter>
    3940#include <QPainterPath>
     
    4445#include <QScrollBar>
    4546#include <QSlider>
     47#include <QSpinBox>
    4648#include <QStackedWidget>
    4749#include <QTimer>
     
    983985    }
    984986
     987    /* Handle enabled-change events: */
     988    if (pEvent->type() == QEvent::EnabledChange)
     989    {
     990        /* Check if watched object is of widget type: */
     991        QWidget *pWidget = qobject_cast<QWidget*>(pObject);
     992        if (pWidget)
     993        {
     994            QFont font = pWidget->font();
     995            font.setItalic(!pWidget->isEnabledTo(0));
     996            pWidget->setFont(font);
     997        }
     998    }
     999
    9851000    /* Call to base-class: */
    9861001    return QMainWindow::eventFilter(pObject, pEvent);
     
    10241039    /* Prevent handler from calling twice: */
    10251040    m_fPolished = true;
     1041
     1042    /* Make sure widgets disabled initially have font updated: */
     1043    foreach (QWidget *pChild, findChildren<QWidget*>())
     1044    {
     1045        const bool fDisabled = !pChild->isEnabledTo(0);
     1046        if (fDisabled)
     1047        {
     1048            QFont font = pChild->font();
     1049            font.setItalic(fDisabled);
     1050            pChild->setFont(font);
     1051        }
     1052    }
    10261053
    10271054    /* Install event-filters for all the required children.
     
    10341061            || qobject_cast<QAbstractSpinBox*>(pChild)
    10351062            || qobject_cast<QAbstractSpinBox*>(pChild->parent())
     1063            || qobject_cast<QCheckBox*>(pChild)
    10361064            || qobject_cast<QComboBox*>(pChild)
     1065            || qobject_cast<QLabel*>(pChild)
     1066            || qobject_cast<QLineEdit*>(pChild)
    10371067            || qobject_cast<QSlider*>(pChild)
     1068            || qobject_cast<QSpinBox*>(pChild)
    10381069            || qobject_cast<QTabWidget*>(pChild)
    10391070            || qobject_cast<QTabWidget*>(pChild->parent()))
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