Creating Slots for numerous loadProgress signals of an array of QWebEnginePage objects.
-
wrote on 17 Oct 2023, 20:29 last edited by
I have a
QList<QWebEnginePage*>
that is connected toQWebEnginePage::loadProgress
withconnect(qListContainer[i], &QWebEnginePage::loadProgress, this, &MainWindow::loadProgressSlot)
This is accomplished with afor()
loop for everyQWebEnginePage*
in my QListI want to create a slot for every connected QWebEnginePage. I cannot foresee how many slots I will need. Is there a way to create these slots iteratively? Is there a better solution for individually connecting the
&QWebEnginePage::loadProgress
signal to multiple slots updating individual progress bars?Thanks.
-
I have a
QList<QWebEnginePage*>
that is connected toQWebEnginePage::loadProgress
withconnect(qListContainer[i], &QWebEnginePage::loadProgress, this, &MainWindow::loadProgressSlot)
This is accomplished with afor()
loop for everyQWebEnginePage*
in my QListI want to create a slot for every connected QWebEnginePage. I cannot foresee how many slots I will need. Is there a way to create these slots iteratively? Is there a better solution for individually connecting the
&QWebEnginePage::loadProgress
signal to multiple slots updating individual progress bars?Thanks.
wrote on 17 Oct 2023, 20:59 last edited by mpergand@desun_evan
In MainWindow::loadProgressSlot()
you can test the sender of the signal and update your progress bars accordingly:if(sender()==qListContainer[0]) update progressbar0
else... -
@desun_evan
In MainWindow::loadProgressSlot()
you can test the sender of the signal and update your progress bars accordingly:if(sender()==qListContainer[0]) update progressbar0
else...wrote on 17 Oct 2023, 21:01 last edited by desun_evan@mpergand I will try this, thank you.
Update:
Works fine, I was unware of sender() of QObject. Thanks! -
1/3