Results 1 to 3 of 3

Thread: Qt 4.7 limit on number of signals?

  1. #1
    Join Date
    Feb 2011
    Posts
    2
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Qt 4.7 limit on number of signals?

    I've been trying to migrate an application from Qt 4.6.2 to 4.7.0, and had a problem in 4.7 where I can only successfully connect a certain number of signals.

    I've written a simple test program in Python using the PySide bindings that demonstrates the problem. In the test program, on each timer timeout, a new signal is defined and connected to a callback, and all signals defined thus far are emitted. The source-code for this small test is in attached test.py and also listed at the bottom of this post.

    Using Qt 4.6.2, this works as I expected, with the output in attached qt4.6.2output.txt

    Qt Code:
    1. $ python test.py
    2. 0
    3. 0 1
    4. 0 1 2
    5. 0 1 2 3
    6. 0 1 2 3 4
    7. 0 1 2 3 4 5
    8. 0 1 2 3 4 5 6
    9. 0 1 2 3 4 5 6 7
    10. 0 1 2 3 4 5 6 7 8
    11. 0 1 2 3 4 5 6 7 8 9
    12. 0 1 2 3 4 5 6 7 8 9 10
    13. 0 1 2 3 4 5 6 7 8 9 10 11
    14. 0 1 2 3 4 5 6 7 8 9 10 11 12
    15. 0 1 2 3 4 5 6 7 8 9 10 11 12 13
    16. 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
    17. 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
    18. 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
    19. 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
    To copy to clipboard, switch view to plain text mode 


    But using Qt 4.7.0, the callback is not called for new signals after a limit has been reached: in the example the limit was 11. The output is in attached 4.7.0output.txt.

    Qt Code:
    1. $ python test.py
    2. 0
    3. 0 1
    4. 0 1 2
    5. 0 1 2 3
    6. 0 1 2 3 4
    7. 0 1 2 3 4 5
    8. 0 1 2 3 4 5 6
    9. 0 1 2 3 4 5 6 7
    10. 0 1 2 3 4 5 6 7 8
    11. 0 1 2 3 4 5 6 7 8 9
    12. 0 1 2 3 4 5 6 7 8 9 10
    13. 0 1 2 3 4 5 6 7 8 9 10 11
    14. 0 1 2 3 4 5 6 7 8 9 10 11
    15. 0 1 2 3 4 5 6 7 8 9 10 11
    16. 0 1 2 3 4 5 6 7 8 9 10 11
    17. 0 1 2 3 4 5 6 7 8 9 10 11
    18. 0 1 2 3 4 5 6 7 8 9 10 11
    19. 0 1 2 3 4 5 6 7 8 9 10 11
    20. 0 1 2 3 4 5 6 7 8 9 10 11
    To copy to clipboard, switch view to plain text mode 

    The system with Qt 4.6.2 installed runs Ubuntu 10.04
    Qt Code:
    1. $ cat /proc/version
    2. Linux version 2.6.32-26-generic (buildd@rothera) (gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5) ) #48-Ubuntu SMP Wed Nov 24 09:00:03 UTC 2010
    3. $ apt-cache show libqtcore4
    4. ...
    5. Version: 4:4.6.2-0ubuntu5.1
    To copy to clipboard, switch view to plain text mode 

    The system with Qt 4.7.0 installed runs Ubuntu 10.10
    Qt Code:
    1. $ cat /proc/version
    2. Linux version 2.6.35-24-virtual (buildd@vernadsky) (gcc version 4.4.5 (Ubuntu/Linaro 4.4.4-14ubuntu5) ) #42-Ubuntu SMP Thu Dec 2 05:01:52 UTC 2010
    3. $ apt-cache show libqtcore4
    4. ...
    5. Version: 4:4.7.0-0ubuntu4
    To copy to clipboard, switch view to plain text mode 

    Here is the source code for the example:

    Qt Code:
    1. import sys
    2. from PySide import QtCore, QtGui
    3.  
    4. class Window(QtGui.QMainWindow):
    5.  
    6. def __init__(self):
    7. super(Window, self).__init__()
    8. self.timer = QtCore.QTimer(self)
    9. self.timer.timeout.connect(self.onTimeout)
    10. self.n = 0
    11.  
    12. self.timer.start(1000)
    13.  
    14. @QtCore.Slot()
    15. def onTimeout(self):
    16.  
    17. exec("Window.sig%d = QtCore.Signal(object, object)" % self.n)
    18. eval("self.sig%d" % self.n).connect(self.onSignalN)
    19.  
    20. for i in xrange(self.n+1):
    21. eval("self.sig%d[object, object]" % i).emit( i,self )
    22.  
    23. self.n += 1
    24. print ""
    25.  
    26. @QtCore.Slot(object, object)
    27. def onSignalN(self, o1, o2):
    28. print o1,
    29.  
    30. app = QtGui.QApplication(sys.argv)
    31.  
    32. win = Window()
    33.  
    34. win.resize(320, 240)
    35. win.setWindowTitle("Hello, World!")
    36. win.show()
    37.  
    38. sys.exit(app.exec_())
    To copy to clipboard, switch view to plain text mode 

    Ranen
    Attached Files Attached Files
    Last edited by rghosh; 9th February 2011 at 09:27.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt 4.7 limit on number of signals?

    If such a limitation exists, it is implied by PySide and not Qt. This code works properly in Qt 4.7:
    Qt Code:
    1. #include <QtCore>
    2.  
    3. class Object : public QObject {
    4. Q_OBJECT
    5. public:
    6. Object() {}
    7. signals:
    8. void sig1();
    9. void sig2();
    10. void sig3();
    11. void sig4();
    12. void sig5();
    13. void sig6();
    14. void sig7();
    15. void sig8();
    16. void sig9();
    17. void sig10();
    18. void sig11();
    19. void sig12();
    20. void sig13();
    21. void sig14();
    22. void sig15();
    23. void sig16();
    24. void sig17();
    25. void sig18();
    26. void sig19();
    27. void sig20();
    28. private slots:
    29. void onsig1() { qDebug() << Q_FUNC_INFO; }
    30. void onsig2() { qDebug() << Q_FUNC_INFO; }
    31. void onsig3() { qDebug() << Q_FUNC_INFO; }
    32. void onsig4() { qDebug() << Q_FUNC_INFO; }
    33. void onsig5() { qDebug() << Q_FUNC_INFO; }
    34. void onsig6() { qDebug() << Q_FUNC_INFO; }
    35. void onsig7() { qDebug() << Q_FUNC_INFO; }
    36. void onsig8() { qDebug() << Q_FUNC_INFO; }
    37. void onsig9() { qDebug() << Q_FUNC_INFO; }
    38. void onsig10() { qDebug() << Q_FUNC_INFO; }
    39. void onsig11() { qDebug() << Q_FUNC_INFO; }
    40. void onsig12() { qDebug() << Q_FUNC_INFO; }
    41. void onsig13() { qDebug() << Q_FUNC_INFO; }
    42. void onsig14() { qDebug() << Q_FUNC_INFO; }
    43. void onsig15() { qDebug() << Q_FUNC_INFO; }
    44. void onsig16() { qDebug() << Q_FUNC_INFO; }
    45. void onsig17() { qDebug() << Q_FUNC_INFO; }
    46. void onsig18() { qDebug() << Q_FUNC_INFO; }
    47. void onsig19() { qDebug() << Q_FUNC_INFO; }
    48. void onsig20() { qDebug() << Q_FUNC_INFO; }
    49. private:
    50. friend int main(int, char**);
    51. };
    52.  
    53. #include "main.moc"
    54.  
    55. int main(int argc, char **argv){
    56. Object o;
    57. for(int i=1;i<=20;++i){
    58. QObject::connect(&o, qPrintable(QString("2sig%1()").arg(i)), &o, qPrintable(QString("1onsig%1()").arg(i)));
    59. }
    60. emit o.sig1();
    61. emit o.sig2();
    62. emit o.sig3();
    63. emit o.sig4();
    64. emit o.sig5();
    65. emit o.sig6();
    66. emit o.sig7();
    67. emit o.sig8();
    68. emit o.sig9();
    69. emit o.sig10();
    70. emit o.sig11();
    71. emit o.sig12();
    72. emit o.sig13();
    73. emit o.sig14();
    74. emit o.sig15();
    75. emit o.sig16();
    76. emit o.sig17();
    77. emit o.sig18();
    78. emit o.sig19();
    79. emit o.sig20();
    80. return 0;
    81. }
    To copy to clipboard, switch view to plain text mode 

    witht the result of:
    void Object::onsig1()
    void Object::onsig2()
    void Object::onsig3()
    void Object::onsig4()
    void Object::onsig5()
    void Object::onsig6()
    void Object::onsig7()
    void Object::onsig8()
    void Object::onsig9()
    void Object::onsig10()
    void Object::onsig11()
    void Object::onsig12()
    void Object::onsig13()
    void Object::onsig14()
    void Object::onsig15()
    void Object::onsig16()
    void Object::onsig17()
    void Object::onsig18()
    void Object::onsig19()
    void Object::onsig20()
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    rghosh (9th February 2011)

  4. #3
    Join Date
    Feb 2011
    Posts
    2
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Qt 4.7 limit on number of signals?

    Thank you. I have forwarded my question to the pyside mailing list. (The alternative python bindings, PyQt, didn't have this problem)

Similar Threads

  1. Replies: 1
    Last Post: 24th October 2010, 11:09
  2. UDP IP layer limit
    By mhoover in forum General Programming
    Replies: 1
    Last Post: 1st August 2009, 16:13
  3. Upper limit on number of widgets?
    By jdiewald in forum Qt Programming
    Replies: 1
    Last Post: 29th September 2008, 23:00
  4. QThread and signals (linux/UNIX signals not Qt Signals)
    By Micawber in forum Qt Programming
    Replies: 1
    Last Post: 28th November 2007, 22:18
  5. Limit number of row/column in QGridLayout
    By EricF in forum Qt Programming
    Replies: 2
    Last Post: 18th October 2007, 19:54

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.