ganeshgladish
3rd July 2013, 13:39
hai everyone,
i have created gui in this gui i displayed images using listview....now my doubt is i want to select image and delete...i dont know how can i do...please tell me ....here i attached my code please check it....
import QtQuick 2.0
import Qt.labs.folderlistmodel 1.0
Rectangle {
id:root
width: 360
height: 360
//================ BUTTON : press = remove the selection
Rectangle {
id:button
width: 360
height: 100
color: buttonArea.pressed ? "gray" : "lightgray"
Text {
anchors.centerIn: parent
text:"click to delete selection"
}
MouseArea{
id:buttonArea
anchors.fill: parent
onPressed: root.removeSelection()
}
}
Rectangle{
width: parent.width-200
height: parent.height/3.6
anchors.bottom: parent.bottom
color: "transparent"
anchors.horizontalCenter: parent.horizontalCenter
ListView {
id:list_view_rm
anchors.fill: parent
width: 400; height: 600
clip: true
orientation: "Horizontal"
FolderListModel {
id: folderModel
nameFilters: ["*"]
folder: "image"
}
Component {
id: fileDelegate
Column {
Rectangle{
id:sss
width: 250; height: 160
border.color: "white"
border.width: 2
color:"transparent"
Image {
id:image_click
anchors.fill: parent
//anchors.centerIn: parent
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width; height: parent.height
fillMode:Image.PreserveAspectFit
smooth: true
source:folderModel.folder + "/" + fileName
}
Text { text: fileName
anchors.bottom: parent.bottom
// anchors.leftMargin: 20
anchors.horizontalCenter: parent.horizontalCenter
color: "white"
font.bold: true
}
}
}
}
highlight: Rectangle { color: "lightsteelblue"; radius: 5 }
model: folderModel
delegate: fileDelegate
}
}
}
i have created gui in this gui i displayed images using listview....now my doubt is i want to select image and delete...i dont know how can i do...please tell me ....here i attached my code please check it....
import QtQuick 2.0
import Qt.labs.folderlistmodel 1.0
Rectangle {
id:root
width: 360
height: 360
//================ BUTTON : press = remove the selection
Rectangle {
id:button
width: 360
height: 100
color: buttonArea.pressed ? "gray" : "lightgray"
Text {
anchors.centerIn: parent
text:"click to delete selection"
}
MouseArea{
id:buttonArea
anchors.fill: parent
onPressed: root.removeSelection()
}
}
Rectangle{
width: parent.width-200
height: parent.height/3.6
anchors.bottom: parent.bottom
color: "transparent"
anchors.horizontalCenter: parent.horizontalCenter
ListView {
id:list_view_rm
anchors.fill: parent
width: 400; height: 600
clip: true
orientation: "Horizontal"
FolderListModel {
id: folderModel
nameFilters: ["*"]
folder: "image"
}
Component {
id: fileDelegate
Column {
Rectangle{
id:sss
width: 250; height: 160
border.color: "white"
border.width: 2
color:"transparent"
Image {
id:image_click
anchors.fill: parent
//anchors.centerIn: parent
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width; height: parent.height
fillMode:Image.PreserveAspectFit
smooth: true
source:folderModel.folder + "/" + fileName
}
Text { text: fileName
anchors.bottom: parent.bottom
// anchors.leftMargin: 20
anchors.horizontalCenter: parent.horizontalCenter
color: "white"
font.bold: true
}
}
}
}
highlight: Rectangle { color: "lightsteelblue"; radius: 5 }
model: folderModel
delegate: fileDelegate
}
}
}