Hi All,

I am attempting to set up a signal/slot arrangement for a button.

I read a recommendation somewhere that a way to debug the signal part of a connection statement was to do something like:

Qt Code:
  1. connect(myObj, SIGNAL(mySignal()), qApp, SLOT(aboutQt()));
To copy to clipboard, switch view to plain text mode 

I thought I knew a good idea when I saw one. Anyway, I encounter a problem with this trifling task.


Qt Code:
  1. class ButtonDelegate : public QStyledItemDelegate
  2. {
  3. Q_OBJECT
  4. public:
  5. explicit ButtonDelegate(QObject *parent=0);
  6. ~ButtonDelegate();
  7.  
  8. // code redacted for bevity
  9.  
  10. private:
  11. QPushButton *button;
  12.  
  13. };
  14.  
  15. ButtonDelegate::ButtonDelegate(QObject *parent) : QStyledItemDelegate(parent)
  16. {
  17. std::cout << "in ButtonDelegate() ctor: \n" << endl;
  18. connect(button, SIGNAL(clicked()), qApp, SLOT(aboutQt()));
  19. std::cout << "after ButtonDelegate() ctor is complete \n" << endl;
  20.  
  21. }
To copy to clipboard, switch view to plain text mode 

This code crashes at the connect statement. "in ButtonDelegate()..." is printed to the console and "after ButtonDelegate().." is not printed.

Does anyone have an idea what I am getting wrong?