PDA

View Full Version : حذف سطر انتخاب شده در TableView



ali_72
شنبه 21 فروردین 1395, 05:23 صبح
سلام
از TableViewمیخوام وقتی روی تصویر حذف در هر سطر از tableview کلیک شد حذف اون سطر انجام شه
مدل استفاده شده برای Tableview من QStandardItemModel هست.
لطفا راهنمایی کنید.
ممنون

MyTableViewColumn { title: "delete"
width: 15
delegate:Image {
id: name
source: "images/delete.png"
MouseArea{
anchors.fill: parent
anchors.margins: -10
hoverEnabled:true
cursorShape: Qt.PointingHandCursor
onClicked: {
tablemodel.selection.select(tablemodel.currentRow)
myXML.removeRow(tablemodel.currentRow)
tablemodel.currentRow++;
}
}
}

}


void MyXML::removeRow(int index){
newMyModel->removeRow(index);

}