VirtualBox

Changeset 97318 in vbox


Ignore:
Timestamp:
Oct 27, 2022 11:49:30 AM (2 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10313 Making the spinbox's lineedit read only.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.cpp

    r97311 r97318  
    268268const char *UIExtraDataDefs::GUI_MediumSelector_DialogGeometry = "GUI/MediumSelector/DialogGeometry";
    269269
    270 const int UIExtraDataDefs::iFontScaleMin = 50;
    271 const int UIExtraDataDefs::iFontScaleMax = 150;
     270const int UIExtraDataDefs::iFontScaleMin = 30;
     271const int UIExtraDataDefs::iFontScaleMax = 170;
    272272
    273273/* Obsolete keys: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIFontScaleEditor.cpp

    r97312 r97318  
    2929#include <QGridLayout>
    3030#include <QLabel>
     31#include <QLineEdit>
    3132#include <QSpacerItem>
    3233#include <QSpinBox>
     
    4243#include <math.h>
    4344
     45class UIFontScaleFactorSpinBox : public QSpinBox
     46{
     47public:
     48    UIFontScaleFactorSpinBox(QWidget *parent = 0);
     49};
     50
     51UIFontScaleFactorSpinBox::UIFontScaleFactorSpinBox(QWidget *pParent /* = 0*/)
     52    :QSpinBox(pParent)
     53{
     54    QLineEdit *pLineEdit = new QLineEdit;
     55    if (pLineEdit)
     56    {
     57        pLineEdit->setReadOnly(true);
     58        setLineEdit(pLineEdit);
     59    }
     60}
    4461
    4562UIFontScaleEditor::UIFontScaleEditor(QWidget *pParent)
     
    84101    if (m_pMinScaleLabel)
    85102    {
    86         m_pMinScaleLabel->setText(QString("%1%").arg(m_pScaleSlider->minimum()));
     103        m_pMinScaleLabel->setText(QString("%1%").arg(m_pScaleSpinBox->minimum()));
    87104        m_pMinScaleLabel->setToolTip(tr("Minimum possible scale factor."));
    88105    }
    89106    if (m_pMaxScaleLabel)
    90107    {
    91         m_pMaxScaleLabel->setText(QString("%1%").arg(m_pScaleSlider->maximum()));
     108        m_pMaxScaleLabel->setText(QString("%1%").arg(m_pScaleSpinBox->maximum()));
    92109        m_pMaxScaleLabel->setToolTip(tr("Maximum possible scale factor."));
    93110    }
     
    96113void UIFontScaleEditor::sltScaleSpinBoxValueChanged(int value)
    97114{
    98     setSliderValue(value);
     115    setSliderValue(0.1 * value);
    99116}
    100117
    101118void UIFontScaleEditor::sltScaleSliderValueChanged(int value)
    102119{
    103     setSpinBoxValue(value);
    104     setFontScaleFactor(value);
     120    setSpinBoxValue(10 * value);
     121    setFontScaleFactor(10 * value);
    105122}
    106123
    107124void UIFontScaleEditor::setFontScaleFactor(int iFontScaleFactor)
    108125{
    109     setSliderValue(iFontScaleFactor);
     126    setSliderValue(0.1 * iFontScaleFactor);
    110127    setSpinBoxValue(iFontScaleFactor);
    111128}
     
    150167        }
    151168
    152         m_pScaleSpinBox = new QSpinBox(this);
     169        m_pScaleSpinBox = new UIFontScaleFactorSpinBox(this);
    153170        if (m_pScaleSpinBox)
    154171        {
     
    180197    const int iMaximum = UIExtraDataDefs::iFontScaleMax;
    181198
    182     m_pScaleSlider->setMinimum(iMinimum);
    183     m_pScaleSlider->setMaximum(iMaximum);
    184     m_pScaleSlider->setPageStep(20);
    185     m_pScaleSlider->setSingleStep(10);
    186     m_pScaleSlider->setTickInterval(10);
     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);
     202
     203    m_pScaleSlider->setPageStep(2);
     204    m_pScaleSlider->setSingleStep(1);
     205    m_pScaleSlider->setTickInterval(1);
    187206    m_pScaleSpinBox->setSingleStep(10);
     207
    188208    m_pScaleSpinBox->setMinimum(iMinimum);
    189209    m_pScaleSpinBox->setMaximum(iMaximum);
     210
     211    QLineEdit *pLineEdit = new QLineEdit;
     212    pLineEdit->setReadOnly(true);
     213
    190214    m_pScaleSlider->blockSignals(false);
    191215    m_pScaleSpinBox->blockSignals(false);
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIFontScaleEditor.h

    r97307 r97318  
    4242class QWidget;
    4343class QIAdvancedSlider;
     44class UIFontScaleFactorSpinBox;
    4445
    4546/** QWidget reimplementation providing GUI with monitor scale factor editing functionality.
     
    9899        QLabel           *m_pLabel;
    99100        QIAdvancedSlider *m_pScaleSlider;
    100         QSpinBox         *m_pScaleSpinBox;
     101        UIFontScaleFactorSpinBox         *m_pScaleSpinBox;
    101102        QLabel           *m_pMinScaleLabel;
    102103        QLabel           *m_pMaxScaleLabel;
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