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. QLineEdit and changing font for the "PlaceHolder" text

QLineEdit and changing font for the "PlaceHolder" text

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 8.8k Views 1 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.
  • R Offline
    R Offline
    ronM71
    wrote on last edited by
    #1

    Is there a stylesheet tag I can use to change the font/font size of the placeholder text (and just that, leave the normal edit text as is) in QLineEdit?

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      Form what I've seen, there is only one font property, which applies to the regular text as well as to the place holder text.

      To work around you can attach signal textChanged() to a slot, check if the QString is empty or not and set the font property accordingly. I don't know if that would cause some flicker, though.

      Anyways, you might add an improvement issue to the "bug tracker":http://bugreports.qt.nokia.com

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • G Offline
        G Offline
        giesbert
        wrote on last edited by
        #3

        One problem with Volker's proposal:

        If you do that in a signal, take care that changing the font changes the size hints and therefore might have impact on the layout.

        Nokia Certified Qt Specialist.
        Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

        1 Reply Last reply
        0
        • R Offline
          R Offline
          ronM71
          wrote on last edited by
          #4

          well, Volker is a mad scientist ;-)

          Thank you both.

          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