QT class, which cut texts
-
Hi,
A few weeks ago I find perfect class in Qt, which do:
I have some long text like "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", and my QLabel has fixed Width and it's smaller
than size of my long text ( in pixels ). I would like to see in QLabel something like:"AAAA...AAAA".
I know that is possible, but I don't remember the name of this class...
EDIT:
In this function in that class I have to add param: the size in pixels.
EDIT2: Maybe QFontMetrics - I have to check that
-
Maybe this example helps: https://doc.qt.io/qt-5/qtwidgets-widgets-elidedlabel-example.html
-
@TomNow99
And https://doc.qt.io/qt-5/qt.html#TextElideMode-enum, https://doc.qt.io/qt-5/qfontmetrics.html#elidedText.https://itqna.net/questions/14614/it-possible-use-elide-qlabel derives from
QLabel
, while the Qt example derives fromQFrame
. The last answer there is just 4 lines rather than a whole class. As you please.