- Timestamp:
- Oct 24, 2016 2:12:14 PM (8 years ago)
- 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 35 35 36 36 37 class SFTreeViewItem : public Q TreeWidgetItem37 class SFTreeViewItem : public QITreeWidgetItem 38 38 { 39 39 public: 40 41 enum { SFTreeViewItemType = QTreeWidgetItem::UserType + 1 };42 40 43 41 enum FormatType … … 51 49 52 50 /* Root Item */ 53 SFTreeViewItem (Q TreeWidget *aParent, const QStringList &aFields, FormatType aFormat)54 : Q TreeWidgetItem (aParent, aFields, SFTreeViewItemType), mFormat (aFormat)51 SFTreeViewItem (QITreeWidget *aParent, const QStringList &aFields, FormatType aFormat) 52 : QITreeWidgetItem (aParent, aFields), mFormat (aFormat) 55 53 { 56 54 setFirstColumnSpanned (true); … … 60 58 /* Child Item */ 61 59 SFTreeViewItem (SFTreeViewItem *aParent, const QStringList &aFields, FormatType aFormat) 62 : Q TreeWidgetItem (aParent, aFields, SFTreeViewItemType), mFormat (aFormat)60 : QITreeWidgetItem (aParent, aFields), mFormat (aFormat) 63 61 { 64 62 updateText (aFields); … … 68 66 { 69 67 /* 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(); 72 70 } 73 71 … … 75 73 { 76 74 QTreeWidgetItem *item = QTreeWidgetItem::child (aIndex); 77 return item && item->type() == SFTreeViewItemType? static_cast <SFTreeViewItem*> (item) : 0;75 return item ? static_cast <SFTreeViewItem*> (item) : 0; 78 76 } 79 77 … … 106 104 int oldSize = fm.width (oneString); 107 105 int indentSize = fm.width (" ... "); 108 int itemIndent = parent () ? treeWidget()->indentation() * 2 : treeWidget()->indentation();106 int itemIndent = parentItem() ? treeWidget()->indentation() * 2 : treeWidget()->indentation(); 109 107 if (aColumn == 0) 110 108 indentSize += itemIndent; … … 463 461 /* Check selected item */ 464 462 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; 467 464 Assert (item); 468 Assert (item->parent ());465 Assert (item->parentItem()); 469 466 470 467 /* Invoke Edit-Box Dialog */ … … 472 469 dlg.setPath (item->getText (1)); 473 470 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); 475 472 dlg.setAutoMount (item->getText (2) == mTrYes); 476 473 dlg.setWriteable (item->getText (3) == mTrFull); … … 491 488 item->updateText (fields); 492 489 mTwFolders->sortItems (0, Qt::AscendingOrder); 493 if (item->parent () != pRoot)490 if (item->parentItem() != pRoot) 494 491 { 495 492 /* Move the selected item into new location */ 496 item->parent ()->takeChild (item->parent()->indexOfChild (item));493 item->parentItem()->takeChild (item->parentItem()->indexOfChild (item)); 497 494 pRoot->insertChild (pRoot->childCount(), item); 498 495 mTwFolders->scrollToItem (item); … … 589 586 for (int j = 0; j < subRoot->childCount(); ++ j) 590 587 { 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; 594 589 if (item) 595 590 item->adjustText(); … … 638 633 while (*it) 639 634 { 640 if ((*it)->parent() && (aIncludeSelected || !(*it)->isSelected()) && 641 (*it)->type() == SFTreeViewItem::SFTreeViewItemType) 635 if ((*it)->parent() && (aIncludeSelected || !(*it)->isSelected())) 642 636 { 643 637 SFTreeViewItem *item = static_cast <SFTreeViewItem*> (*it); 644 UISharedFolderType type = (UISharedFolderType) item->parent ()->text (1).toInt();638 UISharedFolderType type = (UISharedFolderType) item->parentItem()->text (1).toInt(); 645 639 list << qMakePair (item->getText (0), type); 646 640 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.ui
r62495 r64388 56 56 </property> 57 57 <item> 58 <widget class="Q TreeWidget" name="mTwFolders">58 <widget class="QITreeWidget" name="mTwFolders"> 59 59 <property name="minimumSize"> 60 60 <size> … … 107 107 <customwidgets> 108 108 <customwidget> 109 <class>QITreeWidget</class> 110 <extends>QTreeWidget</extends> 111 <header>QITreeWidget.h</header> 112 </customwidget> 113 <customwidget> 109 114 <class>QILabelSeparator</class> 110 115 <extends>QLabel</extends>
Note:
See TracChangeset
for help on using the changeset viewer.