VirtualBox

Ignore:
Timestamp:
Jun 5, 2019 2:22:48 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9434: Form Editor widget: Suffix support for CRangedIntegerFormValue handling.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIFormEditorWidget.cpp

    r78954 r78997  
    149149    /** Constructs null ranged-integer data. */
    150150    RangedIntegerData()
    151         : m_iMinimum(-1), m_iMaximum(-1), m_iInteger(-1) {}
    152     /** Constructs ranged-integer data on the basis of passed @a iMinimum, @a iMaximum and @a iInteger. */
    153     RangedIntegerData(int iMinimum, int iMaximum, int iInteger)
    154         : m_iMinimum(iMinimum), m_iMaximum(iMaximum), m_iInteger(iInteger) {}
     151        : m_iMinimum(-1), m_iMaximum(-1)
     152        , m_iInteger(-1), m_strSuffix(QString()) {}
     153    /** Constructs ranged-integer data on the basis of passed @a iMinimum, @a iMaximum, @a iInteger and @a strSuffix. */
     154    RangedIntegerData(int iMinimum, int iMaximum, int iInteger, const QString strSuffix)
     155        : m_iMinimum(iMinimum), m_iMaximum(iMaximum)
     156        , m_iInteger(iInteger), m_strSuffix(strSuffix) {}
    155157    /** Constructs ranged-integer data on the basis of @a another ranged-integer data. */
    156158    RangedIntegerData(const RangedIntegerData &another)
    157         : m_iMinimum(another.minimum()), m_iMaximum(another.maximum()), m_iInteger(another.integer()) {}
     159        : m_iMinimum(another.minimum()), m_iMaximum(another.maximum())
     160        , m_iInteger(another.integer()), m_strSuffix(another.suffix()) {}
    158161
    159162    /** Assigns values of @a another ranged-integer to this one. */
     
    163166        m_iMaximum = another.maximum();
    164167        m_iInteger = another.integer();
     168        m_strSuffix = another.suffix();
    165169        return *this;
    166170    }
     
    172176    /** Returns current value. */
    173177    int integer() const { return m_iInteger; }
     178    /** Returns suffix value. */
     179    QString suffix() const { return m_strSuffix; }
    174180
    175181private:
    176182
    177183    /** Holds minimum value. */
    178     int  m_iMinimum;
     184    int      m_iMinimum;
    179185    /** Holds maximum value. */
    180     int  m_iMaximum;
     186    int      m_iMaximum;
    181187    /** Holds current value. */
    182     int  m_iInteger;
     188    int      m_iInteger;
     189    /** Holds suffix value. */
     190    QString  m_strSuffix;
    183191};
    184192Q_DECLARE_METATYPE(RangedIntegerData);
     
    594602    setMaximum(rangedInteger.maximum());
    595603    setValue(rangedInteger.integer());
     604    setSuffix(QString(" %1").arg(QApplication::translate("VBoxGlobal", rangedInteger.suffix().toUtf8().constData())));
    596605}
    597606
    598607RangedIntegerData RangedIntegerEditor::rangedInteger() const
    599608{
    600     return RangedIntegerData(minimum(), maximum(), value());
     609    return RangedIntegerData(minimum(), maximum(), value(), suffix());
    601610}
    602611
     
    856865            const int iMaximum = comValue.GetMaximum();
    857866            const int iInteger = comValue.GetInteger();
    858             m_rangedInteger = RangedIntegerData(iMinimum, iMaximum, iInteger);
     867            const QString strSuffix = comValue.GetSuffix();
     868            m_rangedInteger = RangedIntegerData(iMinimum, iMaximum, iInteger, strSuffix);
    859869            m_cells[UIFormEditorDataType_Value]->setText(QString::number(m_rangedInteger.integer()));
    860870            /// @todo check for errors
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