VirtualBox

Ignore:
Timestamp:
Dec 7, 2016 2:39:02 PM (8 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:6899: Accessibility support (step 153): UIPortForwardingTable rework: Use the table as a parent for it's model, required for accessibility support; Reordering table vs model creation and configuration accordingly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPortForwardingTable.cpp

    r64801 r64802  
    292292public:
    293293
    294     /* Constructor: */
    295     UIPortForwardingModel(QObject *pParent = 0, const UIPortForwardingDataList &rules = UIPortForwardingDataList())
     294    /** Constructs Port Forwarding model passing @a pParent to the base-class.
     295      * @param  rules  Brings the list of port forwarding rules to load initially. */
     296    UIPortForwardingModel(QITableView *pParent, const UIPortForwardingDataList &rules = UIPortForwardingDataList())
    296297        : QAbstractTableModel(pParent)
    297298        , m_dataList(rules) {}
     
    319320
    320321private:
     322
     323    /** Return the parent table-view reference. */
     324    QITableView *parentTable() const;
    321325
    322326    /* Variable: Data stuff: */
     
    509513}
    510514
     515QITableView *UIPortForwardingModel::parentTable() const
     516{
     517    return qobject_cast<QITableView*>(parent());
     518}
     519
    511520
    512521/*********************************************************************************************************************************
     
    534543#endif /* !VBOX_WS_WIN */
    535544        pMainLayout->setSpacing(3);
    536         /* Create model: */
    537         m_pModel = new UIPortForwardingModel(this, rules);
    538         {
    539             /* Configure model: */
    540             connect(m_pModel, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), this, SLOT(sltTableDataChanged()));
    541             connect(m_pModel, SIGNAL(rowsInserted(const QModelIndex&, int, int)), this, SLOT(sltTableDataChanged()));
    542             connect(m_pModel, SIGNAL(rowsRemoved(const QModelIndex&, int, int)), this, SLOT(sltTableDataChanged()));
    543         }
    544545        /* Create table: */
    545546        m_pTableView = new QITableView;
    546547        {
    547548            /* Configure table: */
    548             m_pTableView->setModel(m_pModel);
    549549            m_pTableView->setTabKeyNavigation(false);
    550550            m_pTableView->verticalHeader()->hide();
     
    553553            m_pTableView->setContextMenuPolicy(Qt::CustomContextMenu);
    554554            m_pTableView->installEventFilter(this);
     555        }
     556        /* Create model: */
     557        m_pModel = new UIPortForwardingModel(m_pTableView, rules);
     558        {
     559            /* Configure model: */
     560            connect(m_pModel, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), this, SLOT(sltTableDataChanged()));
     561            connect(m_pModel, SIGNAL(rowsInserted(const QModelIndex&, int, int)), this, SLOT(sltTableDataChanged()));
     562            connect(m_pModel, SIGNAL(rowsRemoved(const QModelIndex&, int, int)), this, SLOT(sltTableDataChanged()));
     563            /* Configure table (after model is configured): */
     564            m_pTableView->setModel(m_pModel);
    555565            connect(m_pTableView, SIGNAL(sigCurrentChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(sltCurrentChanged()));
    556566            connect(m_pTableView, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(sltShowTableContexMenu(const QPoint &)));
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