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. How to change styleCheet on Event?

How to change styleCheet on Event?

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

    Hey everyone, I'm working with opencv object detection in pyqt5 and I want to change the color of an appended text of the textbrowser when event happended/ object detected.
    Anyone an idea what to do to change the style on event?
    Thx in advance.

    JonBJ 1 Reply Last reply
    0
    • L levoxtrip

      Hey everyone, I'm working with opencv object detection in pyqt5 and I want to change the color of an appended text of the textbrowser when event happended/ object detected.
      Anyone an idea what to do to change the style on event?
      Thx in advance.

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @levoxtrip
      Just put a signal on whatever when it changes, and in your slot go textBrowser.setStyleSheet().

      Note this will affect the style sheet for the whole QTextBrowser. If you only want to do something about the style of the newly appended text you will have to do something rather different (e.g. insert in-line HTML/style).

      1 Reply Last reply
      1
      • L Offline
        L Offline
        levoxtrip
        wrote on last edited by
        #3

        ah nice thank you.
        Another question. Do you know how to reverse the textBrowser. So the newest append is on the top and the older are fading to the top?

        JonBJ 1 Reply Last reply
        0
        • L levoxtrip

          ah nice thank you.
          Another question. Do you know how to reverse the textBrowser. So the newest append is on the top and the older are fading to the top?

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

          @levoxtrip
          I don't know anything about your "fading", but QTextEdit::append() always appends the text at the end. To insert somewhere else it looks like you must use QTextEdit::insertHtml/insertPlainText(), and those insert at the current cursor position, so you may need to move it with QTextEdit::moveCursor/setPosition() or similar.

          1 Reply Last reply
          1

          • Login

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