Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QLabel Value, Not Text()

QLabel Value, Not Text()

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 485 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    Qt.Jo.Ha
    wrote on last edited by
    #1

    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?

    J.HilkJ 1 Reply Last reply
    0
    • Kent-DorfmanK Offline
      Kent-DorfmanK Offline
      Kent-Dorfman
      wrote on last edited by
      #2

      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.

      The dystopian literature that served as a warning in my youth has become an instruction manual in my elder years.

      1 Reply Last reply
      2
      • Q Qt.Jo.Ha

        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?

        J.HilkJ Online
        J.HilkJ Online
        J.Hilk
        Moderators
        wrote on last edited by
        #3

        @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..


        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


        Q: What's that?
        A: It's blue light.
        Q: What does it do?
        A: It turns blue.

        Q 1 Reply Last reply
        2
        • J.HilkJ J.Hilk

          @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..

          Q Offline
          Q Offline
          Qt.Jo.Ha
          wrote on last edited by
          #4

          @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.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved