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. How set styleSheet for QLineEdit::placeholderText
Forum Updated to NodeBB v4.3 + New Features

How set styleSheet for QLineEdit::placeholderText

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 1.5k 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
    Mikeeeeee
    wrote on last edited by
    #1

    Hi!
    How set styleSheet for QLineEdit::placeholderText?

    JonBJ 1 Reply Last reply
    0
    • M Mikeeeeee

      Hi!
      How set styleSheet for QLineEdit::placeholderText?

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

      @Mikeeeeee
      There is no direct ability to affect the placeHolder text as a particular rule via stylesheet. If you stated what you want to do I could answer whether that can be done via stylesheet "trick" or whether you would have to it in code, but without knowing what you want to achieve I cannot.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Mikeeeeee
        wrote on last edited by
        #3

        I use the one styleSheet in several programs. I hope to make changes only to the styleSheet, because there is a QLineEdit in the code in different places.

        JonBJ 1 Reply Last reply
        0
        • M Mikeeeeee

          I use the one styleSheet in several programs. I hope to make changes only to the styleSheet, because there is a QLineEdit in the code in different places.

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

          @Mikeeeeee
          What is the point in my asking you "but without knowing what you want to achieve [i.e. what you want to do in the stylesheet rule] I cannot [tell you whether you can do it by stylesheet or have to do code]" if you don't address this in your reply?

          1 Reply Last reply
          0
          • M Offline
            M Offline
            Mikeeeeee
            wrote on last edited by
            #5

            I wont set styleSheet for all QLineEdit::placeholderText in my program.

            JonBJ 1 Reply Last reply
            0
            • M Mikeeeeee

              I wont set styleSheet for all QLineEdit::placeholderText in my program.

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

              @Mikeeeeee
              Oh for goodness sake. I already know that since you say it each time, I'm not stupid. I asked you what you want to be able to control about the placeholder text, in order to tell you whether/how it can be done by stylesheet.

              Since you refuse to answer I will just say

              QLineEdit[text=""] { color: red; }
              
              // and possibly you *may* need, I don't know
              connect(ui->lineEdit, &QLineEdit::textChanged, [=]{ style()->polish(ui->lineEdit); });
              

              and now I'm out of this question.

              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