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()
Forum Updated to NodeBB v4.3 + New Features

QLabel Value, Not Text()

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 446 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.

      If you meet the AI on the road, kill it.

      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 Offline
        J.HilkJ Offline
        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