VirtualBox

Changeset 78026 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Apr 5, 2019 11:21:07 AM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
129803
Message:

FE/Qt: bugref:6699. Truncate the text of the bread crumbs widget correctly during resize.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerTable.cpp

    r78024 r78026  
    8484    UIFileManagerBreadCrumbs(QWidget *pParent = 0);
    8585    void setPath(const QString &strPath);
     86
     87protected:
     88
     89    virtual void resizeEvent(QResizeEvent *pEvent) /* override */;
     90
     91private:
     92
     93    QString m_strPath;
    8694};
    8795
     
    106114    void reset();
    107115
    108 protected:
    109 
    110     virtual void resizeEvent(QResizeEvent *pEvent) /* override */;
    111 
    112116private slots:
    113117
     
    124128    UIFileManagerHistoryComboBox *m_pHistoryComboBox;
    125129    QToolButton                  *m_pSwitchButton;
    126     QString                       m_strPath;
    127130};
    128131
     
    253256void UIFileManagerNavigationWidget::setPath(const QString &strLocation)
    254257{
    255     m_strPath = strLocation;
    256 
    257258    if (m_pBreadCrumbs)
    258259        m_pBreadCrumbs->setPath(strLocation);
     
    286287}
    287288
    288 void UIFileManagerNavigationWidget::resizeEvent(QResizeEvent *pEvent)
    289 {
    290     if (m_pBreadCrumbs)
    291         m_pBreadCrumbs->setPath(m_strPath);
    292 
    293     QWidget::resizeEvent(pEvent);
    294 }
    295 
    296289void UIFileManagerNavigationWidget::prepare()
    297290{
     
    388381
    389382    setPalette(newPalette);
     383    /* Allow the labe become smaller than the current text. calling setpath in resizeEvent truncated the text anyway: */
     384    setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
    390385}
    391386
    392387void UIFileManagerBreadCrumbs::setPath(const QString &strPath)
    393388{
     389    m_strPath = strPath;
     390
    394391    const QChar separator('/');
    395392    clear();
     
    430427    }
    431428    setText(strLabelText);
     429}
     430
     431void UIFileManagerBreadCrumbs::resizeEvent(QResizeEvent *pEvent)
     432{
     433    /* Truncate the text the way we want: */
     434    setPath(m_strPath);
     435    QLabel::resizeEvent(pEvent);
    432436}
    433437
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