VirtualBox

Changeset 80352 in vbox


Ignore:
Timestamp:
Aug 20, 2019 9:24:24 AM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
132817
Message:

FE/Qt: bugref:9510: Replacing model/view stuff with a QTableWidget in 'Configuration Details' tab

Location:
trunk/src/VBox/Frontends/VirtualBox/src/runtime/information
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIInformationConfiguration.cpp

    r80351 r80352  
    3131#include "UIIconPool.h"
    3232#include "UIInformationConfiguration.h"
    33 #include "UIInformationDataItem.h"
    34 #include "UIInformationItem.h"
    35 #include "UIInformationView.h"
    36 #include "UIInformationModel.h"
    3733
    3834
     
    4238    , m_console(console)
    4339    , m_pMainLayout(0)
    44     , m_pModel(0)
    45     , m_pView(0)
    4640    , m_pTableWidget(0)
    4741    , m_iColumCount(3)
     
    5145    , m_iRowBottomMargin(0.2 * qApp->style()->pixelMetric(QStyle::PM_LayoutBottomMargin))
    5246{
    53     /* Prepare model: */
    54     prepareModel();
    55 
    5647    /* Prepare view: */
    5748    prepareObjects();
     
    7970}
    8071
    81 void UIInformationConfiguration::prepareModel()
    82 {
    83     /* Create information-model: */
    84     m_pModel = new UIInformationModel(this, m_machine, m_console);
    85     AssertPtrReturnVoid(m_pModel);
    86     {
    87         /* Create general data-item: */
    88         UIInformationDataItem *pGeneral = new UIInformationDataGeneral(m_machine, m_console, m_pModel);
    89         AssertPtrReturnVoid(pGeneral);
    90         {
    91             /* Add general data-item to model: */
    92             m_pModel->addItem(pGeneral);
    93         }
    94 
    95         /* Create system data-item: */
    96         UIInformationDataItem *pSystem = new UIInformationDataSystem(m_machine, m_console, m_pModel);
    97         AssertPtrReturnVoid(pSystem);
    98         {
    99             /* Add system data-item to model: */
    100             m_pModel->addItem(pSystem);
    101         }
    102 
    103         /* Create display data-item: */
    104         UIInformationDataItem *pDisplay = new UIInformationDataDisplay(m_machine, m_console, m_pModel);
    105         AssertPtrReturnVoid(pDisplay);
    106         {
    107             /* Add display data-item to model: */
    108             m_pModel->addItem(pDisplay);
    109         }
    110 
    111         /* Create storage data-item: */
    112         UIInformationDataItem *pStorage = new UIInformationDataStorage(m_machine, m_console, m_pModel);
    113         AssertPtrReturnVoid(pStorage);
    114         {
    115             /* Add storage data-item to model: */
    116             m_pModel->addItem(pStorage);
    117         }
    118 
    119         /* Create audio data-item: */
    120         UIInformationDataItem *pAudio = new UIInformationDataAudio(m_machine, m_console, m_pModel);
    121         AssertPtrReturnVoid(pAudio);
    122         {
    123             /* Add audio data-item to model: */
    124             m_pModel->addItem(pAudio);
    125         }
    126 
    127         /* Create network data-item: */
    128         UIInformationDataItem *pNetwork = new UIInformationDataNetwork(m_machine, m_console, m_pModel);
    129         AssertPtrReturnVoid(pNetwork);
    130         {
    131             /* Add network data-item to model: */
    132             m_pModel->addItem(pNetwork);
    133         }
    134 
    135         /* Create serial-ports data-item: */
    136         UIInformationDataItem *pSerialPorts = new UIInformationDataSerialPorts(m_machine, m_console, m_pModel);
    137         AssertPtrReturnVoid(pSerialPorts);
    138         {
    139             /* Add serial-ports data-item to model: */
    140             m_pModel->addItem(pSerialPorts);
    141         }
    142 
    143         /* Create usb data-item: */
    144         UIInformationDataItem *pUSB = new UIInformationDataUSB(m_machine, m_console, m_pModel);
    145         AssertPtrReturnVoid(pUSB);
    146         {
    147             /* Add usb data-item to model: */
    148             m_pModel->addItem(pUSB);
    149         }
    150 
    151         /* Create shared-folders data-item: */
    152         UIInformationDataItem *pSharedFolders = new UIInformationDataSharedFolders(m_machine, m_console, m_pModel);
    153         AssertPtrReturnVoid(pSharedFolders);
    154         {
    155             /* Add shared-folders data-item to model: */
    156             m_pModel->addItem(pSharedFolders);
    157         }
    158     }
    159 }
    160 
    16172void UIInformationConfiguration::prepareObjects()
    16273{
     
    16778    m_pMainLayout->setSpacing(0);
    16879
    169 
    170     /* Create information-view: */
    171     m_pView = new UIInformationView;
    172     AssertPtrReturnVoid(m_pView);
    173     {
    174         /* Configure information-view: */
    175         m_pView->setResizeMode(QListView::Adjust);
    176 
    177         /* Create information-delegate item: */
    178         UIInformationItem *pItem = new UIInformationItem(m_pView);
    179         AssertPtrReturnVoid(pItem);
    180         {
    181             /* Set item-delegate for information-view: */
    182             m_pView->setItemDelegate(pItem);
    183         }
    184         /* Connect data changed signal: */
    185         connect(m_pModel, &UIInformationModel::dataChanged, m_pView, &UIInformationView::updateData);
    186 
    187         /* Set model for view: */
    188         m_pView->setModel(m_pModel);
    189         /* Add information-view to the layout: */
    190         m_pMainLayout->addWidget(m_pView);
    191     }
    192 
    19380    m_pTableWidget = new QTableWidget;
    194 
    19581    if (m_pTableWidget)
    19682    {
     
    20187        m_pTableWidget->setShowGrid(false);
    20288        m_pMainLayout->addWidget(m_pTableWidget);
    203         m_pTableWidget->hide();
    20489    }
    20590}
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIInformationConfiguration.h

    r80351 r80352  
    3838/* Forward declarations: */
    3939class QVBoxLayout;
    40 class UIInformationView;
    41 class UIInformationModel;
    4240class QTableWidget;
    4341class QTableWidgetItem;
     
    6462
    6563private:
    66     /** Prepares model. */
    67     void prepareModel();
     64
    6865    void prepareObjects();
    6966    void createTableItems();
     
    8279    /** Holds the instance of layout we create. */
    8380    QVBoxLayout *m_pMainLayout;
    84     /** Holds the instance of model we create. */
    85     UIInformationModel *m_pModel;
    86     /** Holds the instance of view we create. */
    87     UIInformationView *m_pView;
    8881    QTableWidget *m_pTableWidget;
    8982    //QMap<TableRow, UIInformationTableRow*> m_rows;
Note: See TracChangeset for help on using the changeset viewer.

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