Just for record, even if you don't need it in your case you can make the signal const. This works for me:
Qt Code:
  1. #include <QtGui>
  2.  
  3. class test : public QObject
  4. {
  5. Q_OBJECT
  6.  
  7. public:
  8. void emitSignal() const
  9. {
  10. Q_EMIT sig("This is a test!");
  11. }
  12.  
  13. Q_SIGNALS:
  14. void sig(const QString&) const;
  15.  
  16. public Q_SLOTS:
  17. void slot(const QString& str) const
  18. {
  19. qWarning() << Q_FUNC_INFO << str;
  20. }
  21. };
  22.  
  23.  
  24. int main(int argc, char *argv[])
  25. {
  26. QApplication app(argc, argv);
  27.  
  28. test t;
  29. QObject::connect(&t, SIGNAL(sig(const QString&)), &t, SLOT(slot(const QString&)));
  30. t.emitSignal();
  31.  
  32. return 0;
  33. // return app.exec();
  34. }
  35.  
  36. #include "main.moc"
To copy to clipboard, switch view to plain text mode