I recently migrated my Qt project from Linux to Vista, and now I'm debugging signals blindly.

On Linux, if QObject::connect() fails in a debug build, I get a warning message on stderr. On Windows, there is no console output for GUI applications, only an OutputDebugString call.

I already installed DebugView, and it catches my own qDebug() output nicely, but still no warning on failed signals.

One possible solution would be to use QtCreator's autocomplete for signals, but I like Eclipse, and using both is a PITA. Any ideas on how to get signal/slot info at runtime?

Edit: I just realized connect() returns bool, which solves the immediate problem, ugly as it may be. However, this doesn't solve the cases where QMetaObject::connectSlotsByName() fails, and this one runs automatically with widgets.

in the environment of the program when you debug. That makes the program crash, giving you a nice backtrace, especially if you run the code in a debugger. If you don't want the crash, see the answer above.

Thank you, this certainly helps, although I'm starting to believe the Qt DLL is just plain silent. I can already see qDebug() output, so in theory, it should have shown up in DebugView, too.
–
György AndrasekSep 28 '09 at 12:29

you can redirect stdout/stderr quite easily: make a class that derives from std::basic_streambuf and overloads xsputn() and overflow(), then use eg std::cerr.rdbuf( instanceOfYourRedirectClass ) to redirect all stderr ouptut to a callback function you supply.

Here's a simplified version of what I use; depending on your needs you might have to add extra logic to fiddle with the handling of end of line characters etc.