Unsolved I have created an listview inside another listview how can we bind the modeldata from cpp in this type view?
-
Hi,
I have created column model and row model and attached the rowmodel to column model. But when i try to access the same it is not working?
Column mode is TrendsAreaItemModel
Row model is added in the TrendsAreaItemModel with the role name : NumericTableItemModelRole
I have added the rowModel as shown below:switch(role) { case NumericTableItemModelRole: { data = QVariant::fromValue(m_pNumericItemModel); break; }
Please find the QML code below:
ListView { id:listmodel clip: true model:TrendsAreaItemModel anchors.fill: parent width:contentWidth height: contentHeight orientation: ListView.Horizontal layoutDirection :Qt.RightToLeft // layoutDirection :Qt.LeftToRight flickableDirection: Flickable.HorizontalFlick boundsBehavior: Flickable.StopAtBounds interactive: false delegate: Rectangle{ id:innerRect width: isWidthExpanded || isCornerExpanded ? 127.2:126 height: rectancle1.height color: "#191919" ListView{ id:innerlist model: model.NumericTableItemModelRole width: innerRect.width height: innerRect.height - innerRect.height/5 orientation: ListView.Vertical interactive: false delegate: Rectangle{ id:rectangle border.width: 1.5 border.color: "#082931" color: { index % 2 == 0? "black":"#191919" } width:isWidthExpanded || isCornerExpanded ? 127.2:126 height: innerlist.height/listmodel.currentItem.NumericRowCountRole Text { id:text text: listmodel.currentItem.NumericRowValue anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter color:"white" font.family: "Arial" font.pointSize:18 // id:text // text: model.ParameterValue // anchors.horizontalCenter: parent.horizontalCenter // anchors.verticalCenter: parent.verticalCenter // color:model.ParameterName // font.family: "Arial" // font.pointSize:18 } } } } // add: Transition { // // NumberAnimation { property: "opacity"; from: 0; to: 1.0; duration: 400 } // // NumberAnimation { property: "scale"; from: 0; to: 1.0; duration: 400 } // } displaced: Transition { NumberAnimation { properties: "x,y"; duration: 1100; easing.type: Easing.Linear } } focus: true Component.onCompleted: { // listmodel.positionViewAtEnd() titleRectanchor = titlexrect.left titleRecttopanchor = titlexrect.top listmodel.positionViewAtIndex(model.count - 1, ListView.Visible) } onCountChanged: { listmodel.positionViewAtIndex(model.count - 1, ListView.Visible) } ScrollBar.horizontal: ScrollBar { policy:ScrollBar.AlwaysOn active: true } }
-
@Neethu-Antony Can you please fix your code snippet formating?
use triple backtick to insert code in your post :``` code ```
-
@GrecKo ,
Thank you for the suggestion.
I Have updated the same.