Changeset 64802 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Dec 7, 2016 2:39:02 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPortForwardingTable.cpp
r64801 r64802 292 292 public: 293 293 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()) 296 297 : QAbstractTableModel(pParent) 297 298 , m_dataList(rules) {} … … 319 320 320 321 private: 322 323 /** Return the parent table-view reference. */ 324 QITableView *parentTable() const; 321 325 322 326 /* Variable: Data stuff: */ … … 509 513 } 510 514 515 QITableView *UIPortForwardingModel::parentTable() const 516 { 517 return qobject_cast<QITableView*>(parent()); 518 } 519 511 520 512 521 /********************************************************************************************************************************* … … 534 543 #endif /* !VBOX_WS_WIN */ 535 544 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 }544 545 /* Create table: */ 545 546 m_pTableView = new QITableView; 546 547 { 547 548 /* Configure table: */ 548 m_pTableView->setModel(m_pModel);549 549 m_pTableView->setTabKeyNavigation(false); 550 550 m_pTableView->verticalHeader()->hide(); … … 553 553 m_pTableView->setContextMenuPolicy(Qt::CustomContextMenu); 554 554 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); 555 565 connect(m_pTableView, SIGNAL(sigCurrentChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(sltCurrentChanged())); 556 566 connect(m_pTableView, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(sltShowTableContexMenu(const QPoint &)));
Note:
See TracChangeset
for help on using the changeset viewer.