Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. QLabel.setTextInteractionFlags(Qt.TextInteractionFlag.TextSelectableByMouse) isn't working.
Forum Updated to NodeBB v4.3 + New Features

QLabel.setTextInteractionFlags(Qt.TextInteractionFlag.TextSelectableByMouse) isn't working.

Scheduled Pinned Locked Moved Unsolved Qt for Python
qt for python
4 Posts 2 Posters 639 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.
  • - Offline
    - Offline
    -teh-
    wrote on last edited by
    #1

    Hello, so I've been working on a Python calculator as one of my first big projects and I'm running into an issue with setTextInteractionFlags. I try to use it on my QLabel(self.historyLabel), but it's not working. What I mean when I say it's not working is that it won't let me highlight the text in my history entries. It will work on my main self.label(my label that shows the current equation.) This is the current version of my QT6 program any help would be appreciated. Been stuck on this bug for more than 2 days now.

    jsulmJ 1 Reply Last reply
    0
    • - -teh-

      Hello, so I've been working on a Python calculator as one of my first big projects and I'm running into an issue with setTextInteractionFlags. I try to use it on my QLabel(self.historyLabel), but it's not working. What I mean when I say it's not working is that it won't let me highlight the text in my history entries. It will work on my main self.label(my label that shows the current equation.) This is the current version of my QT6 program any help would be appreciated. Been stuck on this bug for more than 2 days now.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @teh You are overwriting the flags. Could be the reason. You should rather add TextSelectableByMouse to already set flags (by doing | with textInteractionFlags()).

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      - 1 Reply Last reply
      2
      • jsulmJ jsulm

        @teh You are overwriting the flags. Could be the reason. You should rather add TextSelectableByMouse to already set flags (by doing | with textInteractionFlags()).

        - Offline
        - Offline
        -teh-
        wrote on last edited by
        #3

        @jsulm I just tried self.historyLabel.setTextInteractionFlags(self.historyLabel.textInteractionFlags() | Qt.TextSelectableByMouse) and it's still not working am I setting it correctly? I don't have a lot of practice with the OR bitwise operator.

        jsulmJ 1 Reply Last reply
        0
        • - -teh-

          @jsulm I just tried self.historyLabel.setTextInteractionFlags(self.historyLabel.textInteractionFlags() | Qt.TextSelectableByMouse) and it's still not working am I setting it correctly? I don't have a lot of practice with the OR bitwise operator.

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @teh That should be OK. You can also try to set this flag each time you change the text of the label. Otherwise I have no other ideas.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          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