How to loop QListView item selection - qt

How can I make QListView item selection loop from bottom item to top (by pressing navigation key, down) and from top item to bottom (by pressing navigation key, up)? Is there a flag to be defined or some other way? My listview is in IconMode I wanted the selection to go to next row's 1st item when I've reached the end of a row.
Thanks

Its Default behavior provided by the list view for iconic mode.
in order to achieve your requirement, you need to handle it manually.
i.e you will be having the count of items in a row, once you reach the last item handle the right navigation key press event, then focus it back to the first element of the same row..
to get the navigation keypress event, either you install event filter or ovveride the keypress event function.

Related

Detect selected row with force touch watchkit

Is it possible to detect selected row index with force touch? Did force touch in tableView current row is highlighted. But i can't take info about him when context menu appears. TableView method -didSelectRowAtIndex: not called with this event.
The only thing you can handle programmatically with the Force Touch is the Context Menu and this menu is associated with a specific controller, more information you will find following the link.
About the row highlighting: When you start tapping the system doesn't know what the real action is - the regular touch or the force one. So it is starting to highlight a specific area and only later find out what was the action.

Why does all selected QGraphicsItem not receive mouseMove event?

I have several QGraphicsItem objects on my custom GraphicsScene. They have different custom types, so some of them have to handle MouseMove event in one way, and other in different way.
When I select some of them and then move selected items only the item that is under the mouse cursor receive MouseMove event but other items does not. I have to make some additional actions in MyCustomItemClass::mouseMoveEvent when moving is started.
So why does the other items not receive the event?
From your description I would not handle these actions in MyCustomItemClass::mouseMoveEvent because this is only executed when the mouse moves on top of that particular item as you already stated.
Instead I'd subclass the mouseMoveEvent in the scene to check which items are selected and execute the related method in these items. Of course you have to be careful to only move them relatively to their original position according to the relative mouse movement.
If you want to select a group of items and then move them all at once, you can add them to a QGraphicsItemGroup during the select and then move the group as a single object, which will move all the items in the group.

Infragistics UltraWebGrid - Selected Row changes randomly

We are using Version=11.1.20111.2064 of Infragistics35.WebUI.UltraWebGrid.v11.1 and we are experiencing trouble in selecting a row. When a person selects a row near the bottom of the grid, the selected row changes to a row near the top after a few seconds. While mousing over the grid, the control seems to refresh itself a couple of times. In the end the user is frustrated because they never see the row they selected unless it is at the top.
What could be causing this? I know that I can override the client side events, but I am not sure if this is the right approach. I have the same control on another page and it does not behave the same way.
DH
Do you display any alert messages to the user in AfterSelectChangeHandler event? If so it could trigger a bug when mouse move causes row selection. If that's the case add at the end of your AfterSelectChangeHandler handler:
igtbl_getGridById(gridName).Element.setAttribute('mouseDown', 0);
Ref: http://codecorner.galanter.net/2011/11/15/ultrawebgrid-bug-row-is-selected-on-mouse-move/

How to set Previous/Next record by click an asp.net button

I have a Listview binded with a ObjectDataScource and a div to display a record's details on a page. Outside the Listview and div I have Previous/Next buttons on the same page. I want to click the button to display Previous/Next buttons in the Div.
How can this be done?
I use onItemcommand to trigge each record to be deplayed in Div.
I have tried to solve this problem for some days. There are many ways to do so but in my situation, all seems doen't work, untill I found Listview.selectedDataKey.
You can set as many as possible paremeters for property DataKey of Listview. For example
DataKey="ProductID,ProductName,SentDate,TrustID".
Then in Next/Previous onclick event, you get selectedIndex for current selected item, then set selectedIndex as +1 for next item and -1 for previous item. then you can get data through selectedDataKey[0],[1]...
You do what you want to do in onclick event for previous/next item.
MyListView.SelectedIndex = MyListView.SelectedIndex + 1;
or
MyListView.SelectedIndex = MyListView.SelectedIndex + 1;
Of course, you'll need to check to ensure that you're not going outside the bounds of the ListView or you're get an error.... So when incrementing ensure that you're not going past MyListView.Items.Count, and when decrementing, ensure that your current index is > 0.

click feature in Qt

I just want to clarify, weather the feature is present or not in Qt.
The scenario is like this,
I have a list view with items, I want to place the icon to the listview when the item is selected.
The selection I mean is, first time when I click item should be selected, next time if I click the same item then it should display some icon. Please note
It is not the double click. again if do select some other item same feature should continue
So is there any feature which handles this feature by default, any property or flag which I need to set to listview to behave like this or manual implementation
Is required for this.
No problem (: Now I understand what you mean... So if you click on an item it should be selected (for example highlighted in blue) and then when you click on this item again, an icon should be displayed.
I can't think of a regualar way to do this, there is no such flag or something.
The easiest way I can think of would be to store the index in a QList when you select it. And when you deselect it, you delete the index from the list. SO, when you click on an item you can check if it is in that list and if so you can display your icon.
Another way would be to create your own type of QModelIndex. Everytime, this index is selected, you set a bool like is_already_selected on true. When clicking on this item again you check this bool and then decide whether an icon should be displayed or not.
For further information, see: QListView, QAbstractItemView::currentIndex, QModelIndex

Resources