Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void debugMessageHandler( QtMsgType type, const char *msg ){
- if(QString(msg).contains( "The message you can see in the console" )){
- int breakPointOnThisLine(0);
- }
- switch ( type ) {
- case QtDebugMsg:
- fprintf( stderr, "Debug: %sn", msg );
- break;
- case QtWarningMsg:
- fprintf( stderr, "Warning: %sn", msg );
- break;
- case QtFatalMsg:
- fprintf( stderr, "Fatal: %sn", msg );
- abort();
- }
- }
- #include <csignal>
- #include <QtCore/QCoreApplication>
- using namespace std;
- struct CleanExit{
- CleanExit() {
- signal(SIGINT, &CleanExit::exitQt);
- signal(SIGTERM, &CleanExit::exitQt);
- signal(SIGBREAK, &CleanExit::exitQt) ;
- }
- static void exitQt(int sig) {
- QCoreApplication::exit(0);
- }
- };
- int main(int argc, char *argv[])
- {
- CleanExit cleanExit;
- QCoreApplication a(argc, argv);
- return a.exec();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement