VirtualBox

Changeset 64265 in vbox


Ignore:
Timestamp:
Oct 13, 2016 4:49:48 PM (8 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:6899: Accessibility support (step 93): Preferences: Input page: Implement/integrate QITableViewCell part as well, according to QITableView accessibility requirements.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.cpp

    r64264 r64265  
    5050    UIHotKeyColumnIndex_Sequence,
    5151    UIHotKeyColumnIndex_Max
     52};
     53
     54
     55/** Global settings / Input page / Shortcut table cell. */
     56class UIShortcutCacheCell : public QITableViewCell
     57{
     58    Q_OBJECT;
     59
     60public:
     61
     62    /** Constructs table cell.
     63      * @param  pParent  Brings the row this cell belongs too.
     64      * @param  strText  Brings the text describing this cell. */
     65    UIShortcutCacheCell(QITableViewRow *pParent, const QString &strText)
     66        : QITableViewCell(pParent)
     67        , m_strText(strText)
     68    {}
     69
     70    /** Returns the cell text. */
     71    virtual QString text() const /* override */ { return m_strText; }
     72
     73private:
     74
     75    /** Holds the cell text. */
     76    QString m_strText;
    5277};
    5378
     
    76101        , m_strCurrentSequence(strCurrentSequence)
    77102        , m_strDefaultSequence(strDefaultSequence)
    78     {}
     103    {
     104        /* Create cells: */
     105        createCells();
     106    }
    79107
    80108    /** Constructs table row on the basis of @a other one. */
     
    85113        , m_strCurrentSequence(other.currentSequence())
    86114        , m_strDefaultSequence(other.defaultSequence())
    87     {}
     115    {
     116        /* Create cells: */
     117        createCells();
     118    }
     119
     120    /** Destructs table row. */
     121    ~UIShortcutCacheRow()
     122    {
     123        /* Destroy cells: */
     124        destroyCells();
     125    }
    88126
    89127    /** Copies a table row from @a other one. */
     
    96134        m_strCurrentSequence = other.currentSequence();
    97135        m_strDefaultSequence = other.defaultSequence();
     136
     137        /* Recreate cells: */
     138        destroyCells();
     139        createCells();
    98140
    99141        /* Return this: */
     
    125167    virtual int childCount() const /* override */
    126168    {
    127         return 0;
     169        return UIHotKeyColumnIndex_Max;
    128170    }
    129171
     
    131173    virtual QITableViewCell *childItem(int iIndex) const /* override */
    132174    {
    133         Q_UNUSED(iIndex);
     175        switch (iIndex)
     176        {
     177            case UIHotKeyColumnIndex_Description: return m_cells.first;
     178            case UIHotKeyColumnIndex_Sequence: return m_cells.second;
     179            default: break;
     180        }
    134181        return 0;
    135182    }
    136183
    137184private:
     185
     186    /** Creates cells. */
     187    void createCells()
     188    {
     189        /* Create cells on the basis of description and current sequence: */
     190        m_cells = qMakePair(new UIShortcutCacheCell(this, m_strDescription),
     191                            new UIShortcutCacheCell(this, m_strCurrentSequence));
     192    }
     193
     194    /** Destroys cells. */
     195    void destroyCells()
     196    {
     197        /* Destroy cells: */
     198        delete m_cells.first;
     199        delete m_cells.second;
     200        m_cells.first = 0;
     201        m_cells.second = 0;
     202    }
    138203
    139204    /** Holds the key. */
     
    145210    /** Holds the default sequence. */
    146211    QString m_strDefaultSequence;
     212
     213    /** Holds the cell instances. */
     214    QPair<UIShortcutCacheCell*, UIShortcutCacheCell*> m_cells;
    147215};
    148216
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