> On 04 Dec 2014, at 20:42, Jason H <jh...@gmx.com> wrote: > > > >> Sent: Thursday, December 04, 2014 at 2:21 PM >> From: "Nurmi J-P" <jpnu...@theqtcompany.com> >> To: interest <interest@qt-project.org> >> Cc: "Jason H" <jh...@gmx.com> >> Subject: Re: [Interest] ListView questions >> >> >>> On 04 Dec 2014, at 20:07, Jason H <jh...@gmx.com> wrote: >>> >>> So I am finding that ListView is poorly documented. It inherits Flickable, >>> but does not otherwise have any currentIndexChanged() events, except that, >>> it has it... somehow. >>> >>> I am trying to use a ListView with a delegate that has the following >>> behavior: >>> Unselected item delegate: >>> - A line of text >>> - Font is a color >>> >>> Selected Item delegate: >>> - 2 lines of text (double height) >>> - Font is a different color >>> - Alternate background color (easy via highlight property) >>> >>> >>> I can expand the delegate onCurrentIndexChanged, but there is no >>> documentation if there is a previous item availible. And if I add a >>> property, how do I alter the non-current item delegate? >>> >>> Where is the complete ListView documentation? >> >> It doesn't sound like you need onCurrentIndexChanged or the previous item at >> all. You could just create declarative bindings that change the delegate >> looks based on the attached ListView.isCurrentItem property. >> >> http://qt-project.org/doc/qt-5/qml-qtquick-listview.html#isCurrentItem-prop >> >> -- >> J-P Nurmi >> >> > > Thanks, that works, but I found I needed: property bool isSelected: > ListView.isCurrentItem > added to the item for the sub-elements in the delegate to know. Is that > expected?
Yes, that's how attached properties work in general. A quote from the detailed description of ListView: "ListView attaches a number of properties to the root item of the delegate, for example ListView:isCurrentItem. In the following example, the root delegate item can access this attached property directly as ListView.isCurrentItem, while the child contactInfo object must refer to this property as wrapper.ListView.isCurrentItem." > And I still think that ListView docs don't show all the signals the ListView > generates. Property change notifies are part of the QML language: http://qt-project.org/doc/qt-5/qtqml-syntax-signals.html#property-change-signal-handlers PS. Please keep the discussion on the mailing list. -- J-P Nurmi _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest