- Timestamp:
- Oct 7, 2016 1:03:10 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.cpp
r64170 r64179 150 150 /* Handler: Readiness stuff: */ 151 151 void sltHandleShortcutsLoaded(); 152 153 private: 154 155 /** Prepares all. */ 156 void prepare(); 152 157 }; 153 158 … … 478 483 /* Set object name: */ 479 484 setObjectName(strObjectName); 480 481 /* Connect model: */ 485 /* Set model: */ 482 486 setModel(pModel); 483 connect(pModel, SIGNAL(sigShortcutsLoaded()), this, SLOT(sltHandleShortcutsLoaded())); 484 487 488 /* Prepare all: */ 489 prepare(); 490 } 491 492 void UIHotKeyTable::sltHandleShortcutsLoaded() 493 { 494 /* Resize columns to feat contents: */ 495 resizeColumnsToContents(); 496 497 /* Configure sorting: */ 498 sortByColumn(Section_Name, Qt::AscendingOrder); 499 setSortingEnabled(true); 500 } 501 502 void UIHotKeyTable::prepare() 503 { 485 504 /* Configure self: */ 486 505 setTabKeyNavigation(false); … … 502 521 #endif /* QT_VERSION < 0x050000 */ 503 522 523 /* Connect model: */ 524 connect(model(), SIGNAL(sigShortcutsLoaded()), this, SLOT(sltHandleShortcutsLoaded())); 525 504 526 /* Reinstall delegate: */ 505 527 delete itemDelegate(); 506 528 QIStyledItemDelegate *pStyledItemDelegate = new QIStyledItemDelegate(this); 507 529 setItemDelegate(pStyledItemDelegate); 508 509 /* Create new item editor factory: */ 510 QItemEditorFactory *pNewItemEditorFactory = new QItemEditorFactory; 511 512 /* Register UIHotKeyEditor as the UIHotKey editor: */ 513 int iHotKeyTypeId = qRegisterMetaType<UIHotKey>(); 514 QStandardItemEditorCreator<UIHotKeyEditor> *pHotKeyItemEditorCreator = new QStandardItemEditorCreator<UIHotKeyEditor>(); 515 pNewItemEditorFactory->registerEditor((QVariant::Type)iHotKeyTypeId, pHotKeyItemEditorCreator); 516 517 /* Register UIHostComboEditor as the UIHostComboWrapper: */ 518 int iHostComboTypeId = qRegisterMetaType<UIHostComboWrapper>(); 519 QStandardItemEditorCreator<UIHostComboEditor> *pHostComboItemEditorCreator = new QStandardItemEditorCreator<UIHostComboEditor>(); 520 pNewItemEditorFactory->registerEditor((QVariant::Type)iHostComboTypeId, pHostComboItemEditorCreator); 521 522 /* Set configured item editor factory for table delegate: */ 523 pStyledItemDelegate->setItemEditorFactory(pNewItemEditorFactory); 524 525 /* Configure item delegate: */ 526 pStyledItemDelegate->setWatchForEditorDataCommits(true); 527 } 528 529 void UIHotKeyTable::sltHandleShortcutsLoaded() 530 { 531 /* Resize columns to feat contents: */ 532 resizeColumnsToContents(); 533 534 /* Configure sorting: */ 535 sortByColumn(Section_Name, Qt::AscendingOrder); 536 setSortingEnabled(true); 530 AssertPtrReturnVoid(pStyledItemDelegate); 531 { 532 /* Configure item delegate: */ 533 pStyledItemDelegate->setWatchForEditorDataCommits(true); 534 535 /* Create new item editor factory: */ 536 QItemEditorFactory *pNewItemEditorFactory = new QItemEditorFactory; 537 AssertPtrReturnVoid(pNewItemEditorFactory); 538 { 539 /* Register UIHotKeyEditor as the UIHotKey editor: */ 540 int iHotKeyTypeId = qRegisterMetaType<UIHotKey>(); 541 QStandardItemEditorCreator<UIHotKeyEditor> *pHotKeyItemEditorCreator = new QStandardItemEditorCreator<UIHotKeyEditor>(); 542 pNewItemEditorFactory->registerEditor((QVariant::Type)iHotKeyTypeId, pHotKeyItemEditorCreator); 543 544 /* Register UIHostComboEditor as the UIHostComboWrapper editor: */ 545 int iHostComboTypeId = qRegisterMetaType<UIHostComboWrapper>(); 546 QStandardItemEditorCreator<UIHostComboEditor> *pHostComboItemEditorCreator = new QStandardItemEditorCreator<UIHostComboEditor>(); 547 pNewItemEditorFactory->registerEditor((QVariant::Type)iHostComboTypeId, pHostComboItemEditorCreator); 548 549 /* Assign configured item editor factory to item delegate: */ 550 pStyledItemDelegate->setItemEditorFactory(pNewItemEditorFactory); 551 } 552 } 537 553 } 538 554
Note:
See TracChangeset
for help on using the changeset viewer.