VirtualBox

Changeset 78935 in vbox


Ignore:
Timestamp:
Jun 3, 2019 12:50:23 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
131057
Message:

FE/Qt: bugref:9434: Import Appliance wizard: Form Editor widget: A bit of refactoring: Split out editor classes implementation.

File:
1 edited

Legend:

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

    r78934 r78935  
    148148
    149149    /** Constructs ChoiceData editor passing @a pParent to the base-class. */
    150     ChoiceEditor(QWidget *pParent = 0)
    151         : QComboBox(pParent) {}
     150    ChoiceEditor(QWidget *pParent = 0);
    152151
    153152private:
    154153
    155154    /** Defines the @a choice. */
    156     void setChoice(const ChoiceData &choice)
    157     {
    158         addItems(choice.values().toList());
    159         setCurrentIndex(choice.selectedIndex());
    160     }
    161 
     155    void setChoice(const ChoiceData &choice);
    162156    /** Returns the choice. */
    163     ChoiceData choice() const
    164     {
    165         QVector<QString> choices(count());
    166         for (int i = 0; i < count(); ++i)
    167             choices[i] = itemText(i);
    168         return ChoiceData(choices, currentIndex());
    169     }
     157    ChoiceData choice() const;
    170158};
    171159
     
    180168
    181169    /** Constructs RangedIntegerData editor passing @a pParent to the base-class. */
    182     RangedIntegerEditor(QWidget *pParent = 0)
    183         : QSpinBox(pParent) {}
     170    RangedIntegerEditor(QWidget *pParent = 0);
    184171
    185172private:
    186173
    187174    /** Defines @a rangedInteger. */
    188     void setRangedInteger(const RangedIntegerData &rangedInteger)
    189     {
    190         setMinimum(rangedInteger.minimum());
    191         setMaximum(rangedInteger.maximum());
    192         setValue(rangedInteger.integer());
    193     }
    194 
     175    void setRangedInteger(const RangedIntegerData &rangedInteger);
    195176    /** Returns ranged-integer. */
    196     RangedIntegerData rangedInteger() const
    197     {
    198         return RangedIntegerData(minimum(), maximum(), value());
    199     }
     177    RangedIntegerData rangedInteger() const;
    200178};
    201179
     
    396374    virtual QITableViewRow *childItem(int iIndex) const /* override */;
    397375};
     376
     377
     378/*********************************************************************************************************************************
     379*   Class ChoiceEditor implementation.                                                                                           *
     380*********************************************************************************************************************************/
     381
     382ChoiceEditor::ChoiceEditor(QWidget *pParent /* = 0 */)
     383    : QComboBox(pParent)
     384{
     385}
     386
     387void ChoiceEditor::setChoice(const ChoiceData &choice)
     388{
     389    addItems(choice.values().toList());
     390    setCurrentIndex(choice.selectedIndex());
     391}
     392
     393ChoiceData ChoiceEditor::choice() const
     394{
     395    QVector<QString> choices(count());
     396    for (int i = 0; i < count(); ++i)
     397        choices[i] = itemText(i);
     398    return ChoiceData(choices, currentIndex());
     399}
     400
     401
     402/*********************************************************************************************************************************
     403*   Class RangedIntegerEditor implementation.                                                                                    *
     404*********************************************************************************************************************************/
     405
     406RangedIntegerEditor::RangedIntegerEditor(QWidget *pParent /* = 0 */)
     407    : QSpinBox(pParent)
     408{
     409}
     410
     411void RangedIntegerEditor::setRangedInteger(const RangedIntegerData &rangedInteger)
     412{
     413    setMinimum(rangedInteger.minimum());
     414    setMaximum(rangedInteger.maximum());
     415    setValue(rangedInteger.integer());
     416}
     417
     418RangedIntegerData RangedIntegerEditor::rangedInteger() const
     419{
     420    return RangedIntegerData(minimum(), maximum(), value());
     421}
    398422
    399423
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