Text.wordWrap set to Text.Wrap does not update Text.lineCount - qt

I am using Qt 5.13.1, based on Ubuntu Linux and I am trying to set the width of parent Rectangle in runtime, based on its children's texts object size(s):
import QtQuick 2.13
import QtQuick.Window 2.13
import QtQuick.Layouts 1.12
Window
{
id: mainWindow
property real ticketHeight: 0.00
function printHeight()
{
console.log("[QML]"+
" "+
"Layout height:"+
" "+
mainLayout.height);
console.log("[QML]"+
" "+
"ticketHeight:"+
" "+
mainWindow.ticketHeight);
console.log("[QML]"+
" "+
"Layout implicit height:"+
" "+
mainLayout.implicitHeight);
} // printHeight
visible: true
width: 560
height: ticketHeight
title: qsTr("Hello World")
ColumnLayout
{
id: mainLayout
anchors.fill: parent
Rectangle
{
id: mainRectangle
Layout.fillWidth: true
Layout.fillHeight: true
Layout.alignment: Qt.AlignHCenter|Qt.AlignVCenter
ColumnLayout
{
id: contentLayout
anchors.fill: parent
RowLayout
{
id: ticketTypeLayout
property bool heightAlreadyAdded: false
Layout.fillWidth: true
Layout.fillHeight: false
Layout.alignment: Qt.AlignHCenter|Qt.AlignVCenter
Text
{
id: ticketTypeTextValueEN
Layout.fillWidth: true
Layout.fillHeight: false
Layout.alignment: Qt.AlignLeft|Qt.AlignTop
font.pointSize: 32
text: "Adult"
onTextChanged:
{
if(ticketTypeLayout.heightAlreadyAdded===false)
{
mainWindow.ticketHeight+=ticketTypeTextValueEN.height+
ticketTypeLayout.spacing;
ticketTypeLayout.heightAlreadyAdded=true;
} // if
} // onTextChanged
Component.onCompleted:
{
mainWindow.ticketHeight+=ticketTypeTextValueEN.height+
ticketTypeLayout.spacing;
console.log("ticketTypeTextValueEN.height:"+
" "+
ticketTypeTextValueEN.height);
} // Component.onCompleted
} // ticketTypeTextValue (Text)
Text
{
id: ticketTypeTextValueAR
Layout.fillWidth: true
Layout.fillHeight: false
Layout.alignment: Qt.AlignRight|Qt.AlignTop
font.family: arabicFont.name
font.pointSize: 32
text: "بالغ"
} // ticketTypeTextValueAR (Text)
} // ticketTypeLayout (RowLayout)
RowLayout
{
id: ticketZoneLayout
property bool heightAlreadyAdded: false
Layout.fillWidth: true
Layout.fillHeight: false
Layout.alignment: Qt.AlignHCenter|Qt.AlignVCenter
Text
{
id: ticketZoneTextValueEN
Layout.fillWidth: true
Layout.fillHeight: false
Layout.alignment: Qt.AlignLeft|Qt.AlignTop
font.pointSize: 32
text: "Zone 1"
onTextChanged:
{
if(ticketZoneLayout.heightAlreadyAdded===false)
{
mainWindow.ticketHeight+=ticketZoneTextValueEN.height+
ticketZoneLayout.spacing;
ticketZoneLayout.heightAlreadyAdded=true;
} // if
} // onTextChanged
Component.onCompleted:
{
mainWindow.ticketHeight+=ticketZoneTextValueEN.height+
ticketZoneLayout.spacing;
console.log("ticketZoneTextValueEN.height:"+
" "+
ticketZoneTextValueEN.height);
} // Component.onCompleted
} // ticketZoneTextValueEN (Text)
Text
{
id: ticketZoneTextValueAR
Layout.fillWidth: true
Layout.fillHeight: false
Layout.alignment: Qt.AlignRight|Qt.AlignTop
font.family: arabicFont.name
font.pointSize: 32
text: "لمنطقة 1"
} // ticketZoneTextValueAR (Text)
} // ticketTypeLayout (RowLayout)
RowLayout
{
id: ticketRouteLayout
property bool heightAlreadyAdded: false
Layout.fillWidth: true
Layout.fillHeight: false
Layout.alignment: Qt.AlignHCenter|Qt.AlignVCenter
Text
{
id: ticketRouteTextValueEN
objectName: "ticketRouteTextValueEN"
Layout.fillWidth: true
Layout.fillHeight: false
Layout.alignment: Qt.AlignLeft|Qt.AlignTop
wrapMode: Text.Wrap
font.pointSize: 32
text: "Mwsalat bus station 1"
onTextChanged:
{
if(ticketRouteLayout.heightAlreadyAdded===false)
{
mainWindow.ticketHeight+=ticketRouteTextValueEN.height+
ticketRouteLayout.spacing;
ticketRouteLayout.heightAlreadyAdded=true;
console.log("ticketRouteTextValueEN.height:"+
" "+
ticketRouteTextValueEN.height+
" "+
"ticketRouteTextValueEN.lineCount:"+
" "+
ticketRouteTextValueEN.lineCount);
} // if
} // onTextChanged
Component.onCompleted:
{
ticketRouteTextValueEN.height
mainWindow.ticketHeight+=ticketRouteTextValueEN.height+
ticketRouteLayout.spacing;
console.log("ticketRouteTextValueEN.height:"+
" "+
ticketRouteTextValueEN.height+
" "+
"ticketRouteTextValueEN.lineCount:"+
" "+
ticketRouteTextValueEN.lineCount);
} // Component.onCompleted
} // ticketRouteTextValueEN (Text)
Text
{
id: ticketRouteTextValueAR
Layout.fillWidth: true
Layout.fillHeight: false
Layout.alignment: Qt.AlignRight|Qt.AlignTop
wrapMode: Text.Wrap
font.family: arabicFont.name
font.pointSize: 32
text: "محطة حافلات موصلات 1"
} // ticketRouteTextValueAR (Text)
} // ticketTypeLayout (RowLayout)
} // contentLayout (ColumnLayout)
} // mainRectangle
Component.onCompleted:
{
} // Component.onCompleted
onHeightChanged:
{
mainWindow.printHeight();
} // onHeightChanged
} // mainLayout (ColumnLayout)
FontLoader
{
id: arabicFont
source: "qrc:/fonts/NotoNaskhArabic-Regular.ttf"
} // arabicFont (FontLoader)
} // mainWindow (Window)
/*##^##
Designer {
D{i:0;height:237;width:560}
}
##^##*/
Now, everything works fine, however, last Text (id: ticketRouteTextValueEN) object is wrapped to 2 lines because of its lenght, which is ok. However, lineCount is not updated to value of 2 (two lines), but it returns 1 (1 line). Why and how should I count wrapped lines of QML Text?
ADDENDUM A:
I've change the objects holding info texts from Text to readonly TextEdit:
import QtQuick 2.13
import QtQuick.Window 2.13
import QtQuick.Layouts 1.12
Window
{
id: mainWindow
property real ticketHeight: 0.00
function printHeight()
{
console.log("[QML]"+
" "+
"Layout height:"+
" "+
mainLayout.height);
console.log("[QML]"+
" "+
"ticketHeight:"+
" "+
mainWindow.ticketHeight);
console.log("[QML]"+
" "+
"Layout implicit height:"+
" "+
mainLayout.implicitHeight);
} // printHeight
visible: true
width: 560
height: ticketHeight
title: qsTr("Hello World")
ColumnLayout
{
id: mainLayout
anchors.fill: parent
Rectangle
{
id: mainRectangle
Layout.fillWidth: true
Layout.fillHeight: true
Layout.alignment: Qt.AlignHCenter|Qt.AlignVCenter
ColumnLayout
{
id: contentLayout
anchors.fill: parent
RowLayout
{
id: ticketTypeLayout
Layout.fillWidth: true
Layout.fillHeight: false
Layout.alignment: Qt.AlignHCenter|Qt.AlignVCenter
TextEdit
{
id: ticketTypeTextValueEN
Layout.fillWidth: true
Layout.fillHeight: false
Layout.alignment: Qt.AlignLeft|Qt.AlignVCenter
readOnly: true
selectByKeyboard: false
selectByMouse: false
wrapMode: Text.Wrap
font.pointSize: 32
text: "Adult"
Component.onCompleted:
{
mainWindow.ticketHeight+=ticketTypeTextValueEN.lineCount*
ticketTypeTextValueEN.height+
ticketTypeLayout.spacing;
} // Component.onCompleted
} // ticketTypeTextValue (TextEdit)
TextEdit
{
id: ticketTypeTextValueAR
Layout.fillWidth: true
Layout.fillHeight: false
Layout.alignment: Qt.AlignRight|Qt.AlignVCenter
readOnly: true
selectByKeyboard: false
selectByMouse: false
wrapMode: Text.Wrap
font.family: arabicFont.name
font.pointSize: 32
text: "بالغ"
} // ticketTypeTextValueAR (TextEdit)
} // ticketTypeLayout (RowLayout)
RowLayout
{
id: ticketZoneLayout
Layout.fillWidth: true
Layout.fillHeight: false
Layout.alignment: Qt.AlignHCenter|Qt.AlignVCenter
TextEdit
{
id: ticketZoneTextValueEN
Layout.fillWidth: true
Layout.fillHeight: false
Layout.alignment: Qt.AlignLeft|Qt.AlignVCenter
readOnly: true
selectByKeyboard: false
selectByMouse: false
wrapMode: Text.Wrap
font.pointSize: 32
text: "Zone 1"
Component.onCompleted:
{
mainWindow.ticketHeight+=ticketZoneTextValueEN.lineCount*
ticketZoneTextValueEN.height/*+
ticketZoneLayout.spacing;*/
} // Component.onCompleted
} // ticketZoneTextValueEN (TextEdit)
TextEdit
{
id: ticketZoneTextValueAR
Layout.fillWidth: true
Layout.fillHeight: false
Layout.alignment: Qt.AlignRight|Qt.AlignVCenter
readOnly: true
selectByKeyboard: false
selectByMouse: false
wrapMode: Text.Wrap
font.family: arabicFont.name
font.pointSize: 32
text: "لمنطقة 1"
} // ticketZoneTextValueAR (TextEdit)
} // ticketTypeLayout (RowLayout)
RowLayout
{
id: ticketRouteLayout
Layout.fillWidth: true
Layout.fillHeight: false
Layout.alignment: Qt.AlignHCenter|Qt.AlignVCenter
TextEdit
{
id: ticketRouteTextValueEN
objectName: "ticketRouteTextValueEN"
Layout.fillWidth: true
Layout.fillHeight: false
Layout.alignment: Qt.AlignLeft|Qt.AlignVCenter
readOnly: true
selectByKeyboard: false
selectByMouse: false
wrapMode: Text.Wrap
font.pointSize: 32
text: "Mwsalat bus station 1"
Component.onCompleted:
{
mainWindow.ticketHeight+=ticketRouteTextValueEN.lineCount*
ticketRouteTextValueEN.height+
ticketRouteLayout.spacing;
} // Component.onCompleted
} // ticketRouteTextValueEN (TextEdit)
TextEdit
{
id: ticketRouteTextValueAR
Layout.fillWidth: true
Layout.fillHeight: false
Layout.alignment: Qt.AlignRight|Qt.AlignVCenter
readOnly: true
selectByKeyboard: false
selectByMouse: false
wrapMode: Text.Wrap
font.family: arabicFont.name
font.pointSize: 32
text: "محطة حافلات موصلات 1"
} // ticketRouteTextValueAR (TextEdit)
} // ticketTypeLayout (RowLayout)
} // contentLayout (ColumnLayout)
} // mainRectangle
onHeightChanged:
{
mainWindow.printHeight();
} // onHeightChanged
} // mainLayout (ColumnLayout)
FontLoader
{
id: arabicFont
source: "qrc:/fonts/NotoNaskhArabic-Regular.ttf"
} // arabicFont (FontLoader)
} // mainWindow (Window)
/*##^##
Designer {
D{i:0;height:237;width:560}
}
##^##*/
and now third TextEdit (id: ticketRouteTextValueEN is wrapped to 2 lines on screen:
however, ticketRouteTextValueEN.lineCount returns 5 (5 lines), which is not ok. It should return 2 and because of that the contents of Window is too scretched. Why is so?

Related

Unable to horizontally center items in ColumnLayout

Trying to center items in a ColumnLayout (nested into a StackLayout) but doesn't seem to work.
The StackLayout contains also a Canvas which I used to verify that Layout.fillWidth: true is working as expected. So I assume also the ColumnLayout is filling width (i.e. the problem is not the outer StackLayout), although I cannot understand what problem it has.
import QtQuick 2.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.3
Window {
id: mainWindow
width: 340
height: 380
visible: true
title: qsTr("Hello")
TabBar {
id: tabBar
width: parent.width
TabButton {text: "Layout"}
TabButton {text: "Canvas"}
}
StackLayout {
anchors.fill: parent
anchors.topMargin: tabBar.height
currentIndex: tabBar.currentIndex
ColumnLayout {
Layout.fillWidth: true
spacing: 10
Label {
Layout.alignment: Qt.AlignCenter
text: "Regular buttons:"
}
RowLayout {
Layout.alignment: Qt.AlignCenter
spacing: 10
Button {text: "Normal"}
Button {text: "Highlighted"; highlighted: true}
DelayButton {text: "Delay"}
}
Label {
Layout.alignment: Qt.AlignCenter
text: "Checkboxes:"
}
RowLayout {
Layout.alignment: Qt.AlignCenter
spacing: 10
CheckBox {text: "Checkbox 1"}
CheckBox {text: "Checkbox 2"}
}
Label {
Layout.alignment: Qt.AlignCenter
text: "Radiobuttons:"
}
RowLayout {
Layout.alignment: Qt.AlignCenter
spacing: 10
RadioButton {text: "Radiobutton 1"}
RadioButton {text: "Radiobutton 2"}
}
Label {
Layout.alignment: Qt.AlignCenter
text: "Miscellaneous:"
}
Switch {
Layout.alignment: Qt.AlignCenter
text: "Switch"
}
}
Canvas {
Layout.fillWidth: true
Layout.fillHeight: true
Layout.maximumHeight: 100
Layout.margins: 2
onPaint: {
var ctx = getContext('2d')
ctx.reset()
ctx.strokeStyle = 'black'
ctx.lineWidth = 2
ctx.beginPath()
ctx.moveTo(0, 0)
ctx.lineTo(width, height)
ctx.stroke()
ctx.beginPath()
ctx.moveTo(width, 0)
ctx.lineTo(0, height)
ctx.stroke()
}
}
}
}

QML wrap buttons in narrow vs wide layout

How can i make the buttons wrap when a dialog window is resized to be narrow by the user? Currently they are just cutoff.
QML
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.0
Frame {
width: parent.width
height: parent.height
ColumnLayout {
width: implicitWidth
spacing: 20
anchors.left: parent.left
anchors.right: parent.right
Layout.alignment: Qt.AlignTop
// Config
ColumnLayout {
Layout.fillWidth: true
spacing: 2
Label {
text: "Config"
font.bold: true
}
TextField {
readOnly: true
placeholderText: qsTr("Path to config.json file (C:\\desktop\\config.txt)")
Layout.fillWidth: true
}
RowLayout {
Layout.fillWidth: true
Layout.alignment: Qt.AlignRight
Button {
text: qsTr("Edit")
implicitWidth: implicitHeight
}
Button {
text: qsTr("Browse")
implicitWidth: implicitHeight
}
Button {
text: qsTr("Clear")
implicitWidth: implicitHeight
}
Button {
text: qsTr("Find")
implicitWidth: implicitHeight
}
}
}
// File
ColumnLayout {
Layout.fillWidth: true
spacing: 2
Label {
text: "File"
font.bold: true
}
TextField {
readOnly: true
placeholderText: qsTr("Path to config.json file (C:\\desktop\\file.txt)")
Layout.fillWidth: true
}
RowLayout {
Layout.fillWidth: true
Layout.alignment: Qt.AlignRight
Button {
text: qsTr("Clear")
implicitWidth: implicitHeight
}
Button {
text: qsTr("Find")
implicitWidth: implicitHeight
}
}
}
}
}
main.qml
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.0
ApplicationWindow {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
Page1 {
anchors.centerIn: parent
}
}
You have to use Flow instead of RowLayout:
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.0
Frame {
width: parent.width
height: parent.height
ColumnLayout {
width: implicitWidth
spacing: 20
anchors.left: parent.left
anchors.right: parent.right
Layout.alignment: Qt.AlignTop
// Config
ColumnLayout {
Layout.fillWidth: true
spacing: 2
Label {
text: "Config"
font.bold: true
}
TextField {
readOnly: true
placeholderText: qsTr("Path to config.json file (C:\\desktop\\config.txt)")
Layout.fillWidth: true
}
Flow {
Layout.fillWidth: true
layoutDirection: Qt.RightToLeft
Button {
text: qsTr("Edit")
implicitWidth: implicitHeight
}
Button {
text: qsTr("Browse")
implicitWidth: implicitHeight
}
Button {
text: qsTr("Clear")
implicitWidth: implicitHeight
}
Button {
text: qsTr("Find")
implicitWidth: implicitHeight
}
}
}
// File
ColumnLayout {
Layout.fillWidth: true
spacing: 2
Label {
text: "File"
font.bold: true
}
TextField {
readOnly: true
placeholderText: qsTr("Path to config.json file (C:\\desktop\\file.txt)")
Layout.fillWidth: true
}
Flow {
Layout.fillWidth: true
layoutDirection: Qt.RightToLeft
Button {
text: qsTr("Clear")
implicitWidth: implicitHeight
}
Button {
text: qsTr("Find")
implicitWidth: implicitHeight
}
}
}
}
}

QML Wrap delegate inside Rectangle

How can i wrap a custom delegate i made for my listview, inside of a rectangle in order to customize the background and add corner radius to my listview items? Currently i have what is shown on the left in the image below. My goal is the listview on the right, while maintaining the current TextWrapping and whatnot seen in the current solution.
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.3
Frame {
anchors.centerIn: parent
anchors.fill: parent
ListView {
implicitWidth: parent.width
implicitHeight: parent.height
clip: true
spacing: 12
model: ListModel {
ListElement {
description: "Wash the car this could be a really long message with some multiline support we will see how it works."
}
ListElement {
description: "Fix the car"
}
ListElement {
description: "Sell the car"
}
ListElement {
description: "Wash the car this could be a really long message with some multiline support we will see how it works. This should word wrap quite a lot of times."
}
ListElement {
description: "Fix the car"
}
ListElement {
description: "Sell the car"
}
ListElement {
description: "Wash the car"
}
ListElement {
description: "Fix the car"
}
ListElement {
description: "Sell the car"
}
}
delegate: RowLayout {
width: parent.width
Rectangle {
id: newsicon
width: 16
height: 16
color: "steelblue"
Layout.alignment: Qt.AlignTop
}
ColumnLayout {
Layout.fillWidth: true
spacing: 4
TextArea {
selectByMouse: true
Layout.fillWidth: true
Layout.alignment: Qt.AlignTop
id: messageText
text: model.description
wrapMode: TextEdit.WordWrap
readOnly: true
topPadding: 0
bottomPadding: 0
background: null
}
Label {
id: dateText
text: "Dec 20, 2019"
font.italic: true
font.pointSize: 8
color: "grey"
}
}
}
ScrollBar.vertical: ScrollBar {
active: true
}
}
}
Essentially all you need to do is encapsulate your delegate's RowLayout in a Rectangle that acts as the background color:
delegate: Rectangle {
id: delegateBackground
color:"lightgreen"
radius: 10
width: parent.width
height: contentContainer.height + 20
Item {
id: contentContainer
width: parent.width - 20
height: column.height
anchors.centerIn: delegateBackground
RowLayout {
width: parent.width
Rectangle {
id: newsicon
width: 16
height: 16
color: "steelblue"
Layout.alignment: Qt.AlignTop
}
ColumnLayout {
id: column
Layout.fillWidth: true
spacing: 4
TextEdit {
selectByMouse: true
Layout.fillWidth: true
Layout.alignment: Qt.AlignTop
id: messageText
text: model.description
wrapMode: TextEdit.WordWrap
readOnly: true
}
Label {
id: dateText
text: "Dec 20, 2019"
font.italic: true
font.pointSize: 8
color: "grey"
}
}
}
}
}
You'll notice that I also added an invisible Item as a container to hold the RowLayout inside the background so that there are margins around the edges as you have indicated in your graphic.

How can a Tab or Enter Key jump a Control in QML

What i want to do here is to prevent the tab and enter to jump the focus to a specific control but go to the next.
So for example lets say i have 3 sequencial TextField
i'm focused on the first TextField now i press tab and instead of jumping to the second TextField the focus goes to the third TextField.
A full code example:
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
ApplicationWindow {
id: window
title: "Stack"
visible: true
width: 1400
Page {
id: page
anchors.fill: parent
property int responsiveWidth: 1000
property int maximumWidth: 900
ScrollView {
id:configScroll
anchors.fill: parent
function scrollToY(y) {
configScroll.flickableItem.contentY = y-30
}
GridLayout {
columns: 2
Keys.onPressed: {
if(event.key==Qt.Key_Return)
for (var i = 0; i < children.length; ++i)
if (children[i].focus) {
children[i].nextItemInFocusChain().forceActiveFocus()
break
}
}
width: page.width > page.responsiveWidth ? page.maximumWidth : page.width
anchors.top: parent.top
anchors.left: parent.left
anchors.leftMargin: page.width > page.responsiveWidth ? (page.width - childrenRect.width)/2 : 10
anchors.rightMargin: page.width > page.responsiveWidth ? 0 : 10
Label {
text: "Company Name"
color: "red"
Layout.fillWidth: true
}
TextField {
objectName: "company_name"
font.bold: true
Layout.fillWidth: true
Layout.rightMargin: 10
onFocusChanged: if(focus) { configScroll.scrollToY(y); }
}
Label {
text: "tab or enter passes this TextField"
color: "red"
Layout.fillWidth: true
}
TextField {
objectName: "company_name2"
font.bold: true
Layout.fillWidth: true
Layout.rightMargin: 10
onFocusChanged: if(focus) { configScroll.scrollToY(y); }
}
Label {
text: "label"
color: "red"
Layout.fillWidth: true
}
TextField {
objectName: "company_name"
font.bold: true
Layout.fillWidth: true
Layout.rightMargin: 10
onFocusChanged: if(focus) { configScroll.scrollToY(y); }
}
}
}
}
}
You can use the QML Type KeyNavigation to setup custom navigation, take a look at the documentation: KeyNavigation QML Type
You can set the KeyNavigation.tab property to navigate to a specific id like this:
TextField {
id: field1
objectName: "company_name"
font.bold: true
Layout.fillWidth: true
Layout.rightMargin: 10
onFocusChanged: if(focus) { configScroll.scrollToY(y); }
KeyNavigation.tab: field3
}
For navigation with enter-key here is a solution for this specific situation:
children[i].nextItemInFocusChain().nextItemInFocusChain().forceActiveFocus()

Why when I open Dialog it will disable all qml item

I have a custom dialog in my qt quick application,when I click a button to open the it,I will got the below error:
QQuickItem::stackBefore: Cannot stack before 0x6d4bd6e220, which must be a sibling
After this error,All qml Items on the main.qml page will disable and don't work and don't interact width mouse.
main.qml
onClicked: {
var c= userPorfileCom.createObject(mainWindow);
c.open();
}
Component{
id:userPorfileCom
UserProfilePage{
id: userProfilePage
}
}
UserProfilePage.qml
JooyaDialog{
id: root
IranSanseFontLoader{
id: fl
}
onVisibleChanged: {
if(visible)
{
up.getProfile();
}
}
header: ToolBar{
id: tbheader
Material.primary: "white"
Material.elevation:1
RowLayout{
anchors.fill: parent
ToolButton{
contentItem: Image {
source: "/images/close.png"
fillMode: Image.Pad
horizontalAlignment: Image.AlignHCenter
verticalAlignment: Image.AlignVCenter
}
onClicked: {
close();
}
}
}
}
signal profileHasChanged;
UserProfile{
id: up
name: tfName.text
lastName: tfLastName.text
gender: cbxGender.currentIndex==0
email: tfEmail.text
phoneNumber: tfMobile.text
onProfileChanged: {
loginManager.getUserInfo();
}
onMessageChanged: {
showMessage(message);
}
onIsProcessingChanged: {
console.log("progr in user info");
bipi.visible=isProcessing;
}
}
title: qsTr("ویرایش اطلاعات کاربری")
rootWidth:mainWindow.width
rootHeight: mainWindow.height
contentHeight:rootHeight/2
font{
family: fl.name
pixelSize: 18
bold: true
}
//================================================
Flickable{
id: flickable
contentHeight: mainClm.implicitHeight+100
flickableDirection: Flickable.AutoFlickIfNeeded
clip: true
anchors.fill: parent
Pane{
anchors.fill:parent
Material.accent: Material.Pink
ColumnLayout{
id: mainClm
anchors.fill: parent
JooyaTextField{
id: tfName
placeholderText: "نام"
Layout.fillWidth: true
text: up.name
}
JooyaTextField{
id: tfLastName
placeholderText: "نام خانوادگی"
Layout.fillWidth: true
text: up.lastName
}
ComboBox {
id: cbxGender
model: ["مرد", "زن"]
anchors.horizontalCenter: parent.horizontalCenter
Layout.fillWidth: true
currentIndex:
{
if(up.gender)
{
return 0// "مرد"
}
else
{
return 1//"زن"
}
}
}
JooyaTextField{
id: tfMobile
placeholderText: "شماره موبایل"
Layout.fillWidth: true
text: up.phoneNumber
inputMethodHints: Qt.ImhDigitsOnly
}
JooyaTextField{
id: tfEmail
placeholderText: "ایمیل"
Layout.fillWidth: true
text: up.email
}
JooyaButton{
id: btnSave
text: "ذخیره"
Layout.fillWidth: true
highlighted: true
onClicked: {
up.saveProfile();
}
}
}
}
ScrollBar.vertical: ScrollBar{
width: 3
}
}
ProgressIndicator{
id: bipi
}
}
If two items are in the tab focus chain while not being siblings it won't work,
meaning that what is in the tab focus chain must have the same immediate parent.
http://doc.qt.io/qt-5/qquickitem.html#stackBefore

Resources