wysota, thank you very much for the help. It worked.
I am posting here a minimal example just to exemplify for who needs.
MainForm.ui.qml
import QtQuick 2.4
import QtQuick.Controls 1.2
import QtQuick.Layouts 1.1
Rectangle {
id: mainContainer
property alias mainContainerA: mainContainer
property alias buttonA: button
property alias listviewA: listView
property alias rect1A: rect1
property alias rect2A: rect2
width: 600
height: 600
Button {
id: button
anchors.top: parent.top
text: "Insert value"
height: parent.height * 0.1
width: parent.width
}
ListView {
id: listView
anchors.top: button.bottom
clip: true
height: parent.height * 0.5
width: parent.width
}
Rectangle {
id: rect1
visible: true
anchors.top: listView.bottom
width: parent.width
height: parent.height * 0.4
color: "blue"
}
Rectangle {
id: rect2
visible: false
anchors.top: listView.bottom
width: parent.width
height: parent.height * 0.4
color: "red"
}
}
import QtQuick 2.4
import QtQuick.Controls 1.2
import QtQuick.Layouts 1.1
Rectangle {
id: mainContainer
property alias mainContainerA: mainContainer
property alias buttonA: button
property alias listviewA: listView
property alias rect1A: rect1
property alias rect2A: rect2
width: 600
height: 600
Button {
id: button
anchors.top: parent.top
text: "Insert value"
height: parent.height * 0.1
width: parent.width
}
ListView {
id: listView
anchors.top: button.bottom
clip: true
height: parent.height * 0.5
width: parent.width
}
Rectangle {
id: rect1
visible: true
anchors.top: listView.bottom
width: parent.width
height: parent.height * 0.4
color: "blue"
}
Rectangle {
id: rect2
visible: false
anchors.top: listView.bottom
width: parent.width
height: parent.height * 0.4
color: "red"
}
}
To copy to clipboard, switch view to plain text mode
main.qml
import QtQuick 2.4
import QtQuick.Window 2.2
Window {
visible: true
width: 600
height: 600
MainForm {
anchors.fill: parent
listviewA.model: modelM
listviewA.delegate: delegateM.delegateComponent
buttonA.onClicked: {
modelM.append({valor: 100, tipo: 2, tipoIndex: 3});
}
rect1A.visible: delegateM.rect1Visible
rect2A.visible: delegateM.rect2Visible
}
Delegate {
id: delegateM
}
Model {
id: modelM
}
}
import QtQuick 2.4
import QtQuick.Window 2.2
Window {
visible: true
width: 600
height: 600
MainForm {
anchors.fill: parent
listviewA.model: modelM
listviewA.delegate: delegateM.delegateComponent
buttonA.onClicked: {
modelM.append({valor: 100, tipo: 2, tipoIndex: 3});
}
rect1A.visible: delegateM.rect1Visible
rect2A.visible: delegateM.rect2Visible
}
Delegate {
id: delegateM
}
Model {
id: modelM
}
}
To copy to clipboard, switch view to plain text mode
Delegate.qml
import QtQuick 2.4
import QtQuick.Controls 1.2
import QtQuick.Window 2.2
Item {
id: delegateItem
property Component delegateComponent: delegateComponent
property bool rect1Visible: true
property bool rect2Visible: false
Component {
id: delegateComponent
Row {
height: 53
Column {
width: 600 * 0.96 / 8 * 6
//width: Screen.width * 0.96 / 8 * 6
Text {
text: "<strong>" + "Valor: " + valor + "</strong>"
font.pixelSize: 16
}
Text {
text: "Tipo: " + tipo
font.pixelSize: 16
}
}
Column {
width: 600 * 0.96 / 8
//width: Screen.width * 0.96 / 8
Rectangle {
color: "grey"
width: 50
height: 50
MouseArea {
id: editMouseArea
anchors.fill: parent
onClicked:
{
rect1Visible = true;
rect2Visible = false;
}
}
}
}
Column {
width: 600 * 0.96 / 8
//width: Screen.width * 0.96 / 8
Rectangle {
color: "darkred"
width: 50
height: 50
MouseArea {
id: removeMouseArea
anchors.fill: parent
onClicked:
{
rect1Visible = false;
rect2Visible = true;
}
}
}
}
}
}
}
import QtQuick 2.4
import QtQuick.Controls 1.2
import QtQuick.Window 2.2
Item {
id: delegateItem
property Component delegateComponent: delegateComponent
property bool rect1Visible: true
property bool rect2Visible: false
Component {
id: delegateComponent
Row {
height: 53
Column {
width: 600 * 0.96 / 8 * 6
//width: Screen.width * 0.96 / 8 * 6
Text {
text: "<strong>" + "Valor: " + valor + "</strong>"
font.pixelSize: 16
}
Text {
text: "Tipo: " + tipo
font.pixelSize: 16
}
}
Column {
width: 600 * 0.96 / 8
//width: Screen.width * 0.96 / 8
Rectangle {
color: "grey"
width: 50
height: 50
MouseArea {
id: editMouseArea
anchors.fill: parent
onClicked:
{
rect1Visible = true;
rect2Visible = false;
}
}
}
}
Column {
width: 600 * 0.96 / 8
//width: Screen.width * 0.96 / 8
Rectangle {
color: "darkred"
width: 50
height: 50
MouseArea {
id: removeMouseArea
anchors.fill: parent
onClicked:
{
rect1Visible = false;
rect2Visible = true;
}
}
}
}
}
}
}
To copy to clipboard, switch view to plain text mode
Model.qml
import QtQuick 2.0
ListModel {
}
import QtQuick 2.0
ListModel {
}
To copy to clipboard, switch view to plain text mode
Bookmarks