VirtualBox

Ignore:
Timestamp:
Aug 25, 2019 2:44:53 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
132889
Message:

FE/Qt: bugref:9510: Making sure that table widget is wide enough to avoid horizontal scroll bars.

File:
1 edited

Legend:

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

    r80414 r80415  
    6262
    6363
    64 
    6564/*********************************************************************************************************************************
    6665*   UIRuntimeInfoWidget definition.                                                                                     *
     
    7776protected:
    7877
    79     void retranslateUi() /* override */;
     78    virtual void retranslateUi() /* override */;
     79    virtual QSize sizeHint() const;
     80    virtual QSize minimumSizeHint() const /* override */;
     81
    8082
    8183private:
     
    8385    void runTimeAttributes();
    8486    void insertInfoLine(InfoLine enmInfoLine, const QString& strLabel, const QString &strInfo);
     87    void computeMinimumWidth();
    8588
    8689    CMachine m_machine;
     
    104107
    105108    int m_iFontHeight;
     109    /** Computed by computing the maximum length line. Used to avoid having horizontal scroll bars. */
     110    int m_iMinimumWidth;
    106111};
    107112
     
    174179    , m_machine(machine)
    175180    , m_console(console)
     181    , m_iMinimumWidth(0)
    176182
    177183{
     
    180186    // setAutoFillBackground(true);
    181187    // setPalette(pal);
     188
     189    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    182190
    183191    m_iFontHeight = QFontMetrics(font()).height();
     
    201209
    202210    runTimeAttributes();
     211    computeMinimumWidth();
    203212}
    204213
     
    217226    m_strGuestOSTypeLabel = QApplication::translate("UIVMInformationDialog", "Guest OS Type");
    218227    m_strRemoteDesktopLabel = QApplication::translate("UIVMInformationDialog", "Remote Desktop Server Port");
     228}
     229
     230QSize UIRuntimeInfoWidget::sizeHint() const
     231{
     232    return QSize(m_iMinimumWidth, m_iMinimumWidth);
     233}
     234
     235QSize UIRuntimeInfoWidget::minimumSizeHint() const
     236{
     237    printf("mini %d\n", m_iMinimumWidth);
     238    return QSize(m_iMinimumWidth, m_iMinimumWidth);
    219239}
    220240
     
    367387}
    368388
     389void UIRuntimeInfoWidget::computeMinimumWidth()
     390{
     391    m_iMinimumWidth = 0;
     392    for (int j = 0; j < columnCount(); ++j)
     393        m_iMinimumWidth += columnWidth(j);
     394}
     395
     396
    369397/*********************************************************************************************************************************
    370398*   UIChart implementation.                                                                                     *
     
    551579        QFont font = painter.font();
    552580        font.setBold(true);
     581        /** @todo: make this size dynamic. aka. autoscale the font. */
    553582        font.setPixelSize(16);
    554583        painter.setFont(font);
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