~aacid/unity8/notime.js

« back to all changes in this revision

Viewing changes to Components/Carousel.qml

  • Committer: Tarmac
  • Author(s): Albert Astals
  • Date: 2013-11-18 03:07:05 UTC
  • mfrom: (519.1.1 noModelInSignal)
  • Revision ID: tarmac-20131118030705-r6xoxtpf6104rcg5
Dash renderer signals: No need to pass the model up and down

Whoever is listening to the signal has access to the item that emits the signal and has the model right there accessible if needs it.

Approved by PS Jenkins bot, Nick Dedekind.

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
 
55
55
    /// Emitted when the user clicked on an item
56
56
    /// @param index is the index of the clicked item
57
 
    /// @param model is the model of all the items in the carousel
58
57
    /// @param itemY is y of the clicked delegate
59
 
    signal clicked(int index, var model, real itemY)
 
58
    signal clicked(int index, real itemY)
60
59
 
61
60
    /// Emitted when the user pressed and held on an item
62
61
    /// @param index is the index of the held item
63
 
    /// @param model is the model of all the items in the carousel
64
62
    /// @param itemY is y of the held delegate
65
 
    signal pressAndHold(int index, var model, real itemY)
 
63
    signal pressAndHold(int index, real itemY)
66
64
 
67
65
    implicitHeight: listView.tileHeight * selectedItemScaleFactor
68
66
 
163
161
                /* We're clicking the selected item and
164
162
                   we're in the neighbourhood of radius 1 pixel from it.
165
163
                   Let's emit the clicked signal. */
166
 
                carousel.clicked(index, listView.model, delegateItem.y)
 
164
                carousel.clicked(index, delegateItem.y)
167
165
                return
168
166
            }
169
167
 
187
185
                /* We're pressAndHold the selected item and
188
186
                   we're in the neighbourhood of radius 1 pixel from it.
189
187
                   Let's emit the pressAndHold signal. */
190
 
                carousel.pressAndHold(index, listView.model, delegateItem.y);
 
188
                carousel.pressAndHold(index, delegateItem.y);
191
189
                return;
192
190
            }
193
191