VirtualBox

Changeset 85303 in vbox for trunk/src


Ignore:
Timestamp:
Jul 13, 2020 10:10:35 AM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9686. Trying to handle column width a bit better by considering the sort indicator icon's width

Location:
trunk/src/VBox/Frontends/VirtualBox/src/monitor/resource
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/monitor/resource/UIResourceMonitor.cpp

    r83685 r85303  
    11991199    , m_pHostStatsWidget(0)
    12001200    , m_fIsCurrentTool(true)
     1201    , m_iSortIndicatorWidth(0)
    12011202{
    12021203    prepare();
     
    12681269void UIResourceMonitorWidget::prepare()
    12691270{
     1271    /* Try to guest the sort indicator's width: */
     1272    int iIndicatorMargin = 3;
     1273    QIcon sortIndicator = qApp->QApplication::style()->standardIcon(QStyle::SP_TitleBarUnshadeButton);
     1274    QList<QSize> iconSizes = sortIndicator.availableSizes();
     1275    foreach(const QSize &msize, iconSizes)
     1276        m_iSortIndicatorWidth = qMax(m_iSortIndicatorWidth, msize.width());
     1277    if (m_iSortIndicatorWidth == 0)
     1278        m_iSortIndicatorWidth = 20;
     1279    m_iSortIndicatorWidth += 2 * iIndicatorMargin;
     1280
    12701281    loadHiddenColumnList();
    12711282    prepareWidgets();
     
    14461457    QFontMetrics fontMetrics(m_pTableView->font());
    14471458    const QMap<int, int> &columnDataStringLengths = m_pModel->dataLengths();
    1448 
    14491459    QMap<int, int> columnWidthsInPixels;
    14501460    for (int i = 0; i < (int)VMResourceMonitorColumn_Max; ++i)
     
    14551465        columnWidthsInPixels[i] = iMax * fontMetrics.width('x') +
    14561466            QApplication::style()->pixelMetric(QStyle::PM_LayoutLeftMargin) +
    1457             QApplication::style()->pixelMetric(QStyle::PM_LayoutRightMargin);
     1467            QApplication::style()->pixelMetric(QStyle::PM_LayoutRightMargin) +
     1468            m_iSortIndicatorWidth;
    14581469    }
    14591470    m_pTableView->setMinimumColumnWidths(columnWidthsInPixels);
  • trunk/src/VBox/Frontends/VirtualBox/src/monitor/resource/UIResourceMonitor.h

    r83685 r85303  
    122122    /** Indicates if this widget's host tool is current tool. */
    123123    bool    m_fIsCurrentTool;
     124    int     m_iSortIndicatorWidth;
    124125};
    125126
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