Update widgets independently and simultaneously
-
Using 5.0.2 on Win 7
I have 2 "ImageLoop" classes [which extend QWidget] where each take up half the screen, split vertically. Each contains a QLabel for displaying a list of jpg files. So, inside a for loop, I give each widget their list of images, and emit a "listfull" signal which I have connected to a slot - "playList" - in each of the two widgets. Unfortunately, it appears that only the first widget's signal ever gets emitted as only the first widget is ever updated.
I am new to Qt programming and maybe I am misunderstanding the slot/signal system. I thought the pseudocode below would, for each instance, fill the list, emit the signal, and each instance would go off on their merry way -- basically each widget simultaneously and independently showing images. So, question is what am I missing? Or am I going to have to spawn each of these in their own thread?
Thanks!
Pseudocode
@
for(int i=0; i<2; i++){
Create ImageLoop instance
connect(instance, SIGNAL(listfull()), instance, SLOT(playList()));
instance->FillList(arrayOfImageFileNames);
}//inside of ImageLoop class
void FillList(arrayOfImageFileNames) {
//adds all files to an internal list
//when finished
emit listfull();
}//inside of ImageLoop class
void playList() {
//code to loop through each image and show it
}
@ -
Check out the application output tab in the debugger. If the connect fails you get the reason for it. Usually a bool is returned from the connect function, also possible to check the connect on run-time.
Maybe check out the "new" way signal and slots may be used in the connect function (as function pointers).
With the pseudo code we can't really do much, can we. Without the code it's a bit guessing what is wrong.