I'm just starting out on Qt (having a primary use for its file-picking dialogs) and created a very small code to test it out. The code is so far meaningless (doesn't do anything relevant), but I'm just testing the waters for now. (Nevermind the empty constructor and destructor, I deleted their contents since they're related to other things that don't matter here.

Qt Code:
  1. class System : public QObject
  2. {
  3. Q_OBJECT
  4. public:
  5. System();
  6. ~System();
  7. public slots:
  8. void OpenFile(QStringList str);
  9. };
  10.  
  11. System::System()
  12. {
  13. }
  14. void System::OpenFile(QStringList str)
  15. {
  16. a.show();
  17. }
  18. System::~System()
  19. {
  20. }
  21.  
  22. int main(int argc, char *argv[])
  23. {
  24. QApplication app(argc, argv);
  25. System c;
  26. QObject::connect(&fd,SIGNAL(filesSelected(QStringList)),&c,SLOT(OpenFile(QStringList)));
  27. fd.show();
  28. return app.exec();
  29. }
To copy to clipboard, switch view to plain text mode 

It's my understanding that the File Dialog should appear (which it does) and after I select a file and press okay, it should send a signal to c's OpenFile() function. If you notice, that function has nothing to do with the address because I'm just testing the SIGNAL-SLOT concept. I'm just expecting to see another FileDialog pop up, which it doesn't.

So, the program runs, the first file dialog (fd) appears, I select a file, press okay, the dialog disappears and, instead of showing a second dialog, the program simply comes to an end.

So, either there's something wrong with my understanding/construct of the QFileDialog, of the SIGNAL-SLOT mechanism or of the workings of a function that is called by this mechanism. I'm quite stumped on this issue, I must say.

I'm on Qt 4.6.3 on VC2008.