How to make a rectangle border in rowdelegate (TableVIew) - qt

So the subject is basicaly what I'm asking.
TableViewStyle
{
Component {
id: header
Rectangle {
anchors.topMargin: 5
height: 22
anchors.verticalCenter: parent.verticalCenter
color: "#6d6e70"
Text {
anchors.fill: parent
anchors.verticalCenter: parent.verticalCenter
horizontalAlignment: Text.Center
verticalAlignment: Text.AlignVCenter
text: styleData.value
color: "white"
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: "black"
}
}
}
Component {
id: defaultRow
Rectangle {
height: 30
property color selectedColor: styleData.row % 2 ? "#fbfbfc" : "white"
color: styleData.selected ? "#999" : selectedColor
Rectangle {
width: 1
color: "black"
}
}
}
Component {
id: largeRow
Rectangle {
height: 120
property color selectedColor: styleData.row % 2 ? "#fbfbfc" : "white"
color: styleData.selected ? "#999" : selectedColor
Rectangle {
width: 1
color: "black"
}
}
}
Component {
id: imageDelegate
Image {
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
fillMode: Image.PreserveAspectFit
cache: true;
asynchronous: true;
source: styleData.value
}
}
}
For headers there is a border with width 1 and black color, but for rows it isn't working even if I use the saming parametrs. How do i generate borders for rowdelegate?

You can hack something like that:
Rectangle {
color: "black"
Rectangle {
anchors.fill: parent
anchors.rightMargin: 1
color: "white"
}
}
(don't assume that I've understood the question)
update
(Thanks to Mitch for data example)
You want something like that for the column borders?
import QtQuick 2.3
import QtQuick.Window 2.2
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2
Window {
id: win
width: 360
height: 360
visible: true
ListModel {
id: libraryModel
ListElement {
title: "A Masterpiece"
author: "Gabriel"
}
ListElement {
title: "Brilliance"
author: "Jens"
}
ListElement {
title: "Outstanding"
author: "Frederik"
}
}
TableView {
anchors.fill: parent
TableViewColumn {
role: "title"
title: "Title"
width: 100
}
TableViewColumn {
role: "author"
title: "Author"
width: 200
}
model: libraryModel
style: TableViewStyle {
itemDelegate: Rectangle {
width: 200
height: 200
color: "black"
Rectangle {
anchors.fill: parent
anchors.rightMargin: 1
color: "white"
Text {
id: textItem
anchors.fill: parent
verticalAlignment: Text.AlignVCenter
horizontalAlignment: styleData.textAlignment
anchors.leftMargin: 12
text: styleData.value
elide: Text.ElideRight
color: textColor
renderType: Text.NativeRendering
}
}
}
}
}
}

Related

Dynamic height of tableviewcolumn according to text length

hello I have the following problem I am working with qt quick control 1.4 because the tableview of 2.15 does not adapt correctly as I would like; the table overflows in height and my question is the following can you make a dynamic height and that can be adding say 15 to the default height
example: the default height is 50
can you add 15 or 10 depending on the length of the text?
import QtQuick 2.15
import QtQuick.Window 2.15
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import QtQuick.Window 2.2
ApplicationWindow {
title: qsTr("TableView example")
id: root
width: 500
height: 400
visible: true
//[!addrowdata]
/////////////////////////////
ListModel {
id: tablemode
ListElement {
number: "1"
elevation_Max:"90000"
elevation_Min:"50"
length:"52-73\n122-163\n200-264\n280-317"
depth:"8636-8900"
}
ListElement {
number: "2"
elevation_Max:"8000"
elevation_Min:"21"
length:"0-57\n119-166\n206-264"
depth:"12700-13462"
}
}
TableView{
id :tableView
anchors.fill: parent
alternatingRowColors : false
TableViewColumn {
role: "number"
title: "Number"
width: tableView.viewport.width/tableView.columnCount
horizontalAlignment: Text.AlignHCenter
}
TableViewColumn {
role: "elevation_Max"
title: "Elevation Max"
width: tableView.viewport.width/tableView.columnCount
horizontalAlignment: Text.AlignHCenter
}
TableViewColumn {
role: "elevation_Min"
title: "Elevation Min"
width: tableView.viewport.width/tableView.columnCount
horizontalAlignment: Text.AlignHCenter
}
TableViewColumn {
role: "length"
title: "Length"
width: tableView.viewport.width/tableView.columnCount
horizontalAlignment: Text.AlignHCenter
}
TableViewColumn {
role: "depth"
title: "Depth"
width: tableView.viewport.width/tableView.columnCount
horizontalAlignment: Text.AlignHCenter
}
model: tablemode
//Custom header proxy
headerDelegate:Rectangle{
color: "#0A1B2D"
width: 100;
height: 40
border.color: "white"
Text{
anchors.centerIn : parent
text: styleData.value
color: "#ffffff"
font.pixelSize: 15
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
}
//The line agent can modify the line height information
rowDelegate: Rectangle {
height: 50 // problem text protrudes out of the row
color: "#052641"
anchors.leftMargin: 2
}
itemDelegate: Rectangle{
id: rectangle
border.color: "white"
border.width: 1
color : styleData.selected ? "#white": "#394755" //Extern
Text {
anchors.centerIn : parent
anchors.leftMargin: 5
color : "#ffffff"
width: parent.width
height: parent.height
text: styleData.value
font.pixelSize: 14
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
wrapMode: Text.WordWrap
}
}
style: TableViewStyle{
textColor: "white"
highlightedTextColor: "#00CCFE" //Selected color
backgroundColor : "#f5f5f5"
frame: Rectangle {
border{
color: "#00000000" // color of the border
}
}
handle: Rectangle {
implicitWidth: 10
implicitHeight: 10
radius:20
color: "#052641"//indicador en movimiento
border.color:"#00000000"
}
scrollBarBackground: Rectangle {
implicitWidth: 10
implicitHeight: 10
color: "#00000000"
border.color:"#00000000"
}
decrementControl: Rectangle {
implicitWidth: 10
implicitHeight: 10
color: "#00000000"
border.color:"#00000000"
}
incrementControl: Rectangle {
implicitWidth: 10
implicitHeight: 10
color: "#00000000"
border.color:"#00000000"
}
}
}
}
I have looked for different solutions and none of them fits the text, if you could help me I have been struggling with this for days I would appreciate it in advance.
I've added a property maxSize and modified it every time the contentHeight of one cell changes to something bigger than maxSize.
import QtQuick 2.15
import QtQuick.Window 2.15
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import QtQuick.Window 2.2
ApplicationWindow {
title: qsTr("TableView example")
id: root
width: 500
height: 400
visible: true
property int maxHeight: 50
//[!addrowdata]
/////////////////////////////
ListModel {
id: tablemode
ListElement {
number: "1"
elevation_Max:"90000"
elevation_Min:"50"
length:"52-73\n122-163\n200-264\n280-317"
depth:"8636-8900"
}
ListElement {
number: "2"
elevation_Max:"8000"
elevation_Min:"21"
length:"0-57\n119-166\n206-264"
depth:"12700-13462"
}
}
TableView{
id :tableView
anchors.fill: parent
alternatingRowColors : false
TableViewColumn {
role: "number"
title: "Number"
width: tableView.viewport.width/tableView.columnCount
horizontalAlignment: Text.AlignHCenter
}
TableViewColumn {
role: "elevation_Max"
title: "Elevation Max"
width: tableView.viewport.width/tableView.columnCount
horizontalAlignment: Text.AlignHCenter
}
TableViewColumn {
role: "elevation_Min"
title: "Elevation Min"
width: tableView.viewport.width/tableView.columnCount
horizontalAlignment: Text.AlignHCenter
}
TableViewColumn {
role: "length"
title: "Length"
width: tableView.viewport.width/tableView.columnCount
horizontalAlignment: Text.AlignHCenter
}
TableViewColumn {
role: "depth"
title: "Depth"
width: tableView.viewport.width/tableView.columnCount
horizontalAlignment: Text.AlignHCenter
}
model: tablemode
//Custom header proxy
headerDelegate:Rectangle{
color: "#0A1B2D"
width: 100;
height: 40
border.color: "white"
Text{
anchors.centerIn : parent
text: styleData.value
color: "#ffffff"
font.pixelSize: 15
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
}
//The line agent can modify the line height information
rowDelegate: Rectangle {
height: maxHeight // problem text protrudes out of the row
color: "#052641"
anchors.leftMargin: 2
}
itemDelegate: Rectangle{
id: rectangle
border.color: "white"
border.width: 1
color : styleData.selected ? "#white": "#394755" //Extern
Text {
anchors.centerIn : parent
anchors.leftMargin: 5
color : "#ffffff"
width: parent.width
height: parent.height
text: styleData.value
font.pixelSize: 14
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
wrapMode: Text.WordWrap
onContentHeightChanged: {
if (contentHeight > maxHeight) maxHeight = contentHeight;
}
}
}
style: TableViewStyle{
textColor: "white"
highlightedTextColor: "#00CCFE" //Selected color
backgroundColor : "#f5f5f5"
frame: Rectangle {
border{
color: "#00000000" // color of the border
}
}
handle: Rectangle {
implicitWidth: 10
implicitHeight: 10
radius:20
color: "#052641"//indicador en movimiento
border.color:"#00000000"
}
scrollBarBackground: Rectangle {
implicitWidth: 10
implicitHeight: 10
color: "#00000000"
border.color:"#00000000"
}
decrementControl: Rectangle {
implicitWidth: 10
implicitHeight: 10
color: "#00000000"
border.color:"#00000000"
}
incrementControl: Rectangle {
implicitWidth: 10
implicitHeight: 10
color: "#00000000"
border.color:"#00000000"
}
}
}
}
The result of this hacky solution would look like this:

How to prevent the contents to appear below the height that is on transition on qml?

To explain better the question, im going to use images, but in summary i'll have a component that will transition the heightfrom 0 to an height that is correspondent to the height of it's childs. that problem is that all the child itemswill appear the moment the transition starts
To illustrate, the height of the child div of Panel 1is 0:
then i click, the transition is supposed to take 5000ms and this happens:
at the end of the 5000ms i have this:
The code i've used for this example is this:
main.qml
import QtQuick 2.7
import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.3
import QtQuick.Window 2.3
ApplicationWindow {
visible: true
width: 640
height: 200
title: qsTr("Tabbars")
Item{
id:item
anchors.fill:parent
ScrollView{
anchors.fill:parent
Column {
width:item.width
PanelItem {
id:panel1
title: "Panel 1"
width:parent.width
content: Item {
property string title: "teste"
height: configContent.implicitHeight
width: configContent.implicitWidth
ColumnLayout{
id:configContent
anchors.topMargin: 10
anchors.bottomMargin: 10
anchors.fill:parent
TextField {
id: companyNameText1
placeholderText: qsTr("Company name")
Layout.fillWidth: true
selectByMouse: true
}
ComboBox {
id: languagesComboBox1
textRole: "text"
objectName: "language"
Layout.fillWidth: true
model: ListModel {
ListElement {text: QT_TR_NOOP("English"); oid: 0}
ListElement {text: QT_TR_NOOP("Portuguese"); oid: 1}
ListElement {text: QT_TR_NOOP("Spanish"); oid: 2}
ListElement {text: QT_TR_NOOP("Italian"); oid: 3}
ListElement {text: QT_TR_NOOP("French"); oid: 4}
ListElement {text: QT_TR_NOOP("Portuguese(Brasil)"); oid: 5}
}
}
ComboBox {
id: devSndrModeComboBox1
textRole: "text"
objectName: "test_dev_sndr_mode"
Layout.fillWidth: true
model: ListModel {
Component.onCompleted: {
append({ text: QT_TR_NOOP("None"), oid: 0 })
append({ text: QT_TR_NOOP("Subpanel"), oid: 1 })
append({ text: QT_TR_NOOP("All"), oid: 2 })
}
}
}
}
}
}
PanelItem {
id:panel2
title: "Panel 2"
width:parent.width
content: Item {
property string title: "teste"
height: configContent2.implicitHeight
width: configContent2.implicitWidth
ColumnLayout{
id:configContent2
anchors.fill:parent
ComboBox {
id: sndrModeComboBox1
textRole: "text"
Layout.fillWidth: true
model: ListModel {
Component.onCompleted: {
append({ text: QT_TR_NOOP("Preset"), oid: 0 })
append({ text: QT_TR_NOOP("Programmed"), oid: 1 })
}
}
}
}
}
}
}
}
}
}
and PanelItem.qml
import QtQuick 2.7
import QtQuick.Layouts 1.2
Item {
id: root
property Component content
property string title: "panel"
property bool isSelected: false
height: container.height + bar.height
Rectangle{
id: bar
anchors {
top: parent.top
left: parent.left
right: parent.right
}
height: 30
color: root.isSelected ? "#81BEF7" : "#CEECF5"
Text {
anchors.fill: parent
anchors.margins: 10
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
text: root.title
}
Text {
anchors{
right: parent.right
top: parent.top
bottom: parent.bottom
margins: 10
}
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: "^"
rotation: root.isSelected ? "180" : 0
}
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: isSelected = !isSelected
}
}
Rectangle{
id: container
anchors.top: bar.bottom
anchors.left: parent.left
anchors.right: parent.right
height: loader.item && isSelected ? loader.item.height : 0
Loader {
id: loader
visible: isSelected
sourceComponent: content
anchors.top: container.top
}
Behavior on height {
PropertyAnimation { duration: 5000 }
}
}
}
I hope i explained well the problem.
What would be the best way to solve this?

plus button under listview

I can create "+" (plus) button under all listview items.
This button will add a new item.
I can place it under all exsisting items. But ideály as a part as list.Because of scrolling, scrollbars and other standard listview functions. If listview will be not fill all available page size, scrolls will be ended in the middle of the screan etc...
I tested counting onpaint signal or something like this, but have no success. Because signal for one row goint more than one times, counting is mismatched and button is one time in seccond row, one time below third, sometimes is missing etc...
Example image:
Source code:
import QtQuick 2.10
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.2
import QtGraphicalEffects 1.0
Page {
title: qsTr("Page 1")
anchors.fill: parent
focus: true
property int myIndex: 0
function setVisibility()
{
if(myModel.rowCount()*3 === myIndex)
{
myIndex = 0
return true
}
else
{
myIndex = myIndex + 1
return false
}
}
/*
*
*
* ListView Component
*
*
*/
ListView
{
id: listView1
model: myModel
currentIndex: 0
//property int actualHeight
anchors.fill: parent
clip: true
//spacing: 40
highlightMoveDuration: 1
highlightMoveVelocity: 1
highlightResizeDuration: 0.0
highlight: Rectangle
{
color: "#2e6377"
opacity: 0.3
}
delegate: hDelegate
}
/*
*
*
* ListViewItem Component
*
*
*/
Component
{
id: hDelegate
Item
{
width: parent.width
height: taskInfo.implicitHeight
property variant mainData: model
MouseArea
{
anchors.fill: parent
onClicked:
{
listView1.currentIndex = index
gIdd = listView1.currentItem.mainData.task_idd
gSubject = listView1.currentItem.mainData.task_subject
gBody = listView1.currentItem.mainData.task_body
listView1.currentIndex = index
}
onDoubleClicked:
{
listView1.currentIndex = index
stackView.push("page3.qml")
}
onPressAndHold:
{
listView1.currentIndex = index
stackView.push("page3.qml")
}
hoverEnabled: true
}
Row
{
id: taskInfo
spacing: 5
Rectangle
{
id: dificultStatus
height: taskColumn.height
width: taskColumn.height
color: "transparent"
Rectangle
{
id: rect22
color: "green"
width: parent.width - 20
height: parent.height - 20
radius: 15
border.color: "lightsteelblue"
border.width: 1
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
}
}
Column
{
id: taskColumn
width: listView1.width - editButton.width - dificultStatus.width - 10
Row
{
Text
{
text: task_subject
color: "lightsteelblue"
horizontalAlignment: Text.AlignRight
wrapMode: Text.WordWrap
font {family: localFont.name; pointSize: 14; letterSpacing: 1; wordSpacing: 1}
}
Text
{
text: task_subject
color: "lightsteelblue"
wrapMode: Text.WordWrap
font {family: localFont.name; pointSize: 14; letterSpacing: 1; wordSpacing: 1}
}
}
Text
{
id: text1
height: 50
width: parent.width
clip: true
text: task_body
color: "lightsteelblue"
wrapMode: Text.WordWrap
font {family: localFont.name; pointSize: 14; letterSpacing: 1; wordSpacing: 1}
}
}
Button
{
id: editButton
height: taskColumn.height
width: taskColumn.height
background:
Rectangle
{
anchors.fill: parent
color: "transparent"
Rectangle
{
color: "transparent"
width: parent.width - 20
height: parent.height - 20
radius: 15
border.color: "lightsteelblue"
border.width: 1
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
}
}
Text {
anchors.fill: parent
text: qsTr("...")
color: "lightsteelblue"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.pixelSize: 24
anchors.centerIn: parent
}
onClicked:
{
listView1.currentIndex = index
gIdd = listView1.currentItem.mainData.task_idd
gSubject = listView1.currentItem.mainData.task_subject
gBody = listView1.currentItem.mainData.task_body
listView1.currentIndex = index
stackView.push("page3.qml")
}
}
/*
*
*
* AddButton Component
*
*
*/
Button
{
height: taskColumn.height
width: taskColumn.height
x: 0
y: 80
visible: setVisibility()
//visible: (myModel.rowCount() === ++myIndex) ? true : false
background:
Rectangle
{
anchors.fill: parent
color: "transparent"
Rectangle
{
color: "transparent"
width: parent.width - 20
height: parent.height - 20
radius: 15
border.color: "lightsteelblue"
border.width: 1
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
}
}
Text {
anchors.fill: parent
text: qsTr("+")
color: "lightsteelblue"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.pixelSize: 24
anchors.centerIn: parent
}
onClicked:
{
listView1.currentIndex = index
gIdd = listView1.currentItem.mainData.task_idd
gSubject = listView1.currentItem.mainData.task_subject
gBody = listView1.currentItem.mainData.task_body
listView1.currentIndex = index
stackView.push("page2.qml")
}
}
}
}
}
}
You can just use ListView's footer property. The default footerPositioning is what you want.

QML combobox styling issue in QtQuick.Controls 2.2

I'm beginner. I'm trying to use combobox to populate a list of elements, but when I tried to style there is some problem while displaying text.
Here is the code:
import QtQuick 2.7
import QtQuick.Controls 2.2
Item {
property string btntext : "First"
signal dropDownIndexChanged(int index)
id: mainDropDown
ListModel{
id: modelList
ListElement{ text: "First" }
ListElement{ text: "Second" }
ListElement{ text: "Third" }
}
ComboBox {
id: comboButton
width: parent.width
height: parent.height
model:modelList
currentIndex: 0
editText : btntext
Image {
id: imageMainButton
x: 119
anchors.top: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: 9
anchors.topMargin: -7
fillMode: Image.Tile
sourceSize.height: 25
sourceSize.width: 25
source: "<some image>"
}
delegate: ItemDelegate {
id:itemDelegate
width: comboButton.width
background:Rectangle{
gradient: Gradient {
GradientStop {
position: 0.0
color: itemDelegate.down ? "white" : "blue"
}
GradientStop {
position: 1.0
color: itemDelegate.down ? "yellow" : "orange"
}
}
}
contentItem: Text {
text: modelData
elide: Text.ElideRight
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
font.pointSize: 11
font.family: "Arial"
color: itemDelegate.down ? "black" : "white"
}
highlighted: comboButton.highlightedIndex === index
}
indicator: Canvas {
}
//When this is added combo box text disapears or will be empty until something else is selected from the dropdown.
contentItem: Text {
text: comboButton.displayText
anchors.centerIn: parent
//font: comboButton.font
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
renderType: Text.NativeRendering
anchors.left : parent.left
anchors.leftMargin: 10
font.family: "Verdena"
font.pointSize: 12
font.bold: true
color: "white"
}
background: Rectangle {
implicitWidth: 120
implicitHeight: 40
radius: 2
color : "white"
//height:100
smooth: true
//border.width: 1
border.color: "white"
}
popup: Popup {
y: comboButton.height
width: comboButton.width -5
//implicitHeight: contentItem.implicitHeight -1
padding: 1
background: Rectangle {
border.color: "black"
radius: 2
color : "white"
}
contentItem: ListView {
//clip: true
implicitHeight: contentHeight
model: comboButton.popup.visible ? comboButton.delegateModel : null
currentIndex: comboButton.highlightedIndex
interactive: false
}
}
onCurrentIndexChanged:
{
btntext = mainDropDown.get(currentIndex).text
dropDownIndexChanged(currentIndex)
console.log(btntext ,currentIndex)
}
}
}
1) As mentioned above why does combobox text is not displayed until I select an item from the drop down?
2) The selected index/item is not highlighted at all.
1) As mentioned above why does combobox text is not displayed until I select an item from the drop down?
This is because your background Rectangle color is "White", same as your Text color ("white" is default color).
2) The selected index/item is not highlighted at all.
This is because inside delegate (id: itemDelegate), you are changing color based on itemDelegate.down condition. Change this to itemDelegate.highlighted.

Error of 'TypeError: Cannot read property 'name' of undefined', it comes start to end or vice-versa of application window by moving mouse wheel scroll

I am working on qml, found found an error during moving mouse wheel scrolling i.e.
"TypeError: Cannot read property 'name' of undefined".
It only appear when either mouse wheel scrolling or close the application while during execution and beginning of the application didn't show this error.
One more thing, I am getting accurate data/result whatever I want but due to this error the performance of application get affected.
Please let me know how can I get rid of this issue?
also find below example to see error.
My code is..
import QtQuick 2.4
import QtQuick.Controls 1.3
import QtQuick.Layouts 1.1
ApplicationWindow {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
menuBar: MenuBar {
Menu {
title: qsTr("File")
MenuItem {
text: qsTr("Exit")
onTriggered: Qt.quit();
}
}
}
TableView {
anchors.fill: parent
visible: true
backgroundVisible: false
alternatingRowColors: false
sortIndicatorVisible: true
clip: true
highlightOnFocus: false
width: parent.width
height: parent.height
TableViewColumn{ role: "code" ; title: "cde" ; width: 200;
delegate: Component {
id: codeDelegate
Item{
Text {
color: "lightgray"
elide: styleData.elideMode
text: styleData.value //modelSettingData.get(styleData.row).name
font.family: "Arial"
font.pixelSize: 18
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
Text {
id: metaData
color: "red"
width: parent.width
// height: 20
anchors.bottom: parent.bottom
anchors.bottomMargin: -parent.height/1.5
font.weight: Font.ExtraLight
//elide: Text.ElideMiddle
text: "Time: " + modelSettingData.get(styleData.row).name //Error comes when this part added but I need to use it with the same form
}
}
}
}
}
TableViewColumn{ role: "name" ; title: "nme" ; width: 200
delegate: Component {
id: nameDelegate
Text {
color: "yellow"
elide: styleData.elideMode
text: styleData.value
font.family: "Arial"
font.pixelSize: 18
}
}
}
model: ListModel {
id: modelSettingData
ListElement {
name: "aaaaaaaaaa"
code: "3042666666666"
}
ListElement {
name: "bbbbbb"
code: "32235"
}
ListElement {
name: "ccccccc"
code: "32638"
}
ListElement {
name: "ddddddddddd"
code: "00000000000"
}
ListElement {
name: "eeeeeeeeeeee"
code: "111111111111"
}
ListElement {
name: "ffffffffffff"
code: "222222222222"
}
ListElement {
name: "ggggggggggggg"
code: "3333333333333"
}
ListElement {
name: "hhhhhhhhhhhhh"
code: "4444444444444"
}
ListElement {
name: "iiiiiiiiiiiii"
code: "5555555555555"
}
}
rowDelegate: Rectangle {
property bool selected : styleData.selected
width: parent.width-2
height: 100
color: styleData.selected? "black" : "black"
Rectangle {
width: parent.width
height: 1
anchors.bottom: parent.bottom
visible: parent.selected
color: "yellow"
}
}
}
}

Resources