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. Stylesheet issue - setting color property in the :focus state
Forum Updated to NodeBB v4.3 + New Features

Stylesheet issue - setting color property in the :focus state

Scheduled Pinned Locked Moved General and Desktop
stylesheet
8 Posts 3 Posters 3.2k 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.
  • T Offline
    T Offline
    tarod.net
    wrote on last edited by tarod.net
    #1

    I've just found the next strange issue working with style sheets.

    Using the following code, the text color is changed to red in QLineEdit but not in QTextEdit when the focus is got. In both cases, the background is OK. Does anyone know the reason why?

    QTextEdit:focus {
        color: red;
        background-color: grey;
    }
    
    QLineEdit:focus {
        color: red;
        background-color: grey;
    }
    

    "Individually, we are one drop. Together, we are an ocean."

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @tarod.net said:

      QTextEdit

      HI , I think the text color is part of the html so that is why it has no effect.
      please see
      https://forum.qt.io/topic/23189/qtextedit-text-color

      T 1 Reply Last reply
      0
      • mrjjM mrjj

        @tarod.net said:

        QTextEdit

        HI , I think the text color is part of the html so that is why it has no effect.
        please see
        https://forum.qt.io/topic/23189/qtextedit-text-color

        T Offline
        T Offline
        tarod.net
        wrote on last edited by
        #3

        @mrjj Well, but the text color changes if I use next code instead:

        QTextEdit {
            color: red;
            background-color: grey;
        }
        

        So I don't know why, but the text color doesn't change when the property is set, for example, in the :focus or :hover state.

        Maybe it's a bug?

        "Individually, we are one drop. Together, we are an ocean."

        mrjjM 1 Reply Last reply
        0
        • C Offline
          C Offline
          charlycoste
          wrote on last edited by charlycoste
          #4
          This post is deleted!
          1 Reply Last reply
          0
          • T tarod.net

            @mrjj Well, but the text color changes if I use next code instead:

            QTextEdit {
                color: red;
                background-color: grey;
            }
            

            So I don't know why, but the text color doesn't change when the property is set, for example, in the :focus or :hover state.

            Maybe it's a bug?

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @tarod.net said:

            :focus

            Not sure if it a bug or by design. Seem that color does not work for :focus for QTextEdit
            Here they control the focus color with code

            http://stackoverflow.com/questions/32060606/can-a-stylesheet-change-text-color-in-a-qplaintextedit

            Could be a bug since it is strange that color does for for normal state.

            T 1 Reply Last reply
            0
            • mrjjM mrjj

              @tarod.net said:

              :focus

              Not sure if it a bug or by design. Seem that color does not work for :focus for QTextEdit
              Here they control the focus color with code

              http://stackoverflow.com/questions/32060606/can-a-stylesheet-change-text-color-in-a-qplaintextedit

              Could be a bug since it is strange that color does for for normal state.

              T Offline
              T Offline
              tarod.net
              wrote on last edited by
              #6

              @mrjj That was my solution to the question :-P

              I posted here looking for different opinions.

              "Individually, we are one drop. Together, we are an ocean."

              mrjjM 1 Reply Last reply
              0
              • T tarod.net

                @mrjj That was my solution to the question :-P

                I posted here looking for different opinions.

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @tarod.net
                Heh. Just saw the picture now...sorry.

                I searched the bug database but i see nothing that sounds like this.

                T 1 Reply Last reply
                1
                • mrjjM mrjj

                  @tarod.net
                  Heh. Just saw the picture now...sorry.

                  I searched the bug database but i see nothing that sounds like this.

                  T Offline
                  T Offline
                  tarod.net
                  wrote on last edited by
                  #8

                  @mrjj :D No problem at all!

                  Thanks anyway! :)

                  "Individually, we are one drop. Together, we are an ocean."

                  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