How to generate signal when item is entered by code.
-
wrote on 3 May 2021, 17:42 last edited by
-
wrote on 3 May 2021, 20:35 last edited by
What do you mean by "item is entered by code"?
-
wrote on 3 May 2021, 21:10 last edited by
@gde23 Entry to list widget is generated by running code , not manually.
-
@gde23 Entry to list widget is generated by running code , not manually.
wrote on 3 May 2021, 21:23 last edited by@AnneRanch
You mean "added"?
"Enter" in this case means, your mouse enters the item. -
wrote on 3 May 2021, 23:27 last edited by
@Pl45m4 OK. that eliminates signals with "enter" in it.
Lets define "current" next. -
@Pl45m4 OK. that eliminates signals with "enter" in it.
Lets define "current" next.wrote on 4 May 2021, 09:22 last edited by@AnneRanch said in How to generate signal when item is entered by code.:
Lets define "current" next
"current" means the current / active (focused) item in your
QListWidget
.
For example,currentItemChanged
passes the last and the new/current focused item to your slot. -
I can go down the options or ASK. here .
I need to have signal generated when "item is entered" into QListWidget list by another signal.
No manual selection.QtDesigner suggests "go to slot " options and I have tried
currentItemChanged
currentTextChanged
itemChanged
itemEntered@AnneRanch what you're looking for is probably signals. coming from the underlying model that QListWidget implements
https://doc.qt.io/qt-5/qabstractitemmodel.html#signals
I don't think you can get access to the model from a QListWidget, you will have to use a QListView and manage your own Model, that you can listen to
Or define your own signal, that you emit, when you add staff to the QListWidget
-
@AnneRanch said in How to generate signal when item is entered by code.:
Lets define "current" next
"current" means the current / active (focused) item in your
QListWidget
.
For example,currentItemChanged
passes the last and the new/current focused item to your slot.wrote on 4 May 2021, 12:21 last edited by@Pl45m4 said in How to generate signal when item is entered by code.:
@AnneRanch said in How to generate signal when item is entered by code.:
Lets define "current" next
"current" means the current / active (focused) item in your
QListWidget
.
For example,currentItemChanged
passes the last and the new/current focused item to your slot.That is not that clear.
"passes" implies the item is again selected - by mouse or keyboard.
"focused" is same - the item is selected - by mouse or keyboard.I need to process the item BEFORE it is added to the list.
@J-Hilk said in How to generate signal when item is entered by code.:
@AnneRanch what you're looking for is probably signals. coming from the underlying model that QListWidget implements
https://doc.qt.io/qt-5/qabstractitemmodel.html#signals
I don't think you can get access to the model from a QListWidget, you will have to use a QListView and manage your own Model, that you can listen to
and you are correct
Or define your own signal, that you emit, when you add staff to the QListWidget
See my next to last post - process the item signal - BEFORE - it get added to the list.
Sort to messes up the logical flow of events, but definitely simplify the process. -
@Pl45m4 said in How to generate signal when item is entered by code.:
@AnneRanch said in How to generate signal when item is entered by code.:
Lets define "current" next
"current" means the current / active (focused) item in your
QListWidget
.
For example,currentItemChanged
passes the last and the new/current focused item to your slot.That is not that clear.
"passes" implies the item is again selected - by mouse or keyboard.
"focused" is same - the item is selected - by mouse or keyboard.I need to process the item BEFORE it is added to the list.
@J-Hilk said in How to generate signal when item is entered by code.:
@AnneRanch what you're looking for is probably signals. coming from the underlying model that QListWidget implements
https://doc.qt.io/qt-5/qabstractitemmodel.html#signals
I don't think you can get access to the model from a QListWidget, you will have to use a QListView and manage your own Model, that you can listen to
and you are correct
Or define your own signal, that you emit, when you add staff to the QListWidget
See my next to last post - process the item signal - BEFORE - it get added to the list.
Sort to messes up the logical flow of events, but definitely simplify the process.wrote on 4 May 2021, 14:36 last edited by@AnneRanch said in How to generate signal when item is entered by code.:
See my next to last post - process the item signal - BEFORE - it get added to the list.
If you do it on your own, you can decide when you emit it.
Write your ownaddItem
function, emit your custom signal in there and then actually add your item to yourQListWidget
. -
1/10