VirtualBox

Changeset 64388 in vbox for trunk


Ignore:
Timestamp:
Oct 24, 2016 2:12:14 PM (8 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:6899: Accessibility support (step 100): Settings: Shared Fodlers page: Move tree-widget stuff onto QITreeWidget rails.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.cpp

    r62493 r64388  
    3535
    3636
    37 class SFTreeViewItem : public QTreeWidgetItem
     37class SFTreeViewItem : public QITreeWidgetItem
    3838{
    3939public:
    40 
    41     enum { SFTreeViewItemType = QTreeWidgetItem::UserType + 1 };
    4240
    4341    enum FormatType
     
    5149
    5250    /* Root Item */
    53     SFTreeViewItem (QTreeWidget *aParent, const QStringList &aFields, FormatType aFormat)
    54         : QTreeWidgetItem (aParent, aFields, SFTreeViewItemType), mFormat (aFormat)
     51    SFTreeViewItem (QITreeWidget *aParent, const QStringList &aFields, FormatType aFormat)
     52        : QITreeWidgetItem (aParent, aFields), mFormat (aFormat)
    5553    {
    5654        setFirstColumnSpanned (true);
     
    6058    /* Child Item */
    6159    SFTreeViewItem (SFTreeViewItem *aParent, const QStringList &aFields, FormatType aFormat)
    62         : QTreeWidgetItem (aParent, aFields, SFTreeViewItemType), mFormat (aFormat)
     60        : QITreeWidgetItem (aParent, aFields), mFormat (aFormat)
    6361    {
    6462        updateText (aFields);
     
    6866    {
    6967        /* Root items should always been sorted by id-field. */
    70         return parent() ? text (0).toLower() < aOther.text (0).toLower() :
    71                           text (1).toLower() < aOther.text (1).toLower();
     68        return parentItem() ? text (0).toLower() < aOther.text (0).toLower() :
     69                              text (1).toLower() < aOther.text (1).toLower();
    7270    }
    7371
     
    7573    {
    7674        QTreeWidgetItem *item = QTreeWidgetItem::child (aIndex);
    77         return item && item->type() == SFTreeViewItemType ? static_cast <SFTreeViewItem*> (item) : 0;
     75        return item ? static_cast <SFTreeViewItem*> (item) : 0;
    7876    }
    7977
     
    106104        int oldSize = fm.width (oneString);
    107105        int indentSize = fm.width (" ... ");
    108         int itemIndent = parent() ? treeWidget()->indentation() * 2 : treeWidget()->indentation();
     106        int itemIndent = parentItem() ? treeWidget()->indentation() * 2 : treeWidget()->indentation();
    109107        if (aColumn == 0)
    110108            indentSize += itemIndent;
     
    463461    /* Check selected item */
    464462    QTreeWidgetItem *selectedItem = mTwFolders->selectedItems().size() == 1 ? mTwFolders->selectedItems() [0] : 0;
    465     SFTreeViewItem *item = selectedItem && selectedItem->type() == SFTreeViewItem::SFTreeViewItemType ?
    466                            static_cast <SFTreeViewItem*> (selectedItem) : 0;
     463    SFTreeViewItem *item = selectedItem ? static_cast <SFTreeViewItem*> (selectedItem) : 0;
    467464    Assert (item);
    468     Assert (item->parent());
     465    Assert (item->parentItem());
    469466
    470467    /* Invoke Edit-Box Dialog */
     
    472469    dlg.setPath (item->getText (1));
    473470    dlg.setName (item->getText (0));
    474     dlg.setPermanent ((UISharedFolderType)item->parent()->text (1).toInt() != ConsoleType);
     471    dlg.setPermanent ((UISharedFolderType)item->parentItem()->text (1).toInt() != ConsoleType);
    475472    dlg.setAutoMount (item->getText (2) == mTrYes);
    476473    dlg.setWriteable (item->getText (3) == mTrFull);
     
    491488        item->updateText (fields);
    492489        mTwFolders->sortItems (0, Qt::AscendingOrder);
    493         if (item->parent() != pRoot)
     490        if (item->parentItem() != pRoot)
    494491        {
    495492            /* Move the selected item into new location */
    496             item->parent()->takeChild (item->parent()->indexOfChild (item));
     493            item->parentItem()->takeChild (item->parentItem()->indexOfChild (item));
    497494            pRoot->insertChild (pRoot->childCount(), item);
    498495            mTwFolders->scrollToItem (item);
     
    589586        for (int j = 0; j < subRoot->childCount(); ++ j)
    590587        {
    591             SFTreeViewItem *item = subRoot->child (j) &&
    592                                    subRoot->child (j)->type() == SFTreeViewItem::SFTreeViewItemType ?
    593                                    static_cast <SFTreeViewItem*> (subRoot->child (j)) : 0;
     588            SFTreeViewItem *item = subRoot->child (j) ? static_cast <SFTreeViewItem*> (subRoot->child (j)) : 0;
    594589            if (item)
    595590                item->adjustText();
     
    638633    while (*it)
    639634    {
    640         if ((*it)->parent() && (aIncludeSelected || !(*it)->isSelected()) &&
    641             (*it)->type() == SFTreeViewItem::SFTreeViewItemType)
     635        if ((*it)->parent() && (aIncludeSelected || !(*it)->isSelected()))
    642636        {
    643637            SFTreeViewItem *item = static_cast <SFTreeViewItem*> (*it);
    644             UISharedFolderType type = (UISharedFolderType) item->parent()->text (1).toInt();
     638            UISharedFolderType type = (UISharedFolderType) item->parentItem()->text (1).toInt();
    645639            list << qMakePair (item->getText (0), type);
    646640        }
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.ui

    r62495 r64388  
    5656      </property>
    5757      <item>
    58        <widget class="QTreeWidget" name="mTwFolders">
     58       <widget class="QITreeWidget" name="mTwFolders">
    5959        <property name="minimumSize">
    6060         <size>
     
    107107 <customwidgets>
    108108  <customwidget>
     109   <class>QITreeWidget</class>
     110   <extends>QTreeWidget</extends>
     111   <header>QITreeWidget.h</header>
     112  </customwidget>
     113  <customwidget>
    109114   <class>QILabelSeparator</class>
    110115   <extends>QLabel</extends>
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