VirtualBox

Changeset 97322 in vbox


Ignore:
Timestamp:
Oct 27, 2022 1:02:36 PM (2 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
154313
Message:

FE/Qt: bugref:10313. Some more tiddying up.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors
Files:
2 edited

Legend:

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

    r97318 r97322  
    6868    , m_pMinScaleLabel(0)
    6969    , m_pMaxScaleLabel(0)
     70    , m_iSliderRangeDivisor(10)
    7071{
    7172    /* Prepare: */
     
    113114void UIFontScaleEditor::sltScaleSpinBoxValueChanged(int value)
    114115{
    115     setSliderValue(0.1 * value);
     116    setSliderValue(value / m_iSliderRangeDivisor);
    116117}
    117118
    118119void UIFontScaleEditor::sltScaleSliderValueChanged(int value)
    119120{
    120     setSpinBoxValue(10 * value);
    121     setFontScaleFactor(10 * value);
     121    setSpinBoxValue(m_iSliderRangeDivisor * value);
     122    setFontScaleFactor(m_iSliderRangeDivisor * value);
    122123}
    123124
    124125void UIFontScaleEditor::setFontScaleFactor(int iFontScaleFactor)
    125126{
    126     setSliderValue(0.1 * iFontScaleFactor);
     127    setSliderValue(iFontScaleFactor / m_iSliderRangeDivisor);
    127128    setSpinBoxValue(iFontScaleFactor);
    128129}
     
    130131int UIFontScaleEditor::fontScaleFactor() const
    131132{
    132     return m_pScaleSlider->value();
     133    return m_pScaleSpinBox->value();
    133134}
    134135
     
    157158            if (m_pLabel)
    158159                m_pLabel->setBuddy(m_pScaleSlider);
    159             m_pScaleSlider->setPageStep(10);
    160             m_pScaleSlider->setSingleStep(1);
    161             m_pScaleSlider->setTickInterval(10);
    162160            m_pScaleSlider->setSnappingEnabled(true);
    163161            connect(m_pScaleSlider, static_cast<void(QIAdvancedSlider::*)(int)>(&QIAdvancedSlider::valueChanged),
     
    197195    const int iMaximum = UIExtraDataDefs::iFontScaleMax;
    198196
    199     /* Set slider to 1/10 of the range to make sure mouse drag stops only on ticks: */
    200     m_pScaleSlider->setMinimum(0.1 * iMinimum);
    201     m_pScaleSlider->setMaximum(0.1 * iMaximum);
     197    /* Set slider min, max, and intervals so to make sure mouse drag stops only on ticks: */
     198    m_pScaleSlider->setMinimum(iMinimum / m_iSliderRangeDivisor);
     199    m_pScaleSlider->setMaximum(iMaximum / m_iSliderRangeDivisor);
    202200
    203201    m_pScaleSlider->setPageStep(2);
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIFontScaleEditor.h

    r97318 r97322  
    103103        QLabel           *m_pMaxScaleLabel;
    104104    /** @} */
     105    /** Hold the factor by which we divided spinbox's @a range to set slider's range to make slider mouse move stop on ticks. */
     106    const int m_iSliderRangeDivisor;
    105107};
    106108
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