PDA

View Full Version : table right to left



ravandi
29th November 2015, 08:55
hello
I want my table right to left .
This is my table.
11545
I want to be like this.
11546
Thank you

anda_skoa
29th November 2015, 14:12
Which value do you get from Qt.application.layoutDirection?

Cheers,
_

ravandi
29th November 2015, 17:00
my 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: "فامیلی سوم" }
}
}

ravandi
1st December 2015, 08:41
under codes :


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
}

}
}
}
}


After the run
11547

ravandi
4th December 2015, 12:01
The problem was solved But does not change the height of the row.

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
}
}
}
}
}//window

11558
rows height of under header.
11559

ravandi
4th December 2015, 16:42
The problem was solved.


rowDelegate: Text{
height: 30
}