PDA

View Full Version : How to highlight GridView rows using MouseOver item in QML



Channareddy
10th August 2011, 07:46
Hi All,
I am new to Qt QML.I have a multiColumn list which takes data from Model and displays it.In the View part i am using GridView item to display.Here is my code for GridView which has a rectangle and text items inside it.

[QML TAGS]
Rectangle {
id:gridListViewRectangle
anchors.fill: parent
border.color: "BLACK"

GridView{
objectName: "list"
model:"myModel"
id:list
anchors.fill: parent
cellWidth:120; cellHeight:20
focus: true
interactive:true
clip: true
//delegate: MultiColumnListBoxDelegate{}
highlight: Rectangle {id:patientDetailsHighlight;width:480;height:10;co lor: "blue"; radius: 5 }
// highlightFollowsCurrentItem: true
delegate:
Rectangle{
id:patientListRectangle
width: 120.5
height: 20
// border.width: 1
color: "lightblue"
Text {
id:patientDetailsText
text:modelData
anchors.fill: parent
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
font.family:"Arial Unicode MS"
font.pointSize: 11
style: Text.Raised
color:"darkblue"
font.bold: true
}

MouseArea {
id:markerArea;
anchors.fill:patientListRectangle;
hoverEnabled: true
onEntered: {patientListRectangle.color="yellow"}
onClicked:{
list.currentIndex = index;
listIndexChanged(index);
patientListRectangle.color="blue"
}
onExited:{
patientListRectangle.color="lightblue"
}
}
}
[/QML TAGS]

The Output is
Name ID Date Gender
Row 1 ABCD 123 XXXX XXXXX
Row 2 EDCF 456 XXXX XXXXX


I want to highlight Row 1 when there is Mouse over it/click on any of the GridView elements data in Row 1.
Presently i am able to hightlight only the selected rectangle ie if ABCD is clicked only ABCD rectangle is selected or highligted.

I don't want to use Hightlight parameter of GridView.
Please help me ASAP.Any kind of help is appreciated.