- 
    Bug 
- 
    Resolution: Done
- 
    P1: Critical 
- 
    5.12.0 RC2
- 
    None
- 
        
- 
        25231c40489e54d57998fa44385ad832cc32b30d (qt/qtbase/5.12) 7024090e1dc7043e7a2a692ede105bcb7952781d (qt/qtbase/5.12)
https://codereview.qt-project.org/227511/ allows text in a QToolButton to elide. However, in some cases it causes a "premature" eliding. That means that even with preferred width, the QToolButton elides its text.
The attached QTBUG-72226.zip contains a minimal application to reproduce the issue.
before fix:

after fix:

Key ingredients are:
- QToolButton in a QHorizontalLayout
- button has an icon
- button has text
- text contains a & (mnemonic)
- toolButtonStyle is Qt::ToolButtonTextBesideIcon
The issue was originally fount in Qt Creator's amend/commit editor (QTCREATORBUG-21551). This is how it looks like:
before fix:

after fix

- is duplicated by
- 
                    QTBUG-72730 Regression: QToolButton labels gets elided due to calculated width being too low in Qt 5.12 -           
- Closed
 
-         
- 
                    QTBUG-72708 QTableView: Word wrapping and resizing rows do not play along -           
- Closed
 
-         
- relates to
- 
                    QTBUG-73333 QToolButton eliding option editing -           
- Closed
 
-         
- resulted from
- 
                    QTCREATORBUG-21551 [Reg 4.8-beta1 -> 4.8-beta2] Git submit editor buttons text elided -           
- Closed
 
-         
| For Gerrit Dashboard: QTBUG-72226 | ||||||
|---|---|---|---|---|---|---|
| # | Subject | Branch | Project | Status | CR | V | 
| 247210,3 | QToolButton: Don't elide text if an icon is present | 5.12 | qt/qtbase | Status: MERGED | +2 | 0 | 
| 248836,4 | QToolButton: fix handling multi-line texts | 5.12 | qt/qtbase | Status: MERGED | +2 | 0 | 
| 251898,1 | QToolButton: fix handling multi-line texts | dev | qt/qtbase | Status: ABANDONED | 0 | 0 | 



