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 text with embedded ellipsis
Qt 6.11 is out! See what's new in the release blog

QLabel text with embedded ellipsis

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 3 Posters 1.4k Views 3 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.
  • PerdrixP Offline
    PerdrixP Offline
    Perdrix
    wrote on last edited by Perdrix
    #1

    I have a Windows dlg that displays like this:
    d7727b65-c387-4af6-8299-1f099a5263a0-image.png

    I want my Qt based dlg to break the long path in the first line with an embedded ellipsis just like the windows dlg, but I get this:

    4854b7e4-5710-4fd6-bb91-6401ed75d495-image.png

    How can I persuade the QLabel to do that?

    Thanks
    David

    SGaistS 1 Reply Last reply
    0
    • PerdrixP Perdrix

      I have a Windows dlg that displays like this:
      d7727b65-c387-4af6-8299-1f099a5263a0-image.png

      I want my Qt based dlg to break the long path in the first line with an embedded ellipsis just like the windows dlg, but I get this:

      4854b7e4-5710-4fd6-bb91-6401ed75d495-image.png

      How can I persuade the QLabel to do that?

      Thanks
      David

      SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      You can look for inspiration in the Elided Label Example.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      PerdrixP 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi,

        You can look for inspiration in the Elided Label Example.

        PerdrixP Offline
        PerdrixP Offline
        Perdrix
        wrote on last edited by
        #3

        @SGaist No disrespect to you, but that is not a good solution

        Christian EhrlicherC 1 Reply Last reply
        0
        • PerdrixP Perdrix

          @SGaist No disrespect to you, but that is not a good solution

          Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Perdrix said in QLabel text with embedded ellipsis:

          but that is not a good solution

          Why? You wanted an elipsis, the example shows you how to do so, so why is this not a good solution?

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          PerdrixP 1 Reply Last reply
          1
          • Christian EhrlicherC Christian Ehrlicher

            @Perdrix said in QLabel text with embedded ellipsis:

            but that is not a good solution

            Why? You wanted an elipsis, the example shows you how to do so, so why is this not a good solution?

            PerdrixP Offline
            PerdrixP Offline
            Perdrix
            wrote on last edited by
            #5

            @Christian-Ehrlicher That code placed an ellipsis at the end rather than placing it at a sensible location in the middle.

            Now that I have looked at it again more carefully I now think I it will be fairly simple to change it to place the elision point in the middle.

            Christian EhrlicherC 1 Reply Last reply
            0
            • PerdrixP Perdrix

              @Christian-Ehrlicher That code placed an ellipsis at the end rather than placing it at a sensible location in the middle.

              Now that I have looked at it again more carefully I now think I it will be fairly simple to change it to place the elision point in the middle.

              Christian EhrlicherC Offline
              Christian EhrlicherC Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Perdrix said in QLabel text with embedded ellipsis:

              That code placed an ellipsis at the end rather than placing it at a sensible location in the middle.

              @SGaist

              You can look for inspiration

              Why do people who call themself programmers expect that they can copy and paste everything from everywhere an it works out of the box...

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              PerdrixP 1 Reply Last reply
              1
              • Christian EhrlicherC Christian Ehrlicher

                @Perdrix said in QLabel text with embedded ellipsis:

                That code placed an ellipsis at the end rather than placing it at a sensible location in the middle.

                @SGaist

                You can look for inspiration

                Why do people who call themself programmers expect that they can copy and paste everything from everywhere an it works out of the box...

                PerdrixP Offline
                PerdrixP Offline
                Perdrix
                wrote on last edited by
                #7

                @Christian-Ehrlicher Because sometimes we think that the basic framework should provide a function and are surprised when it doesn't.

                Furthermore we are often under time pressure, and don't always know how best to handle stuff

                Sure given time and resources we can write what's needed, but sometimes we hope that it is there for the taking!

                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