VirtualBox

Ignore:
Timestamp:
Jun 26, 2024 3:29:27 PM (8 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
163650
Message:

FE/Qt: bugref:10681: UIShortcutConfigurationEditor: A bit of rework related to model/view stuff.

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

    r105031 r105032  
    244244    /** Constructs model passing @a pParent to the base-class.
    245245      * @param  enmType  Brings the action-pool type this model is related to. */
    246     UIShortcutConfigurationModel(QObject *pParent, UIType enmType);
    247 
    248     /** Defines the parent @a pTable reference. */
    249     void setTable(UIShortcutConfigurationView *pTable);
     246    UIShortcutConfigurationModel(UIShortcutConfigurationEditor *pParent, UIType enmType);
    250247
    251248    /** Loads a @a list of shortcuts to the model. */
     
    283280private:
    284281
     282    /** Return the parent table-view reference. */
     283    QITableView *view() const;
     284
    285285    /** Applies filter. */
    286286    void applyFilter();
    287287
     288    /** Holds the parent shortcut-configuration editor instance. */
     289    UIShortcutConfigurationEditor *m_pShortcutConfigurationEditor;
     290
    288291    /** Holds the action-pool type this model is related to. */
    289292    UIType  m_enmType;
    290 
    291     /** Holds the parent table reference. */
    292     UIShortcutConfigurationView *m_pTable;
    293293
    294294    /** Holds current filter. */
     
    340340*********************************************************************************************************************************/
    341341
    342 UIShortcutConfigurationModel::UIShortcutConfigurationModel(QObject *pParent, UIType enmType)
     342UIShortcutConfigurationModel::UIShortcutConfigurationModel(UIShortcutConfigurationEditor *pParent, UIType enmType)
    343343    : QAbstractTableModel(pParent)
     344    , m_pShortcutConfigurationEditor(pParent)
    344345    , m_enmType(enmType)
    345     , m_pTable(0)
    346 {
    347 }
    348 
    349 void UIShortcutConfigurationModel::setTable(UIShortcutConfigurationView *pTable)
    350 {
    351     m_pTable = pTable;
     346{
    352347}
    353348
     
    362357            continue;
    363358        /* Add suitable item to the model as a new shortcut: */
    364         m_shortcuts << UIShortcutTableViewRow(m_pTable, item);
     359        m_shortcuts << UIShortcutTableViewRow(view(), item);
    365360    }
    366361    /* Apply filter: */
     
    646641}
    647642
     643QITableView *UIShortcutConfigurationModel::view() const
     644{
     645    switch (m_enmType)
     646    {
     647        case UIType_ManagerUI: return m_pShortcutConfigurationEditor->viewManager();
     648        case UIType_RuntimeUI: return m_pShortcutConfigurationEditor->viewRuntime();
     649    }
     650}
     651
    648652void UIShortcutConfigurationModel::applyFilter()
    649653{
     
    793797}
    794798
     799QITableView *UIShortcutConfigurationEditor::viewManager()
     800{
     801    return m_pTableManager;
     802}
     803
     804QITableView *UIShortcutConfigurationEditor::viewRuntime()
     805{
     806    return m_pTableRuntime;
     807}
     808
    795809void UIShortcutConfigurationEditor::load(const UIShortcutConfigurationList &value)
    796810{
     
    895909            m_pTableManager = new UIShortcutConfigurationView(pTabManager, m_pModelManager, "m_pTableManager");
    896910            if (m_pTableManager)
    897             {
    898                 m_pModelManager->setTable(m_pTableManager);
    899911                pLayoutManager->addWidget(m_pTableManager);
    900             }
    901912        }
    902913
     
    932943            m_pTableRuntime = new UIShortcutConfigurationView(pTabMachine, m_pModelRuntime, "m_pTableRuntime");
    933944            if (m_pTableRuntime)
    934             {
    935                 m_pModelRuntime->setTable(m_pTableRuntime);
    936945                pLayoutMachine->addWidget(m_pTableRuntime);
    937             }
    938946        }
    939947
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIShortcutConfigurationEditor.h

    r105031 r105032  
    3838class QLineEdit;
    3939class QTabWidget;
     40class QITableView;
    4041class UIShortcutConfigurationModel;
    41 class UIShortcutConfigurationView;
    4242
    4343/** Shortcut search functor template. */
     
    170170    UIShortcutConfigurationEditor(QWidget *pParent = 0);
    171171
     172    /** Returns manager table-view reference. */
     173    QITableView *viewManager();
     174    /** Returns runtime table-view reference. */
     175    QITableView *viewRuntime();
     176
    172177    /** Loads shortcut configuration list from passed @a value. */
    173178    void load(const UIShortcutConfigurationList &value);
     
    213218    QLineEdit                    *m_pEditorFilterManager;
    214219    /** Holds the Manager UI shortcuts table instance. */
    215     UIShortcutConfigurationView  *m_pTableManager;
     220    QITableView                  *m_pTableManager;
    216221    /** Holds the Runtime UI shortcuts filter instance. */
    217222    QLineEdit                    *m_pEditorFilterRuntime;
    218223    /** Holds the Runtime UI shortcuts table instance. */
    219     UIShortcutConfigurationView  *m_pTableRuntime;
     224    QITableView                  *m_pTableRuntime;
    220225};
    221226
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette