VirtualBox

Changeset 104518 in vbox for trunk/src


Ignore:
Timestamp:
May 6, 2024 1:19:22 PM (12 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
163042
Message:

FE/Qt. bugref:10673. Use QITableWidgetItem instead of QTreeWidgetItem.

File:
1 edited

Legend:

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

    r104505 r104518  
    104104    void updateInfoRow(InfoRow enmLine, const QString &strColumn0, const QString &strColumn1);
    105105    QString screenResolution(int iScreenId);
    106     /** Creates to QTableWidgetItems of the @enmInfoRow using the @p strLabel and @p strInfo and inserts it
     106    /** Creates to QITableWidgetItems of the @enmInfoRow using the @p strLabel and @p strInfo and inserts it
    107107     * to the row @p iRow. If @p iRow is -1 then the items inserted to the end of the table. */
    108108    void insertInfoRow(InfoRow enmInfoRow, const QString& strLabel, const QString &strInfo, int iRow = -1);
     
    238238        iNewRow = iRow;
    239239    insertRow(iNewRow);
    240     setItem(iNewRow, 1, new QTableWidgetItem(strLabel, enmInfoRow));
    241     setItem(iNewRow, 2, new QTableWidgetItem(strInfo, enmInfoRow));
     240
     241    QITableWidgetItem *pItem1 = new QITableWidgetItem(strLabel);
     242    AssertPtrReturnVoid(pItem1);
     243    pItem1->setData(Qt::UserRole + 1, enmInfoRow);
     244    setItem(iNewRow, 1, pItem1);
     245
     246    QITableWidgetItem *pItem2 = new QITableWidgetItem(strInfo);
     247    AssertPtrReturnVoid(pItem2);
     248    pItem2->setData(Qt::UserRole + 1, enmInfoRow);
     249    setItem(iNewRow, 2, pItem2);
     250
    242251    int iMargin = 0.2 * qApp->style()->pixelMetric(QStyle::PM_LayoutTopMargin);
    243252    setRowHeight(iNewRow, 2 * iMargin + m_iFontHeight);
     
    293302    for (int i = iRowCount - 1; i >= 0; --i)
    294303    {
    295         QTableWidgetItem *pItem = item(i, 1);
     304        QITableWidgetItem *pItem = static_cast<QITableWidgetItem*>(item(i, 1));
    296305        if (pItem && pItem->type() == InfoRow_Resolution)
    297306            removeRow(i);
     
    332341{
    333342    /* Add the title row always as 0th row: */
    334     QTableWidgetItem *pTitleIcon = new QTableWidgetItem(UIIconPool::iconSet(":/state_running_16px.png"), "", InfoRow_Title);
    335     QTableWidgetItem *pTitleItem = new QTableWidgetItem(m_strTableTitle, InfoRow_Title);
     343    QITableWidgetItem *pTitleIcon = new QITableWidgetItem("");
     344    AssertReturnVoid(pTitleIcon);
     345    pTitleIcon->setIcon(UIIconPool::iconSet(":/state_running_16px.png"));
     346    pTitleIcon->setData(Qt::UserRole + 1, InfoRow_Title);
     347
     348    QITableWidgetItem *pTitleItem = new QITableWidgetItem(m_strTableTitle);
     349    AssertReturnVoid(pTitleItem);
     350    pTitleItem->setData(Qt::UserRole + 1, InfoRow_Title);
     351
    336352    QFont titleFont(font());
    337353    titleFont.setBold(true);
     
    461477    {
    462478        /* Skip the first column as it contains only icon and no text: */
    463         QTableWidgetItem *pItem = item(i, 1);
     479        QITableWidgetItem *pItem = static_cast<QITableWidgetItem*>(item(i, 1));
     480        if (!pItem)
     481            continue;
    464482        QString strColumn1 = pItem ? pItem->text() : QString();
    465         pItem = item(i, 2);
     483        pItem = static_cast<QITableWidgetItem*>(item(i, 2));
     484        if (!pItem)
     485            continue;
    466486        QString strColumn2 = pItem ? pItem->text() : QString();
    467487        if (strColumn2.isEmpty())
     
    476496void UIRuntimeInfoWidget::updateInfoRow(InfoRow enmLine, const QString &strColumn0, const QString &strColumn1)
    477497{
    478     QTableWidgetItem *pItem = 0;
     498    QITableWidgetItem *pItem = 0;
    479499    for (int i = 0; i < rowCount() && !pItem; ++i)
    480500    {
    481         pItem = item(i, 2);
     501        pItem = static_cast<QITableWidgetItem*>(item(i, 2));
    482502        if (!pItem)
    483503            continue;
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