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. Make the placeholder text in QLineEdit slide up on focus

Make the placeholder text in QLineEdit slide up on focus

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 704 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.
  • D Offline
    D Offline
    Donnie
    wrote on 23 May 2022, 13:35 last edited by Donnie
    #1

    I've found the solutions using only CSS, but it seems like Qt doesn't support the syntax they use.

    https://www.youtube.com/watch?v=IE3U5icPv0g
    https://stackoverflow.com/questions/35942247/how-to-move-placeholder-to-top-on-focus-and-while-typing
    https://www.sitepoint.com/community/t/placeholder-floating-label-should-slide-up-issue/294213/3

    What could be the possible alternative?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 23 May 2022, 15:11 last edited by mrjj
      #2

      Hi
      Qt does not support full CSS. its a small subset.

      You can make your own custom control that does it using custom painting of the place holder text. maybe use QAnimation for the sliding.

      Alternatively, you can reuse this one ( the Text Field)

      https://github.com/laserpants/qt-material-widgets

      alt text

      D 1 Reply Last reply 23 May 2022, 16:37
      1
      • M mrjj
        23 May 2022, 15:11

        Hi
        Qt does not support full CSS. its a small subset.

        You can make your own custom control that does it using custom painting of the place holder text. maybe use QAnimation for the sliding.

        Alternatively, you can reuse this one ( the Text Field)

        https://github.com/laserpants/qt-material-widgets

        alt text

        D Offline
        D Offline
        Donnie
        wrote on 23 May 2022, 16:37 last edited by
        #3

        @mrjj Thanks! Is there a way I can add it as a library to my CMake project?

        M 1 Reply Last reply 23 May 2022, 19:15
        0
        • D Donnie
          23 May 2022, 16:37

          @mrjj Thanks! Is there a way I can add it as a library to my CMake project?

          M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 23 May 2022, 19:15 last edited by mrjj
          #4

          @Donnie
          Hi
          I dont think its prepared to build as a library but should not be impossible to build it as such and link it to your app.

          1 Reply Last reply
          0

          1/4

          23 May 2022, 13:35

          • Login

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