Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Right-To-Left alignment for placeholderText
Qt 6.11 is out! See what's new in the release blog

Right-To-Left alignment for placeholderText

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 398 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.
  • W Offline
    W Offline
    wumbologystudyofwumbo
    wrote on last edited by
    #1

    Re: Qt 6.5 Material design align for placeholderText and right to left languages
    Re: TextField placeHolder alignment when text align is center

    I'm encountering the same problem seen in the linked issues from almost a year ago. I've tried all the solutions posted online to have a right-aligned gap when selecting the text field, matching the alignment of the placeholder text.

    The solutions I've tried below have not resolved my issue:

    import QtQuick
    import QtQuick.Window
    import QtQuick.Controls
    import QtQuick.Controls.Material
    
    ApplicationWindow {
        visible: true
        width: 640
        height: 480
        title: "TextField Example"
    
        Material.theme: Material.Light
        Material.accent: Material.Blue
    
        TextField {
            id: textField
            width: 200
            height: 40
            placeholderText: "يسشبه"
            anchors.centerIn: parent
    
            horizontalAlignment: Text.AlignLeft
            LayoutMirroring.enabled: true
    
            Material.accent: Material.DeepPurple
        }
    }
    

    The end result is this, before and after focusing:
    fcd1e0b2-2cea-4a97-8d3d-2a9d6b717918-image.png
    ec39fbb9-5a34-496d-afc3-8a6f558ea941-image.png

    Is there a way to move the gap towards the right, matching the right-alignment of the placeholder text?

    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