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 20 Aug 2015, 01:15 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
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 20 Aug 2015, 08:16 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 20 Aug 2015, 14:34
      0
      • M mrjj
        20 Aug 2015, 08:16

        @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 20 Aug 2015, 14:34 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."

        M 1 Reply Last reply 20 Aug 2015, 15:10
        0
        • C Offline
          C Offline
          charlycoste
          wrote on 20 Aug 2015, 14:46 last edited by charlycoste
          #4
          This post is deleted!
          1 Reply Last reply
          0
          • T tarod.net
            20 Aug 2015, 14:34

            @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?

            M Offline
            M Offline
            mrjj
            Lifetime Qt Champion
            wrote on 20 Aug 2015, 15:10 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 20 Aug 2015, 18:23
            0
            • M mrjj
              20 Aug 2015, 15:10

              @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 20 Aug 2015, 18:23 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."

              M 1 Reply Last reply 20 Aug 2015, 19:00
              0
              • T tarod.net
                20 Aug 2015, 18:23

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

                I posted here looking for different opinions.

                M Offline
                M Offline
                mrjj
                Lifetime Qt Champion
                wrote on 20 Aug 2015, 19:00 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 20 Aug 2015, 22:32
                1
                • M mrjj
                  20 Aug 2015, 19:00

                  @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 20 Aug 2015, 22:32 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

                  8/8

                  20 Aug 2015, 22:32

                  • Login

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