Results 1 to 4 of 4

Thread: Connecting many SIGNALS to SLOTS

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2015
    Posts
    66
    Qt products
    Qt5
    Platforms
    Windows
    Thanks
    10
    Thanked 17 Times in 17 Posts

    Default Re: Connecting many SIGNALS to SLOTS

    Qt Code:
    1. for(int i=0; i<100; ++i)
    2. QObject::connect(&chb[i], SIGNAL(stateChanged(int)), &lndt[i], SLOT(setText(QString));
    To copy to clipboard, switch view to plain text mode 

    Ps: QCheckbox emits stateChanged signal not textChanged

  2. The following user says thank you to Vikram.Saralaya for this useful post:

    Alex22 (2nd December 2015)

  3. #2
    Join Date
    Nov 2015
    Posts
    128
    Qt products
    Qt5
    Platforms
    Windows
    Thanks
    70

    Default Re: Connecting many SIGNALS to SLOTS

    thanks a lot Vikram.Saralaya
    Qt Code:
    1. QWidget wdg;
    2. QLabel lbl[100];
    3. QLineEdit le[100];
    4. QGridLayout lay(&wdg);
    5. for(int i=0 ; i<10; i++)
    6. {
    7. lay.addWidget(lbl+i,i,0);
    8. lay.addWidget(le+i,i,1);
    9. QObject::connect(le+i, SIGNAL(textChanged(QString)), lbl+i, SLOT(setText(QString)));
    10. }
    11.  
    12. wdg.show();
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Connecting signals and slots from different process
    By Momergil in forum Qt Programming
    Replies: 3
    Last Post: 8th February 2014, 15:59
  2. Connecting QML signals with Qt slots
    By KIBSOFT in forum Qt Quick
    Replies: 1
    Last Post: 15th November 2010, 09:18
  3. Replies: 8
    Last Post: 18th July 2009, 15:57
  4. Connecting signals and slots help pls
    By bod in forum Qt Programming
    Replies: 9
    Last Post: 1st July 2008, 15:01
  5. Connecting signals & slots across different threads
    By jyoti kumar in forum Qt Programming
    Replies: 4
    Last Post: 16th May 2006, 12:40

Tags for this Thread

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.