QLabel Value, Not Text()
-
subclass it and add a field that contains the desired information in whatever type you decide...understanding that there is no implicit link between the text() and your utility field.
-
What you see on the label is text. What can I use to use the real value rather than the apparent value due to the text elide?
@Qt-Jo-Ha @Kent-Dorfman 's approach is the more robust one for sure!
But Qt offers alternatives for you to use, that take a QString and turn it into a number. This should work good enough, if your text is a simple number representation.https://doc.qt.io/qt-5/qstring.html#toDouble
https://doc.qt.io/qt-5/qstring.html#toInt
etc.. -
@Qt-Jo-Ha @Kent-Dorfman 's approach is the more robust one for sure!
But Qt offers alternatives for you to use, that take a QString and turn it into a number. This should work good enough, if your text is a simple number representation.https://doc.qt.io/qt-5/qstring.html#toDouble
https://doc.qt.io/qt-5/qstring.html#toInt
etc..@J-Hilk said in QLabel Value, Not Text():
@Qt-Jo-Ha @Kent-Dorfman 's approach is the more robust one for sure!
But Qt offers alternatives for you to use, that take a QString and turn it into a number. This should work good enough, if your text is a simple number representation.https://doc.qt.io/qt-5/qstring.html#toDouble
https://doc.qt.io/qt-5/qstring.html#toInt
etc..@Kent-Dorfman @J-Hilk
Thank you all for the answers. It was very helpful.