<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    you can use only one property as section. You need to compose your
    section value inside model yourself.<br>
     <br>
    <div class="moz-cite-prefix">02.02.2015 20:55, Александр Крылков
      пишет:<br>
    </div>
    <blockquote cite="mid:54CF9DEB.10804@gmail.com" type="cite">
      <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
      <div class="moz-cite-prefix">I have delegate like this:<br>
        <br>
        <span style=" color:#073642;"> </span><span style="
          color:#cb4b16;">section</span>
        <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#073642;">         </span>{</pre>
        <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#073642;">                 </span><span style=" color:#cb4b16;">property</span>:<span style=" color:#073642;"> </span><span style=" color:#2aa198;">"groupingString"</span></pre>
        <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#073642;">                 </span><span style=" color:#cb4b16;">delegate</span>:<span style=" color:#073642;"> </span><span style=" color:#b58900;">Row</span></pre>
        <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#073642;">                 </span>{</pre>
        <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#073642;">                         </span><span style=" color:#cb4b16;">width</span>:<span style=" color:#073642;"> </span><span style=" font-style:italic; color:#657b83;">parent</span>.width</pre>
        <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#073642;">                         </span><span style=" color:#b58900;">Label</span></pre>
        <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#073642;">                         </span>{</pre>
        <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#073642;">                                 </span><span style=" color:#cb4b16;">width</span>:<span style=" color:#073642;"> </span><span style=" font-style:italic; color:#657b83;">parent</span>.width</pre>
        <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#073642;">                                 </span><span style=" color:#cb4b16;">x</span>:<span style=" color:#073642;"> </span>Theme.paddingMedium</pre>
        <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#073642;">                                 </span><span style=" color:#cb4b16;">text</span>:<span style=" color:#073642;"> </span>artistName</pre>
        <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#073642;">                                 </span><span style=" color:#cb4b16;">wrapMode</span>:<span style=" color:#073642;"> </span><span style=" color:#b58900;">Text</span>.WordWrap</pre>
        <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#073642;">                                 </span><span style=" color:#cb4b16;">color</span>:<span style=" color:#073642;"> </span>Theme.highlightColor</pre>
        <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#073642;">                                 </span><span style=" color:#cb4b16;">font.pixelSize</span>:<span style=" color:#073642;"> </span>Theme.fontSizeLarge</pre>
        <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#073642;">                         </span>}</pre>
        <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#073642;">                         </span><span style=" color:#b58900;">Label</span></pre>
        <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#073642;">                         </span>{</pre>
        <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#073642;">                                 </span><span style=" color:#cb4b16;">width</span>:<span style=" color:#073642;"> </span><span style=" font-style:italic; color:#657b83;">parent</span>.width</pre>
        <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#073642;">                                 </span><span style=" color:#cb4b16;">x</span>:<span style=" color:#073642;"> </span>Theme.paddingMedium</pre>
        <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#073642;">                                 </span><span style=" color:#cb4b16;">text</span>:<span style=" color:#073642;"> </span><span style=" color:#2aa198;">"["</span><span style=" color:#073642;"> </span>+<span style=" color:#073642;"> </span>albumYear<span style=" color:#073642;"> </span>+<span style=" color:#073642;"> </span><span style=" color:#2aa198;">"]</span><span style=" color:#073642;"> </span><span style=" color:#2aa198;">"</span><span style=" color:#073642;"> </span>+<span style=" color:#073642;"> </span>albumName</pre>
        <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#073642;">                                 </span><span style=" color:#cb4b16;">wrapMode</span>:<span style=" color:#073642;"> </span><span style=" color:#b58900;">Text</span>.WordWrap</pre>
        <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#073642;">                                 </span><span style=" color:#cb4b16;">color</span>:<span style=" color:#073642;"> </span>Theme.secondaryColor</pre>
        <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#073642;">                                 </span><span style=" color:#cb4b16;">font.pixelSize</span>:<span style=" color:#073642;"> </span>Theme.fontSizeTiny</pre>
        <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#073642;">                         </span>}</pre>
        <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#073642;">                 </span>}</pre>
        <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#073642;">         </span>}

So I want to display artist name on one line and the album name on the second line, they will be the same for all elements inside each group.
So maybe I should then just split "section" inside delegate and display it?


groupingString is item->GetArtistName() + "-" + item->GetAlbumName(); from C++ side</pre>
        <br>
        <pre class="moz-signature" cols="72">-- 
Best regards,
 Alexander                          <a moz-do-not-send="true" class="moz-txt-link-freetext" href="mailto:Alexander.Krylkov@gmail.com">mailto:Alexander.Krylkov@gmail.com</a></pre>
        02.02.2015 21:47, Lucien Xu пишет:<br>
      </div>
      <blockquote
cite="mid:440267131.409749937.1422892062023.JavaMail.root@zimbra59-e10.priv.proxad.net"
        type="cite">
        <pre wrap="">Hello Alexander,

This do not really make sense:

Taking your example from Qt docs, in the medium category, there will be the Dog and Cat. In the "medium" section, you will have two different "name" properties, that are "Dog" and "Cat". What to pick to render name + size ?

What would you like to do actually ?

Regards,
Lucien

----- Mail original -----
De: "Александр Крылков" <a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="mailto:alexander.krylkov@gmail.com"><alexander.krylkov@gmail.com></a>
À: <a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:devel@lists.sailfishos.org">devel@lists.sailfishos.org</a>
Envoyé: Lundi 2 Février 2015 16:36:53
Objet: [SailfishDevel] Accessing ListView model properties in   section.delegate



Hello! how can I access ListView model propeties in it's section delegate?

Examples on internet is showing only how to access property specified in section.property field by "section"
For example: Rectangle { id : container width : 200 height : 250 ListModel { id : animalsModel ListElement { name : "Parrot" ; size : "Small" } ListElement { name : "Guinea pig" ; size : "Small" } ListElement { name : "Dog" ; size : "Medium" } ListElement { name : "Cat" ; size : "Medium" } ListElement { name : "Elephant" ; size : "Large" }
     } // The delegate for each section header Component { id : sectionHeading Rectangle { width : container . width height : childrenRect . height color : "lightsteelblue" Text { text : section font .bold: true }
         }
     } ListView { anchors .fill: parent model : animalsModel delegate : Text { text : name } section .property: "size" section .criteria: ViewSection . FullString section .delegate: sectionHeading }
 }





But i want to use other model fields, for example: Rectangle { id : container width : 200 height : 250 ListModel { id : animalsModel ListElement { name : "Parrot" ; size : "Small" } ListElement { name : "Guinea pig" ; size : "Small" } ListElement { name : "Dog" ; size : "Medium" } ListElement { name : "Cat" ; size : "Medium" } ListElement { name : "Elephant" ; size : "Large" }
     } // The delegate for each section header Component { id : sectionHeading Rectangle { width : container . width height : childrenRect . height color : "lightsteelblue" Text { text : name + size font .bold: true } }
     } ListView { anchors .fill: parent model : animalsModel delegate : Text { text : name } section .property: "size" section .criteria: ViewSection . FullString section .delegate: sectionHeading }
 }


If I will do it like in example above I will get: ReferenceError: name is not defined -- 
Best regards,
 Alexander <a moz-do-not-send="true" class="moz-txt-link-freetext" href="mailto:Alexander.Krylkov@gmail.com">mailto:Alexander.Krylkov@gmail.com</a> 


_______________________________________________
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to <a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:devel-unsubscribe@lists.sailfishos.org">devel-unsubscribe@lists.sailfishos.org</a>
_______________________________________________
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to <a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:devel-unsubscribe@lists.sailfishos.org">devel-unsubscribe@lists.sailfishos.org</a></pre>
      </blockquote>
      <br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to <a class="moz-txt-link-abbreviated" href="mailto:devel-unsubscribe@lists.sailfishos.org">devel-unsubscribe@lists.sailfishos.org</a></pre>
    </blockquote>
    <br>
  </body>
</html>