NewCoder
NewCoder

Reputation: 23

Qml RightToLeft Alignment placeholderText

Greetings Dear Programmers ;)) Im Recently entered the world of Qt programming , I want Text PlaceHolder Align From right to left'm grateful for help Me enter image description here

Upvotes: 1

Views: 1249

Answers (1)

Neitsa
Neitsa

Reputation: 8166

Everything you need to know about Right to Left interfaces is explained in QML Right-to-left User Interfaces.

You need at least the following properties in your Text type:

horizontalAlignment: Text.AlignLeft
LayoutMirroring.enabled: true
width: parent.width // whatever you want here, but 'width' must be present.

A quick example:

import QtQuick 2.4
import QtQuick.Controls 1.4

ApplicationWindow {
    id: mainWindow

    width: 400
    height: 300

    Rectangle {
        id: rect1

        anchors.fill: parent        
        color: "lightsteelblue"        

        Rectangle {
            height : 20
            width : parent.width / 2
            anchors.centerIn: parent
            color : "white"

            Text {
                text: "هذا هو مجرد اختبار"
                horizontalAlignment: Text.AlignLeft
                LayoutMirroring.enabled: true
                width: parent.width
            }
        }
    }
}

Right to left text QML interface example

Upvotes: 3

Related Questions