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. QGraphicsTextItem: Hyphen breaks string selection (non word character)

QGraphicsTextItem: Hyphen breaks string selection (non word character)

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 343 Views
  • 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.
  • M Offline
    M Offline
    MS_GX
    wrote on last edited by MS_GX
    #1

    PySide2:

    I have QGraphicsTextItem with just one long string in it.

    If double-click on the string I can select it. But if I have a hyphen in the string, the selection will stop at the hypen.

    So for example if I have the string ABC-DEF I can either select ABC, - or DEF, but NOT the full ABC-DEF.

    I think the problem is that the hypen is not a word character. Where can I change this?

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @MS_GX said in QGraphicsTextItem: Hyphen breaks string selection (non word character):

      Where can I change this?

      In QTextEngine::atWordSeparator() by compiling Qt by yourself. So basically - nowhere except you implement your own doubleClick behavior.

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

      1 Reply Last reply
      2
      • M Offline
        M Offline
        MS_GX
        wrote on last edited by
        #3

        OK, thanks for your answer. How would I read the text from the QGraphicsTextItem, crop the text and only mark the cropped text?

        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          The text can found in QGraphicsTextItem::document()

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

          1 Reply Last reply
          2

          • Login

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