Results 1 to 9 of 9

Thread: signals and control arrays

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2007
    Posts
    95
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: signals and control arrays

    I have read obout sender() function and I need more help. I have programm this:

    Qt Code:
    1. for (int i=0;i<max_contorno;i++){
    2. connect(SLDpaso[i], SIGNAL(valueChanged(int)), this, SLOT(setIsoValueInt(int)));
    3. }
    To copy to clipboard, switch view to plain text mode 

    and in setIsoValueInt:

    Qt Code:
    1. QSlider *SLDp = (QSlider *)sender();
    To copy to clipboard, switch view to plain text mode 

    But i dont know how to obtain the index of the Sliders array

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: signals and control arrays

    There:
    Qt Code:
    1. int sldIndex = -1;
    2. for(int i = 0; i != max_contorno; ++i)
    3. if(SLDpaso[i] == SLDp)
    4. {
    5. sldIndex = i;
    6. break;
    7. }
    To copy to clipboard, switch view to plain text mode 

    So, you should test sldIndex to be a valid value.

    Regards

  3. #3
    Join Date
    Jan 2007
    Posts
    95
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: signals and control arrays

    Marcel, this works fine. Thanks very very much.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.