VirtualBox

Changeset 78669 in vbox for trunk/src/VBox


Ignore:
Timestamp:
May 22, 2019 5:00:37 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:6143. Scaling the led indicator along side with the keyboard.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/softkeyboard/UISoftKeyboard.cpp

    r78663 r78669  
    125125    UIKeyType type() const;
    126126
     127    void setScaleMultiplier(float fMultiplier);
     128
    127129    UIKeyState state() const;
    128130    QVector<LONG> scanCodeWithPrefix() const;
    129     void updateFontSize(float multiplier);
     131    void updateFontSize();
    130132
    131133    void release();
     
    150152    UIKeyState m_enmState;
    151153    QPalette     m_defaultPalette;
     154    float     m_fScaleMultiplier;
    152155};
    153156
     
    300303    , m_enmType(UIKeyType_SingleState)
    301304    , m_enmState(UIKeyState_NotPressed)
     305    , m_fScaleMultiplier(1.f)
    302306{
    303307    m_iDefaultPointSize = font().pointSize();
     
    356360}
    357361
     362void UISoftKeyboardKey::setScaleMultiplier(float fMultiplier)
     363{
     364    m_fScaleMultiplier = fMultiplier;
     365}
     366
    358367UIKeyState UISoftKeyboardKey::state() const
    359368{
     
    361370}
    362371
    363 void UISoftKeyboardKey::updateFontSize(float multiplier)
     372void UISoftKeyboardKey::updateFontSize()
    364373{
    365374    if (m_iDefaultPointSize != -1)
    366375    {
    367376        QFont newFont = font();
    368         newFont.setPointSize(multiplier * m_iDefaultPointSize);
     377        newFont.setPointSize(m_fScaleMultiplier * m_iDefaultPointSize);
    369378        setFont(newFont);
    370379    }
     
    372381    {
    373382        QFont newFont = font();
    374         newFont.setPixelSize(multiplier * m_iDefaultPixelSize);
     383        newFont.setPixelSize(m_fScaleMultiplier * m_iDefaultPixelSize);
    375384        setFont(newFont);
    376385    }
     
    409418    int unitSize = qApp->style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing);
    410419
    411     float fRadius = 1.1 * unitSize;
    412     float fSpace = unitSize;
     420    float fRadius = m_fScaleMultiplier * 1.1 * unitSize;
     421    float fSpace = m_fScaleMultiplier * unitSize;
    413422    QRectF rectangle(fSpace, fSpace, fRadius, fRadius);
    414423
     
    418427void UISoftKeyboardKey::updateState(bool fPressed)
    419428{
     429    if (m_enmType == UIKeyType_SingleState)
     430        return;
    420431    if (m_enmType == UIKeyType_TriState)
    421432    {
     
    496507            continue;
    497508        pKey->setVisible(true);
    498         pKey->updateFontSize(fMultiplier);
     509        pKey->setScaleMultiplier(fMultiplier);
     510        pKey->updateFontSize();
    499511        int iKeyWidth = fMultiplier * pKey->width();
    500512        if (i != m_keys.size() - 1)
     
    592604    {
    593605        UISoftKeyboardKey *pModifier = m_pressedModifiers[i];
     606        if (pModifier->type() == UIKeyType_DualState)
     607            continue;
    594608        if (pModifier->scanCodePrefix() != 0)
    595609            sequence << pModifier->scanCodePrefix();
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