VirtualBox

Changeset 80913 in vbox


Ignore:
Timestamp:
Sep 20, 2019 6:03:25 AM (5 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9510. Updating the widgets after language chagen

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

    r80554 r80913  
    4747    prepareObjects();
    4848    retranslateUi();
    49     createTableItems();
    5049    connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigMachineDataChange,
    5150            this, &UIInformationConfiguration::sltMachineDataChanged);
     
    5453void UIInformationConfiguration::sltMachineDataChanged()
    5554{
    56     resetTable();
    5755    createTableItems();
    5856}
     
    6967    m_strUSBTitle = QApplication::translate("UIVMInformationDialog", "USB");
    7068    m_strSharedFoldersTitle = QApplication::translate("UIVMInformationDialog", "Shared Folders");
     69    createTableItems();
    7170}
    7271
     
    7574    if (!m_pTableWidget)
    7675        return;
     76    resetTable();
    7777    QFontMetrics fontMetrics(m_pTableWidget->font());
    7878    QTextDocument textDocument;
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIInformationRuntime.cpp

    r80772 r80913  
    102102    void createInfoRows();
    103103    void updateUpTime();
    104 
     104    void updateTitleRow();
    105105
    106106    /** Searches the table for the @p item of enmLine and replaces its text. if not found inserts a new
     
    108108    void updateInfoRow(InfoRow enmLine, const QString &strColumn0, const QString &strColumn1);
    109109    QString screenResolution(int iScreenId);
    110     /** Creates to QTableWidgetItems of tye @enmInfoRow using the @p strLabel and @p strInfo and inserts it
     110    /** Creates to QTableWidgetItems of the @enmInfoRow using the @p strLabel and @p strInfo and inserts it
    111111     * to the row @p iRow. If @p iRow is -1 then the items inserted to the end of the table. */
    112112    void insertInfoRow(InfoRow enmInfoRow, const QString& strLabel, const QString &strInfo, int iRow = -1);
     
    244244    , m_iMinimumWidth(0)
    245245    , m_pTimer(0)
    246 
    247246{
    248247    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
     
    266265
    267266    retranslateUi();
    268     /* Add the title row: */
    269     QTableWidgetItem *pTitleItem = new QTableWidgetItem(UIIconPool::iconSet(":/state_running_16px.png"), m_strTableTitle, InfoRow_Title);
    270     QFont titleFont(font());
    271     titleFont.setBold(true);
    272     pTitleItem->setFont(titleFont);
    273     insertRow(0);
    274     setItem(0, 0, pTitleItem);
    275     /* Make the API calls and populate the table: */
    276     createInfoRows();
    277267    computeMinimumWidth();
    278268}
     
    298288    m_strNotSet = QApplication::translate("UIVMInformationDialog", "not set");
    299289    m_strNotDetected = QApplication::translate("UIVMInformationDialog", "Not Detected");
     290
     291    /* Make the API calls and populate the table: */
     292    createInfoRows();
    300293}
    301294
     
    312305void UIRuntimeInfoWidget::insertInfoRow(InfoRow enmInfoRow, const QString& strLabel, const QString &strInfo, int iRow /* = -1 */)
    313306{
    314     int iMargin = 0.2 * qApp->style()->pixelMetric(QStyle::PM_LayoutTopMargin);
    315307    int iNewRow = rowCount();
    316308    if (iRow != -1 && iRow <= iNewRow)
     
    319311    setItem(iNewRow, 0, new QTableWidgetItem(strLabel, enmInfoRow));
    320312    setItem(iNewRow, 1, new QTableWidgetItem(strInfo, enmInfoRow));
     313    int iMargin = 0.2 * qApp->style()->pixelMetric(QStyle::PM_LayoutTopMargin);
    321314    setRowHeight(iNewRow, 2 * iMargin + m_iFontHeight);
    322315}
     
    398391}
    399392
     393void UIRuntimeInfoWidget::updateTitleRow()
     394{
     395    /* Add the title row always as 0th row: */
     396    QTableWidgetItem *pTitleItem = new QTableWidgetItem(UIIconPool::iconSet(":/state_running_16px.png"), m_strTableTitle, InfoRow_Title);
     397    QFont titleFont(font());
     398    titleFont.setBold(true);
     399    pTitleItem->setFont(titleFont);
     400    if (rowCount() < 1)
     401        insertRow(0);
     402    setItem(0, 0, pTitleItem);
     403}
     404
    400405void UIRuntimeInfoWidget::updateGAsVersion()
    401406{
     
    460465void UIRuntimeInfoWidget::createInfoRows()
    461466{
     467    clear();
     468    setRowCount(0);
     469    setColumnCount(2);
     470    updateTitleRow();
    462471    updateScreenInfo();
    463472    updateUpTime();
     
    649658    m_strResetActionLabel = QApplication::translate("UIVMInformationDialog", "Reset");
    650659    m_strPieChartToggleActionLabel = QApplication::translate("UIVMInformationDialog", "Show Pie Chart");
     660    update();
    651661}
    652662
     
    12341244        }
    12351245    }
     1246    sltTimeout();
    12361247}
    12371248
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