[Interest] QML: How to set verticalCenterOffset...

Igor Mironchik igor.mironchik at gmail.com
Sun Aug 16 21:26:56 CEST 2015


Hi

On 16.08.2015 22:10, Dmitry Volosnykh wrote:
> Since you want all list's items to be visible, I'd suggest you to use 
> Row + Repeater combination, unless you want to exploit ListView's 
> animation facilities.

Thank you. Row + Repeater works great.

>
> On Sun, Aug 16, 2015 at 10:06 PM, Dmitry Volosnykh 
> <dmitry.volosnykh at gmail.com <mailto:dmitry.volosnykh at gmail.com>> wrote:
>
>     Your issue is the result of the fact that ListView has zero height
>     (just print height of your list in Component.onCompleted and
>     onHeightChanged handlers). While it gets correctly positioned in
>     the middle of the window, its children go right below the middle
>     line. You need a way to set ListView's height to the height of the
>     images. Using childrenRect.height did not work for me. In your
>     case, assuming all images are of the same size, you may want to
>     set list's height manually.
>
>     On Sun, Aug 16, 2015 at 9:47 PM, Igor Mironchik
>     <igor.mironchik at gmail.com <mailto:igor.mironchik at gmail.com>> wrote:
>
>         In the attachment...
>
>         On 16.08.2015 21:40, Dmitry Volosnykh wrote:
>>         You'd better provide your example so that we could run it
>>         with qmlscene.
>>
>>         On Sun, Aug 16, 2015 at 9:08 PM, Igor Mironchik
>>         <igor.mironchik at gmail.com <mailto:igor.mironchik at gmail.com>>
>>         wrote:
>>
>>             Hi,
>>
>>             I'm trying to center ListView in a Rectangle.
>>
>>             I do:
>>
>>             anchors.centerIn: parent
>>
>>             But it moves ListView under the real center, so I need to
>>             add negative
>>             verticalCenterOffset.
>>
>>             I've tried in ListView:
>>
>>             anchors.verticalCenterOffset: - height / 2.0
>>
>>             But it doesn't work. If I set verticalCenterOffset
>>             without calculations,
>>             i.e. real number then all is ok...
>>
>>             How can I solve the problem?
>>
>>             --
>>             Best Regards,
>>             Igor Mironchik.
>>
>>             _______________________________________________
>>             Interest mailing list
>>             Interest at qt-project.org <mailto:Interest at qt-project.org>
>>             http://lists.qt-project.org/mailman/listinfo/interest
>>
>>
>
>         -- 
>         Best Regards,
>         Igor Mironchik.
>
>
>

-- 
Best Regards,
Igor Mironchik.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150816/24189d86/attachment.html>


More information about the Interest mailing list