PDA

View Full Version : Qt_database_retrieve



ganeshgladish
7th June 2013, 16:38
hi ,
i have created Qt c++ database ...i maintain some peoples data's...i also displayed this data to qml screen..in qml screen i have search option(textinput and button) .....whenever i click this search button with textinput name,it will retrieve and displayed how many same name persons in the table...now my questions this same name persons place i want to click and get that particular names data's ....how can i do i don't know please provide some solutions ....

anda_skoa
8th June 2013, 10:59
Assuming you are using a model to hold the search result, make sure you have a role that contains the id used by the database to identify person records. then you can use that to make a lookup in the database.

Cheers,
_

ganeshgladish
8th June 2013, 17:07
i have created one database..i have stored peoples in table.... whenever i retrieved people names it should display in my qml through listview...suppose if there are similate name in the listview ...if i clicked first name in the listview, it should retrieve persons details in another listview...now i have listed the persons name in first listview..now my questions is in that listview, how to access each and every persons name and that accesing means(the particular clicked persons details should be displayed in second list eview) .......



in this column[index] i have retrieved data from database ....

below i have provided my code ..please help me

i dont know how to change each and every item in list view as clickable(mousearea{onclicked:})


property variant columnum:[]
ListView{
x:650;y:180
spacing: 30
width: 600;height: 500
clip:true
boundsBehavior:Flickable.StopAtBounds


model:["Title","Name","Patient-ID","Age","Contact No.","Address","Gender","DOB","Reg Date","Marital Status","Primary Doctor","Refering Doctor","History","Diagnosis","Comments"]
delegate:Row{
spacing: 30


RectangleFunction{

width: 200
color: "#00000C"
TextNames{
anchors.right: parent.right
text: ""+modelData

}
}
RectangleFunction{

TextinTable{
id:getdata123

text:columnum[index]

}

}

}
}





function get_data(){
myObject.retrieve_user_data(); ---------->in this place i am retriving data from c++
var num_user=hellobeacon.get_num_user_entries();
console.log("**********the total Num user entry is********",num_user)
var temp=new Array;
var savefun=parentRt.columnum
for (var i = 0; i < num_user; i++)
{
temp[i]=hellobeacon.get_curr_user_name();
savefun[savefun.length]=temp[i];
parentRt.columnum=savefun; ------->in this plase i am sending data to column


hellobeacon.set_next_user_entry();


}
hellobeacon.clear_user_entries();

}