Changeset 101693 in vbox for trunk/src/VBox
- Timestamp:
- Oct 31, 2023 4:46:47 PM (13 months ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/settings
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/UIAdvancedSettingsDialog.cpp
r101662 r101693 928 928 /* Remember page-frame for referencing: */ 929 929 m_frames[cId] = pFrame; 930 931 /* Notify about frame visibility changes: */ 932 connect(pFrame, &UISettingsPageFrame::sigVisibilityChange, 933 this, &UIAdvancedSettingsDialog::sltHandleFrameVisibilityChange); 930 934 } 931 935 } … … 1091 1095 foreach (UISettingsPageFrame *pFrame, m_frames.values()) 1092 1096 pFrame->filterOut(m_pCheckBoxMode->isChecked(), m_pEditorFilter->text()); 1097 } 1098 1099 void UIAdvancedSettingsDialog::sltHandleFrameVisibilityChange(bool fVisible) 1100 { 1101 /* Acquire frame: */ 1102 UISettingsPageFrame *pFrame = qobject_cast<UISettingsPageFrame*>(sender()); 1103 AssertPtrReturnVoid(pFrame); 1104 1105 /* Update selector item visibility: */ 1106 const int iId = m_frames.key(pFrame); 1107 m_pSelector->setItemVisible(iId, fVisible); 1093 1108 } 1094 1109 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UIAdvancedSettingsDialog.h
r101662 r101693 200 200 /** Handles changes done to mode checkbox or filter editor. */ 201 201 void sltHandleModeOrFilterChanged(); 202 /** Handles frame visivility changes. */ 203 void sltHandleFrameVisibilityChange(bool fVisible); 202 204 203 205 private: -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsSelector.cpp
r101692 r101693 144 144 virtual void setText(const QString &strText) { m_strText = strText; } 145 145 146 /** Returns whether item is hidden. */ 147 virtual bool isHidden() const { return m_fHidden; } 148 /** Defines item is @a fHidden. */ 149 virtual void setHidden(bool fHidden) { m_fHidden = fHidden; } 150 146 151 /** Returns the number of children. */ 147 152 virtual int childCount() const RT_OVERRIDE { return m_children.size(); } … … 171 176 /** Holds the item text. */ 172 177 QString m_strText; 178 /** Holds whether item is hidden. */ 179 bool m_fHidden; 173 180 174 181 /** Holds the list of children. */ … … 213 220 R_ItemName, 214 221 R_ItemNamePoint, 222 R_ItemHidden, 215 223 }; 216 224 … … 392 400 UISelectorTreeViewItem::UISelectorTreeViewItem(QITreeView *pParent) 393 401 : QITreeViewItem(pParent) 402 , m_fHidden(false) 394 403 { 395 404 } … … 403 412 , m_icon(icon) 404 413 , m_strLink(strLink) 414 , m_fHidden(false) 405 415 { 406 416 if (pParentItem) … … 657 667 sizeHint.height() / 2 + fm.ascent() / 2 - 1 /* base line */); 658 668 } 669 case R_ItemHidden: 670 { 671 if (UISelectorTreeViewItem *pItem = indexToItem(specifiedIndex)) 672 return pItem->isHidden() ? "hide" : "show"; 673 return QString(); 674 } 659 675 660 676 default: … … 678 694 { 679 695 pItem->setText(aValue.toString()); 696 emit dataChanged(specifiedIndex, specifiedIndex); 697 return true; 698 } 699 return false; 700 } 701 case R_ItemHidden: 702 { 703 if (UISelectorTreeViewItem *pItem = indexToItem(specifiedIndex)) 704 { 705 pItem->setHidden(aValue.toBool()); 680 706 emit dataChanged(specifiedIndex, specifiedIndex); 681 707 return true; … … 941 967 } 942 968 969 void UISettingsSelectorTreeView::setItemVisible(int iID, bool fVisible) 970 { 971 /* Look for the tree-view item to assign the text: */ 972 QModelIndex specifiedIndex = m_pModel->findItem(iID); 973 if (specifiedIndex.isValid()) 974 m_pModel->setData(specifiedIndex, !fVisible, UISelectorModel::R_ItemHidden); 975 } 976 943 977 void UISettingsSelectorTreeView::setItemText(int iID, const QString &strText) 944 978 { … … 1015 1049 /* Configure proxy-model: */ 1016 1050 m_pModelProxy->setSortRole(UISelectorModel::R_ItemId); 1051 m_pModelProxy->setFilterRole(UISelectorModel::R_ItemHidden); 1052 m_pModelProxy->setFilterFixedString("show"); 1017 1053 m_pModelProxy->setSourceModel(m_pModel); 1018 1054 m_pTreeView->setModel(m_pModelProxy); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsSelector.h
r101692 r101693 86 86 int iID, const QString &strLink, UISettingsPage *pPage = 0, int iParentID = -1) = 0; 87 87 88 /** Defines whether section with @a iID is @a fVisible. */ 89 virtual void setItemVisible(int iID, bool fVisible) { Q_UNUSED(iID); Q_UNUSED(fVisible); } 90 88 91 /** Defines the @a strText for section with @a iID. */ 89 92 virtual void setItemText(int iID, const QString &strText); … … 158 161 int iID, const QString &strLink, UISettingsPage *pPage = 0, int iParentID = -1) RT_OVERRIDE; 159 162 163 /** Defines whether section with @a iID is @a fVisible. */ 164 virtual void setItemVisible(int iID, bool fVisible) RT_OVERRIDE; 165 160 166 /** Defines the @a strText for section with @a iID. */ 161 167 virtual void setItemText(int iID, const QString &strText) RT_OVERRIDE; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIEditor.cpp
r101608 r101693 105 105 /* Otherwise update widget visibility usual way: */ 106 106 else 107 { 108 const bool fVisibilityChanged = isVisible() != fVisible; 107 109 setVisible(fVisible); 110 if (fVisibilityChanged) 111 emit sigVisibilityChange(fVisible); 112 } 108 113 109 114 /* Finally make sure layouts are freshly -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIEditor.h
r101451 r101693 43 43 Q_OBJECT; 44 44 45 signals: 46 47 /** Notifies listeners about visibility changes. */ 48 void sigVisibilityChange(bool fVisible); 49 45 50 public: 46 51
Note:
See TracChangeset
for help on using the changeset viewer.