Re: [SailfishDevel] What's the correct way to do this?

2015-06-06 Thread Kimmo Lindholm

https://github.com/tonercloud/fuelpad/blob/master/harbour-fuelpad/qml/pages/FuelpadPage.qml#L88

pass carmodel.get(index)  to the function? (or carListview.model.get(index) ) 
instead of model


-kimmo




Lähettäjä: devel-boun...@lists.sailfishos.org 
[devel-boun...@lists.sailfishos.org] käyttäjän Amilcar Santos 
[amilcar.san...@gmail.com] puolesta
Lähetetty: 5. kesäkuuta 2015 20:58
Vastaanottaja: Sailfish OS Developers
Aihe: Re: [SailfishDevel] What's the correct way to do this?

It may be a name collision between carDetails.model (from the database) and 
ListView.model (Qml delegate implemention)..
Try renaming the 'model' colunm in the 'car' table

Bg,
Amilcar

2015-06-05 18:35 GMT+01:00 Krisztian Olah 
fasza2mob...@gmail.commailto:fasza2mob...@gmail.com:
You are passing a carmodel as an argument to carpassDetails, chances are you 
did not define member named id or register in carmodel, but probably that's not 
want to do anyway. You seem to expect carDetails to be some different type, I 
did not find any definition to its type other than it being a QVariant in 
careRecordsPage.qml.

The way you want to pass carDetails is correct, but you are passing the model.

On Fri Jun 5 17:57:52 2015 GMT+0100, Chris Walker wrote:
 On Fri, 5 Jun 2015 16:53:22 +
 Krisztian Olah fasza2mob...@gmail.commailto:fasza2mob...@gmail.com wrote:

  It looks like the object carDetails does not exist in the scope
  you're trying to access it. What scope is your carDetails object in?
  If you could briefly describe in which file each relevant
  function/object  reside, would be helpful.

 I've just pushed the code to github. So would that be better than me
 trying to explain it?

 It's here :-
 https://github.com/tonercloud/fuelpad
 ___
 SailfishOS.org Devel mailing list
 To unsubscribe, please send a mail to 
 devel-unsubscr...@lists.sailfishos.orgmailto:devel-unsubscr...@lists.sailfishos.org

___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to 
devel-unsubscr...@lists.sailfishos.orgmailto:devel-unsubscr...@lists.sailfishos.org



--
Amilcar
(djditz in the mix... ;)

___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] What's the correct way to do this?

2015-06-06 Thread Andrey Kozhevnikov
If you need just some  fields from model you can pass them to 
parameters, instead of whole model. Other way would be parsing model 
inside onClicked handler. Or use kimmoli suggestion and implement get or 
getModel method on model class for returning const QVariantMap.


05.06.2015 21:06, Chris Walker пишет:

Perhaps somebody can either help me with this one or point me to some
docs that tell me the correct way to do it.

I want to pass several bits of information to another qml page. I've
looked at the various pages and they only tell me how to pass variables
not how to set them up in the first place which is where I'm struggling.

My qml (at the end of a label) looks like this :-
onClicked: console.log(Clicked  + mark +   + model +   + register)
// + { passcarDetails(model);

The console shows that the three pieces of information are being
selected and part of my function looks like this :-
 function passcarDetails(carDetails)
 {
 console.log(about to push to CarRecordPage, for car - id:  +
  carDetails.id + , register:  +
  carDetails.register)

It's failing at that point as the console says :-
passcarDetails:40 - about to push to CarRecordPage, for car - id:
undefined, register: undefined

So where am I going wrong, and more importantly, what can I do about it?

Any help appreciated.
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org


___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] What's the correct way to do this?

2015-06-05 Thread Amilcar Santos
It may be a name collision between carDetails.model (from the database) and
ListView.model (Qml delegate implemention)..
Try renaming the 'model' colunm in the 'car' table

Bg,
Amilcar

2015-06-05 18:35 GMT+01:00 Krisztian Olah fasza2mob...@gmail.com:

 You are passing a carmodel as an argument to carpassDetails, chances are
 you did not define member named id or register in carmodel, but probably
 that's not want to do anyway. You seem to expect carDetails to be some
 different type, I did not find any definition to its type other than it
 being a QVariant in careRecordsPage.qml.

 The way you want to pass carDetails is correct, but you are passing the
 model.

 On Fri Jun 5 17:57:52 2015 GMT+0100, Chris Walker wrote:
  On Fri, 5 Jun 2015 16:53:22 +
  Krisztian Olah fasza2mob...@gmail.com wrote:
 
   It looks like the object carDetails does not exist in the scope
   you're trying to access it. What scope is your carDetails object in?
   If you could briefly describe in which file each relevant
   function/object  reside, would be helpful.
 
  I've just pushed the code to github. So would that be better than me
  trying to explain it?
 
  It's here :-
  https://github.com/tonercloud/fuelpad
  ___
  SailfishOS.org Devel mailing list
  To unsubscribe, please send a mail to
 devel-unsubscr...@lists.sailfishos.org
 
 ___
 SailfishOS.org Devel mailing list
 To unsubscribe, please send a mail to
 devel-unsubscr...@lists.sailfishos.org




-- 
Amilcar
(djditz in the mix... ;)
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] What's the correct way to do this?

2015-06-05 Thread Krisztian Olah
You are passing a carmodel as an argument to carpassDetails, chances are you 
did not define member named id or register in carmodel, but probably that's not 
want to do anyway. You seem to expect carDetails to be some different type, I 
did not find any definition to its type other than it being a QVariant in 
careRecordsPage.qml.

The way you want to pass carDetails is correct, but you are passing the model. 

On Fri Jun 5 17:57:52 2015 GMT+0100, Chris Walker wrote:
 On Fri, 5 Jun 2015 16:53:22 +
 Krisztian Olah fasza2mob...@gmail.com wrote:
 
  It looks like the object carDetails does not exist in the scope
  you're trying to access it. What scope is your carDetails object in?
  If you could briefly describe in which file each relevant
  function/object  reside, would be helpful. 
 
 I've just pushed the code to github. So would that be better than me
 trying to explain it?
 
 It's here :-
 https://github.com/tonercloud/fuelpad
 ___
 SailfishOS.org Devel mailing list
 To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org


[SailfishDevel] What's the correct way to do this?

2015-06-05 Thread Chris Walker
Perhaps somebody can either help me with this one or point me to some
docs that tell me the correct way to do it.

I want to pass several bits of information to another qml page. I've
looked at the various pages and they only tell me how to pass variables
not how to set them up in the first place which is where I'm struggling.

My qml (at the end of a label) looks like this :-
onClicked: console.log(Clicked  + mark +   + model +   + register)
   // + { passcarDetails(model);

The console shows that the three pieces of information are being
selected and part of my function looks like this :-
function passcarDetails(carDetails)
{
console.log(about to push to CarRecordPage, for car - id:  +
 carDetails.id + , register:  +
 carDetails.register)

It's failing at that point as the console says :-
passcarDetails:40 - about to push to CarRecordPage, for car - id:
undefined, register: undefined

So where am I going wrong, and more importantly, what can I do about it?

Any help appreciated.
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org


Re: [SailfishDevel] What's the correct way to do this?

2015-06-05 Thread Chris Walker
On Fri, 5 Jun 2015 16:53:22 +
Krisztian Olah fasza2mob...@gmail.com wrote:

 It looks like the object carDetails does not exist in the scope
 you're trying to access it. What scope is your carDetails object in?
 If you could briefly describe in which file each relevant
 function/object  reside, would be helpful. 

I've just pushed the code to github. So would that be better than me
trying to explain it?

It's here :-
https://github.com/tonercloud/fuelpad
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org


Re: [SailfishDevel] What's the correct way to do this?

2015-06-05 Thread Krisztian Olah
It looks like the object carDetails does not exist in the scope you're trying 
to access it. What scope is your carDetails object in? If you could briefly 
describe in which file each relevant function/object  reside, would be helpful. 

On Fri Jun 5 17:06:05 2015 GMT+0100, Chris Walker wrote:
 Perhaps somebody can either help me with this one or point me to some
 docs that tell me the correct way to do it.
 
 I want to pass several bits of information to another qml page. I've
 looked at the various pages and they only tell me how to pass variables
 not how to set them up in the first place which is where I'm struggling.
 
 My qml (at the end of a label) looks like this :-
 onClicked: console.log(Clicked  + mark +   + model +   + register)
// + { passcarDetails(model);
 
 The console shows that the three pieces of information are being
 selected and part of my function looks like this :-
 function passcarDetails(carDetails)
 {
 console.log(about to push to CarRecordPage, for car - id:  +
  carDetails.id + , register:  +
  carDetails.register)
 
 It's failing at that point as the console says :-
 passcarDetails:40 - about to push to CarRecordPage, for car - id:
 undefined, register: undefined
 
 So where am I going wrong, and more importantly, what can I do about it?
 
 Any help appreciated.
 ___
 SailfishOS.org Devel mailing list
 To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org