GridView doesn't have an itemAt(index) method, just indexAt(x,y).
This workaround emits a signal to which the delegates listen to and then set currentItem to itself it the item is the current one.
Details
This will be used for opening the context menu at the current item in response to a keyboard press. There might be other usescases.
Diff Detail
- Repository
- R119 Plasma Desktop
- Lint
Lint Skipped - Unit
Unit Tests Skipped
I don't get what this is trying to achieve. Setting the item that has GridView.isCurrentItem to gridView.currentItem should be a no-op. It's already the current item, how can it be more current-item-y? Also opening the context menu is supposed to work already (perhaps it regressed ...); the problem that's marked by a TODO in the code is that it won't open at the right position because FolderModel::openContextMenu uses QCursor::pos() and the mouse pointer might be somewhere else than the item that's been nav'ed to by keyboard.
Setting the item that has GridView.isCurrentItem to gridView.currentItem should be a no-op. It's already the current item, how can it be more current-item-y?
Note that GridView does *not* have a currentItem property – I added it in this patch.
Also opening the context menu is supposed to work already (perhaps it regressed ...)
It just returns because of that TODO :)
the problem that's marked by a TODO in the code is that it won't open at the right position because FolderModel::openContextMenu uses QCursor::pos() and the mouse pointer might be somewhere else than the item that's been nav'ed to by keyboard.
Yup, that's what I need this patch for, so I know the current item so I can show the menu next to it, cf. also D4962 which makes use of this.
http://doc.qt.io/qt-5/qml-qtquick-gridview.html#currentItem-prop
What the… reminds me that I wanted to make an oculist appointment. Damn. So much waste… :)
If you ask me, from my own experience, assuming GridView can't do $thing is generally reasonable and a sign of healthy skepticism ;)
What review is for :)