hello
I want my table right to left .
This is my table.
table4.png
I want to be like this.
table3.png
Thank you
hello
I want my table right to left .
This is my table.
table4.png
I want to be like this.
table3.png
Thank you
Which value do you get from Qt.application.layoutDirection?
Cheers,
_
my code:
Qt Code:
import QtQuick 2.0 import QtQuick.Controls 1.2 import QtQml.Models 2.1 Rectangle { id: root width: 205 anchors.right: parent.right TableView { id: tableROList TableViewColumn{ role: "name" ; title: "نام" ; width: 100 } TableViewColumn{ role: "lastname" ; title: "نام خانوادگی" ; width: 100 } model: modelROList width: root.width } ListModel { id: modelROList ListElement{ name: "اسم اول" ; lastname: "Ùاملی اول" } ListElement{ name: "اسم دوم" ; lastname: "Ùامیلی دوم" } ListElement{ name: "اسم سوم" ; lastname: "Ùامیلی سوم" } } }To copy to clipboard, switch view to plain text mode
under codes :
Qt Code:
import QtQuick 2.0 import QtQuick.Controls 1.0 Rectangle { id:kol width: 360 height: 360 Rectangle { id:mos width: 360 height: 360 anchors.centerIn: parent ListModel { id: dataModel ListElement { color: "آبی" text: "اول" } ListElement { color: "قرمز" text: "دوم" } ListElement { color: "سبز" text: "سوم" } ListElement { color: "زرد" text: "چهارم" } } TableView { id: view model: dataModel anchors.fill: parent TableViewColumn { width: 100 title: "رنگ" role: "color" } TableViewColumn { width: 100 title: "متن" role: "text" } itemDelegate: Item { Text { anchors.right: parent.right // renderType: Text.NativeRendering text: styleData.value } } } } }To copy to clipboard, switch view to plain text mode
After the run
table5.png
The problem was solved But does not change the height of the row.
Qt Code:
import QtQuick 2.3 import QtQuick.Window 2.2 import QtQuick.Controls 1.2 import QtQuick.Controls.Styles 1.2 Window { id: win width: 400 height: 360 visible: true Rectangle { id:mos width: 400 height: 360 anchors.centerIn: parent ListModel { id: libraryModel ListElement { name: "نام اول" lastname: "Ùامیلی اول" } ListElement { name: "نام دوم" lastname: "Ùامیلی دوم" } ListElement { name: "نام سوم" lastname: "Ùامیلی سوم" } } TableView { width: mos.width TableViewColumn { role: "name" title: "نام" } TableViewColumn { role: "lastname" title: "Ùامیلی" } model: libraryModel style: TableViewStyle { headerDelegate: Rectangle { height: 30 border.width: 1 color: "lightsteelblue" Text { id: textItem anchors.fill: parent verticalAlignment: Text.AlignVCenter //horizontalAlignment: styleData.textAlignment horizontalAlignment: Text.AlignRight anchors.rightMargin: 7 text: styleData.value //elide: Text.ElideRight //color: textColor //renderType: Text.NativeRendering } Rectangle { anchors.right: parent.right anchors.top: parent.top anchors.bottom: parent.bottom anchors.bottomMargin: 1 anchors.topMargin: 1 width: 1 color: "#ccc" } } } itemDelegate: Item { Text { anchors.rightMargin: 7 anchors.right: parent.right // renderType: Text.NativeRendering text: styleData.value } } } } }//windowTo copy to clipboard, switch view to plain text mode
ertefa.png
rows height of under header.
height.png
The problem was solved.
Qt Code:
rowDelegate: Text{ height: 30 }To copy to clipboard, switch view to plain text mode
Bookmarks