icesimon's Blog

  • About Me
  • Archive
  • feeds

Posts match “ c++ ” tag:

over 8 years ago

How to check debug messages in Cascades?

Just use some simple steps can let you check debug messages!

  1. Open the main.cpp in your project. Only need to add two code snippets!

  2. First: Insert this before int main

    void myMessageOutput(QtMsgType type, const char* msg) 
    

    {
    std::fprintf(stdout, "%s\n", msg);
    std::fflush (stdout);
    }

  3. Second:Inset snippet after Application app(argc, argv);

    qInstallMsgHandler(myMessageOutput);
    
  4. Here are the whole code snippets

    void myMessageOutput(QtMsgType type, const char* msg) 
    {
        std::fprintf(stdout, "%s\n", msg);
        std::fflush(stdout);
    }
    Q_DECL_EXPORT int main(int argc, char **argv) 
    {
        Application app(argc, argv);
        qInstallMsgHandler(myMessageOutput);
    
        // localization support
        QTranslator translator;
        QString locale_string = QLocale().name();
        QString filename = QString( "YourApp_%1" ).arg( locale_string );
        if (translator.load(filename, "app/native/qm")) 
        {
            app.installTranslator( &translator );
        }
        new YourApp(&app);
        return Application::exec();
    }
    

Enjoy all your dubeg messages! ^^

  • BlackBerry
  • Cascades
  • Debug
  • BB10
  • QML
  • c++
  • June 29, 2014 14:47
  • Permalink
  • Comments
 

Copyright © 2013 icesimon . Powered by Logdown.
Based on work at subtlepatterns.com.