Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Update widgets independently and simultaneously

Update widgets independently and simultaneously

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 715 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JasonKretzer
    wrote on last edited by
    #1

    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
    }
    @

    1 Reply Last reply
    0
    • JeroentjehomeJ Offline
      JeroentjehomeJ Offline
      Jeroentjehome
      wrote on last edited by
      #2

      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.

      Greetz, Jeroen

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved