VirtualBox

Changeset 64494 in vbox


Ignore:
Timestamp:
Oct 31, 2016 3:25:16 PM (8 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:6899: Accessibility support (step 118): Selector UI: Snapshot pane: Move item casting stuff to corresponding place.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/selector
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UISnapshotPane.cpp

    r64493 r64494  
    6262public:
    6363
     64    /** Casts QTreeWidgetItem* to UISnapshotItem* if possible. */
     65    static UISnapshotItem *toSnapshotItem(QTreeWidgetItem *pItem);
     66    /** Casts const QTreeWidgetItem* to const UISnapshotItem* if possible. */
     67    static const UISnapshotItem *toSnapshotItem(const QTreeWidgetItem *pItem);
     68
    6469    /** Item type for UISnapshotItem. */
    6570    enum { ItemType = QTreeWidgetItem::UserType + 1 };
     
    182187*********************************************************************************************************************************/
    183188
     189/* static */
     190UISnapshotItem *UISnapshotItem::toSnapshotItem(QTreeWidgetItem *pItem)
     191{
     192    /* Make sure alive UISnapshotItem passed: */
     193    if (!pItem || pItem->type() != UISnapshotItem::ItemType)
     194        return 0;
     195
     196    /* Return casted UISnapshotItem then: */
     197    return static_cast<UISnapshotItem*>(pItem);
     198}
     199
     200/* static */
     201const UISnapshotItem *UISnapshotItem::toSnapshotItem(const QTreeWidgetItem *pItem)
     202{
     203    /* Make sure alive UISnapshotItem passed: */
     204    if (!pItem || pItem->type() != UISnapshotItem::ItemType)
     205        return 0;
     206
     207    /* Return casted UISnapshotItem then: */
     208    return static_cast<const UISnapshotItem*>(pItem);
     209}
     210
    184211UISnapshotItem::UISnapshotItem(UISnapshotPane *pSnapshotWidget, QTreeWidget *pTreeWidget, const CSnapshot &comSnapshot)
    185212    : QTreeWidgetItem(pTreeWidget, ItemType)
     
    227254{
    228255    /* Return the parent snapshot item if any: */
    229     return QTreeWidgetItem::parent() ? UISnapshotPane::toSnapshotItem(QTreeWidgetItem::parent()) : 0;
     256    return QTreeWidgetItem::parent() ? toSnapshotItem(QTreeWidgetItem::parent()) : 0;
    230257}
    231258
     
    233260{
    234261    /* Return the child snapshot item with iIndex if any: */
    235     return QTreeWidgetItem::child(iIndex) ? UISnapshotPane::toSnapshotItem(QTreeWidgetItem::child(iIndex)) : 0;
     262    return QTreeWidgetItem::child(iIndex) ? toSnapshotItem(QTreeWidgetItem::child(iIndex)) : 0;
    236263}
    237264
     
    539566{
    540567    /* Return the child snapshot item with iIndex if any: */
    541     return invisibleRootItem()->child(iIndex) ? UISnapshotPane::toSnapshotItem(invisibleRootItem()->child(iIndex)) : 0;
     568    return invisibleRootItem()->child(iIndex) ? UISnapshotItem::toSnapshotItem(invisibleRootItem()->child(iIndex)) : 0;
    542569}
    543570
     
    546573*   Class UISnapshotPane implementation.                                                                                         *
    547574*********************************************************************************************************************************/
    548 
    549 /* static  */
    550 UISnapshotItem *UISnapshotPane::toSnapshotItem(QTreeWidgetItem *pItem)
    551 {
    552     /* Make sure alive UISnapshotItem passed: */
    553     if (!pItem || pItem->type() != UISnapshotItem::ItemType)
    554         return 0;
    555 
    556     /* Return casted UISnapshotItem then: */
    557     return static_cast<UISnapshotItem*>(pItem);
    558 }
    559 
    560 /* static */
    561 const UISnapshotItem *UISnapshotPane::toSnapshotItem(const QTreeWidgetItem *pItem)
    562 {
    563     /* Make sure alive UISnapshotItem passed: */
    564     if (!pItem || pItem->type() != UISnapshotItem::ItemType)
    565         return 0;
    566 
    567     /* Return casted UISnapshotItem then: */
    568     return static_cast<const UISnapshotItem*>(pItem);
    569 }
    570575
    571576UISnapshotPane::UISnapshotPane(QWidget *pParent)
     
    723728{
    724729    /* Acquire corresponding snapshot item: */
    725     const UISnapshotItem *pSnapshotItem = toSnapshotItem(pItem);
     730    const UISnapshotItem *pSnapshotItem = UISnapshotItem::toSnapshotItem(pItem);
    726731
    727732    /* Make the selected item visible: */
     
    791796
    792797    /* Acquire corresponding snapshot item: */
    793     const UISnapshotItem *pSnapshotItem = toSnapshotItem(pItem);
     798    const UISnapshotItem *pSnapshotItem = UISnapshotItem::toSnapshotItem(pItem);
    794799    AssertReturnVoid(pSnapshotItem);
    795800
     
    824829
    825830    /* Acquire corresponding snapshot item: */
    826     const UISnapshotItem *pSnapshotItem = toSnapshotItem(pItem);
     831    const UISnapshotItem *pSnapshotItem = UISnapshotItem::toSnapshotItem(pItem);
    827832    AssertReturnVoid(pSnapshotItem);
    828833
     
    839844{
    840845    /* Acquire corresponding snapshot item: */
    841     const UISnapshotItem *pSnapshotItem = toSnapshotItem(pItem);
     846    const UISnapshotItem *pSnapshotItem = UISnapshotItem::toSnapshotItem(pItem);
    842847    AssertReturnVoid(pSnapshotItem);
    843848
     
    10121017    {
    10131018        /* Acquire currently chosen snapshot item: */
    1014         const UISnapshotItem *pSnapshotItem = toSnapshotItem(m_pSnapshotTree->currentItem());
     1019        const UISnapshotItem *pSnapshotItem = UISnapshotItem::toSnapshotItem(m_pSnapshotTree->currentItem());
    10151020        AssertPtr(pSnapshotItem);
    10161021        if (!pSnapshotItem)
     
    10871092    {
    10881093        /* Acquire currently chosen snapshot item: */
    1089         const UISnapshotItem *pSnapshotItem = toSnapshotItem(m_pSnapshotTree->currentItem());
     1094        const UISnapshotItem *pSnapshotItem = UISnapshotItem::toSnapshotItem(m_pSnapshotTree->currentItem());
    10901095        AssertPtr(pSnapshotItem);
    10911096        if (!pSnapshotItem)
     
    11571162{
    11581163    /* Acquire currently chosen snapshot item: */
    1159     const UISnapshotItem *pSnapshotItem = toSnapshotItem(m_pSnapshotTree->currentItem());
     1164    const UISnapshotItem *pSnapshotItem = UISnapshotItem::toSnapshotItem(m_pSnapshotTree->currentItem());
    11601165    AssertReturnVoid(pSnapshotItem);
    11611166
     
    11761181{
    11771182    /* Acquire currently chosen snapshot item: */
    1178     const UISnapshotItem *pSnapshotItem = toSnapshotItem(m_pSnapshotTree->currentItem());
     1183    const UISnapshotItem *pSnapshotItem = UISnapshotItem::toSnapshotItem(m_pSnapshotTree->currentItem());
    11791184    AssertReturnVoid(pSnapshotItem);
    11801185
     
    12141219    /* Remember the selected item and it's first child: */
    12151220    QString strSelectedItem, strFirstChildOfSelectedItem;
    1216     const UISnapshotItem *pSnapshotItem = toSnapshotItem(m_pSnapshotTree->currentItem());
     1221    const UISnapshotItem *pSnapshotItem = UISnapshotItem::toSnapshotItem(m_pSnapshotTree->currentItem());
    12171222    if (pSnapshotItem)
    12181223    {
    12191224        strSelectedItem = pSnapshotItem->snapshotID();
    12201225        if (pSnapshotItem->child(0))
    1221             strFirstChildOfSelectedItem = toSnapshotItem(pSnapshotItem->child(0))->snapshotID();
     1226            strFirstChildOfSelectedItem = UISnapshotItem::toSnapshotItem(pSnapshotItem->child(0))->snapshotID();
    12221227    }
    12231228
     
    13081313    while (*it)
    13091314    {
    1310         UISnapshotItem *pSnapshotItem = toSnapshotItem(*it);
     1315        UISnapshotItem *pSnapshotItem = UISnapshotItem::toSnapshotItem(*it);
    13111316        if (pSnapshotItem->snapshotID() == strSnapshotID)
    13121317            return pSnapshotItem;
     
    13301335{
    13311336    /* Acquire corresponding snapshot item: */
    1332     UISnapshotItem *pSnapshotItem = toSnapshotItem(pItem);
     1337    UISnapshotItem *pSnapshotItem = UISnapshotItem::toSnapshotItem(pItem);
    13331338
    13341339    /* Fetch the snapshot age of the root if it's valid: */
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UISnapshotPane.h

    r63893 r64494  
    5454
    5555public:
    56 
    57     /** Casts QTreeWidgetItem to UISnapshotItem if possible. */
    58     static UISnapshotItem *toSnapshotItem(QTreeWidgetItem *pItem);
    59     /** Casts const QTreeWidgetItem to const UISnapshotItem if possible. */
    60     static const UISnapshotItem *toSnapshotItem(const QTreeWidgetItem *pItem);
    6156
    6257    /** Constructs snapshot pane passing @a pParent to the base-class. */
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