Alignment issue when displaying Multi Line Text
Unsolved
Qt for MCUs
-
Hello,
I'm trying to display multi line text in a "ScrollView". But the displayed text in the device has alignment issue.Please find the qml code below:
import QtQuick 2.0 import QtQuick.Controls 2.3 ScrollView { clip: true anchors.fill: parent ScrollBar.vertical.policy: (message.height>650 || ulTnCpopup.height<640)?ScrollBar.AlwaysOn:ScrollBar.AsNeeded ScrollBar.horizontal.policy: ScrollBar.AsNeeded ScrollBar.vertical.interactive: true ScrollBar.horizontal.interactive: true contentHeight : message.height + 100 contentWidth : ulTnCpopup.width Rectangle{ id: poprect anchors.fill: parent Text { id: message width : ulTnCpopup.width - 30 wrapMode : Text.WordWrap anchors.leftMargin: poprect.width/30 anchors.topMargin: poprect.height/30 font.family: ulTnCpopup.fontfmly font.pointSize: (ulTnCpopup.width < 640) ? 8 : 12 color: "black" text: loginobj.webObj?applicationData.userlogin_readTnC_file(loginobj.tncTextFile):qsTr(" REGISTRATION ACCESS AND USE 1. This following sets out the terms and conditions on which you may use the content on business-standard.com website, business-standard.com's mobile browser site, Business Standard instore Applications and other digital publishing services (www.smartinvestor.in, www.bshindi.com and www.bsmotoring,com) owned by Business Standard Private Limited, all the services herein will be referred to as Business Standard Content Services. 2. We welcome users to register on our digital platforms. We offer the below mentioned registration services which may be subject to change in the future. All changes will be appended in the terms and conditions page and communicated to existing users by email. 3. All information received by us from your registration on business-standard.com or other digital products of Business Standard will be used by Business Standard in accordance with our Privacy Policy. Kindly read the below mentioned details.") } } }
I have also attached the image of how the text is displayed on the device.
Please help me to solve this alignment issue. -
It's not an alignment issue. You just hardcoded line breaks and leading whitespace in your text. Since the device has narrower display these line breaks just don't go in the same places as they do in the source qml.
Remove the line breaks from source and it will be ok.