QListView - marked Items
-
Hi! :-)
In my program I have a QListView with some content from a SQLite Database. Now I want to enter the list view and display the content on my main form. This is my problem: When I enter the list view with the mouse click everythink works fine, but I also want to use my keyboard cursor buttons (up and down) to navigate through the content of the list view, the navigations works fine, but there is no update from the databse.. Now I use the clicked(...)-Slot for that and I have also tried the other slots, but nothing happens. First I thought the entered(...)-Slot is the correct way but it isn't. Is there any property of the list view I can use?
Thank you :-)
-
Hi! :-)
In my program I have a QListView with some content from a SQLite Database. Now I want to enter the list view and display the content on my main form. This is my problem: When I enter the list view with the mouse click everythink works fine, but I also want to use my keyboard cursor buttons (up and down) to navigate through the content of the list view, the navigations works fine, but there is no update from the databse.. Now I use the clicked(...)-Slot for that and I have also tried the other slots, but nothing happens. First I thought the entered(...)-Slot is the correct way but it isn't. Is there any property of the list view I can use?
Thank you :-)
There may be some terminology confusion. Signals are emitted by objects when something happens. Connect a signal to a slot defined by the application or an instance of a framework provided type.
QItemSelectionModel::currentChanged(const QModelIndex ¤t, const QModelIndex &previous) reports when the "current" item in a view changes. Use QAbstractItemView::selectionModel() to get the selection model the view is using.
An alternative is to override the QAbstractItemView::currentChanged slot by inheriting from QListView. If this route is taken, don't forget to call the parent class implementation.
-
Hi,
thank you for your answer, I was wrong with the term slot, I mean signal.
I will try it on your suggested way.
Thank you!