Changeset 105058 in vbox
- Timestamp:
- Jun 27, 2024 12:44:55 PM (9 months ago)
- svn:sync-xref-src-repo-rev:
- 163677
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIShortcutConfigurationEditor.cpp
r105056 r105058 235 235 signals: 236 236 237 /** Notifies about shortcuts loaded. */238 void sigShortcutsLoaded();239 237 /** Notifies about data changed. */ 240 238 void sigDataChanged(); … … 323 321 virtual void setModel(QAbstractItemModel *pModel) RT_OVERRIDE; 324 322 325 private slots: 326 327 /** Handles shortcuts loaded signal. */ 328 void sltHandleShortcutsLoaded(); 323 protected slots: 324 325 /** Handles rows being inserted. 326 * @param parent Brings the parent under which new rows being inserted. 327 * @param iStart Brings the starting position (inclusive). 328 * @param iStart Brings the end position (inclusive). */ 329 virtual void rowsInserted(const QModelIndex &parent, int iStart, int iEnd) RT_OVERRIDE; 329 330 330 331 private: … … 374 375 m_shortcuts << new UIShortcutTableViewRow(view(), item); 375 376 } 377 376 378 /* Apply filter: */ 377 379 applyFilter(); 378 /* Notify table: */379 emit sigShortcutsLoaded();380 380 } 381 381 … … 637 637 { 638 638 /* Sort whole the list: */ 639 std::stable_sort(m_ shortcuts.begin(), m_shortcuts.end(), UIShortcutItemSortingFunctor(iColumn, order));639 std::stable_sort(m_filteredShortcuts.begin(), m_filteredShortcuts.end(), UIShortcutItemSortingFunctor(iColumn, order)); 640 640 /* Make sure host-combo item is always the first one: */ 641 641 UIShortcutConfigurationItem fakeHostComboItem(UIHostCombo::hostComboCacheKey(), QString(), QString(), QString(), QString()); 642 642 UIShortcutTableViewRow fakeHostComboTableViewRow(0, fakeHostComboItem); 643 const int iIndexOfHostComboItem = UIShortcutSearchFunctor<UIShortcutTableViewRow>()(m_ shortcuts, fakeHostComboTableViewRow);643 const int iIndexOfHostComboItem = UIShortcutSearchFunctor<UIShortcutTableViewRow>()(m_filteredShortcuts, fakeHostComboTableViewRow); 644 644 if (iIndexOfHostComboItem != -1) 645 645 { 646 UIShortcutTableViewRow *pHostComboItem = m_shortcuts.takeAt(iIndexOfHostComboItem); 647 m_shortcuts.prepend(pHostComboItem); 648 } 649 /* Apply the filter: */ 650 applyFilter(); 646 UIShortcutTableViewRow *pHostComboItem = m_filteredShortcuts.takeAt(iIndexOfHostComboItem); 647 m_filteredShortcuts.prepend(pHostComboItem); 648 } 651 649 /* Notify the model: */ 652 650 emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1)); … … 741 739 horizontalHeader()->setSectionResizeMode(TableColumnIndex_Description, QHeaderView::Interactive); 742 740 horizontalHeader()->setSectionResizeMode(TableColumnIndex_Sequence, QHeaderView::Stretch); 743 744 /* Connect model: */ 745 UIShortcutConfigurationModel *pHotKeyTableModel = qobject_cast<UIShortcutConfigurationModel*>(model()); 746 if (pHotKeyTableModel) 747 connect(pHotKeyTableModel, &UIShortcutConfigurationModel::sigShortcutsLoaded, 748 this, &UIShortcutConfigurationView::sltHandleShortcutsLoaded); 749 } 750 } 751 752 void UIShortcutConfigurationView::sltHandleShortcutsLoaded() 753 { 754 /* Resize columns to feat contents: */ 741 } 742 } 743 744 void UIShortcutConfigurationView::rowsInserted(const QModelIndex &parent, int iStart, int iEnd) 745 { 746 /* Call to base-class: */ 747 QITableView::rowsInserted(parent, iStart, iEnd); 748 749 /* Resize columns to fit contents: */ 755 750 resizeColumnsToContents(); 756 751 757 /* Configuresorting: */752 /* Reapply sorting: */ 758 753 sortByColumn(TableColumnIndex_Description, Qt::AscendingOrder); 754 } 755 756 void UIShortcutConfigurationView::prepare() 757 { 758 /* Configure self: */ 759 759 setSortingEnabled(true); 760 }761 762 void UIShortcutConfigurationView::prepare()763 {764 /* Configure self: */765 760 setTabKeyNavigation(false); 766 761 setContextMenuPolicy(Qt::CustomContextMenu); … … 1004 999 } 1005 1000 1001 1006 1002 # include "UIShortcutConfigurationEditor.moc"
Note:
See TracChangeset
for help on using the changeset viewer.