Changeset 105056 in vbox
- Timestamp:
- Jun 27, 2024 11:06:49 AM (9 months ago)
- svn:sync-xref-src-repo-rev:
- 163675
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/settings/editors
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIShortcutConfigurationEditor.cpp
r105034 r105056 5 5 6 6 /* 7 * Copyright (C) 2006-202 3Oracle and/or its affiliates.7 * Copyright (C) 2006-2024 Oracle and/or its affiliates. 8 8 * 9 9 * This file is part of VirtualBox base platform packages, as … … 315 315 316 316 /** Constructs table passing @a pParent to the base-class. 317 * @param pModel Brings the model this table is bound to.318 317 * @param strObjectName Brings the object name this table has, required for fast referencing. */ 319 UIShortcutConfigurationView(QWidget *pParent, UIShortcutConfigurationModel *pModel,const QString &strObjectName);318 UIShortcutConfigurationView(QWidget *pParent, const QString &strObjectName); 320 319 /** Destructs table. */ 321 320 virtual ~UIShortcutConfigurationView() RT_OVERRIDE; 321 322 /** Sets the @a pModel for the view to present. */ 323 virtual void setModel(QAbstractItemModel *pModel) RT_OVERRIDE; 322 324 323 325 private slots: … … 332 334 /** Cleanups all. */ 333 335 void cleanup(); 336 337 /** Holds whether the view is polished. */ 338 bool m_fPolished; 334 339 335 340 /** Holds the item editor factory instance. */ … … 703 708 704 709 UIShortcutConfigurationView::UIShortcutConfigurationView(QWidget *pParent, 705 UIShortcutConfigurationModel *pModel,706 710 const QString &strObjectName) 707 711 : QITableView(pParent) 712 , m_fPolished(false) 708 713 , m_pItemEditorFactory(0) 709 714 { 710 715 /* Set object name: */ 711 716 setObjectName(strObjectName); 712 /* Set model: */713 setModel(pModel);714 717 715 718 /* Prepare all: */ … … 721 724 /* Cleanup all: */ 722 725 cleanup(); 726 } 727 728 void UIShortcutConfigurationView::setModel(QAbstractItemModel *pModel) 729 { 730 /* Call to base-class: */ 731 QITableView::setModel(pModel); 732 733 /* Some stuff to be polished after a model is assigned: */ 734 if (model() && !m_fPolished) 735 { 736 m_fPolished = true; 737 738 // WORKAROUND: 739 // Due to internal Qt bug QHeaderView::::setSectionResizeMode is only possible 740 // to be used after model is already assigned. Getting Qt crash otherwise. 741 horizontalHeader()->setSectionResizeMode(TableColumnIndex_Description, QHeaderView::Interactive); 742 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 } 723 750 } 724 751 … … 746 773 verticalHeader()->setDefaultSectionSize((int)(verticalHeader()->minimumSectionSize() * 1.33)); 747 774 horizontalHeader()->setStretchLastSection(false); 748 horizontalHeader()->setSectionResizeMode(TableColumnIndex_Description, QHeaderView::Interactive); 749 horizontalHeader()->setSectionResizeMode(TableColumnIndex_Sequence, QHeaderView::Stretch); 750 751 /* Connect model: */ 752 UIShortcutConfigurationModel *pHotKeyTableModel = qobject_cast<UIShortcutConfigurationModel*>(model()); 753 if (pHotKeyTableModel) 754 connect(pHotKeyTableModel, &UIShortcutConfigurationModel::sigShortcutsLoaded, 755 this, &UIShortcutConfigurationView::sltHandleShortcutsLoaded); 775 // WORKAROUND: 776 // Rest of horizontalHeader stuff is in setModel() above.. 756 777 757 778 /* Check if we do have proper item delegate: */ … … 915 936 916 937 /* Prepare Manager UI table: */ 917 m_pTableManager = new UIShortcutConfigurationView(pTabManager, m_pModelManager,"m_pTableManager");938 m_pTableManager = new UIShortcutConfigurationView(pTabManager, "m_pTableManager"); 918 939 if (m_pTableManager) 940 { 941 m_pTableManager->setModel(m_pModelManager); 919 942 pLayoutManager->addWidget(m_pTableManager); 943 } 920 944 } 921 945 … … 949 973 950 974 /* Create Runtime UI table: */ 951 m_pTableRuntime = new UIShortcutConfigurationView(pTabMachine, m_pModelRuntime,"m_pTableRuntime");975 m_pTableRuntime = new UIShortcutConfigurationView(pTabMachine, "m_pTableRuntime"); 952 976 if (m_pTableRuntime) 977 { 978 m_pTableRuntime->setModel(m_pModelRuntime); 953 979 pLayoutMachine->addWidget(m_pTableRuntime); 980 } 954 981 } 955 982 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIShortcutConfigurationEditor.h
r105033 r105056 5 5 6 6 /* 7 * Copyright (C) 2006-202 3Oracle and/or its affiliates.7 * Copyright (C) 2006-2024 Oracle and/or its affiliates. 8 8 * 9 9 * This file is part of VirtualBox base platform packages, as
Note:
See TracChangeset
for help on using the changeset viewer.