• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ qInstallMsgHandler函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中qInstallMsgHandler函数的典型用法代码示例。如果您正苦于以下问题:C++ qInstallMsgHandler函数的具体用法?C++ qInstallMsgHandler怎么用?C++ qInstallMsgHandler使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了qInstallMsgHandler函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: QString

LogToFileMsgHandler::LogToFileMsgHandler()
{
    logFile = 0;
    qint64 appPid = QApplication::applicationPid();
    QString logFileName = QString("/tmp/ktechlab-pid-%1-log").arg(appPid);
    qDebug() << "Starting logging to " << logFileName;
    logFile = fopen(logFileName.toLatin1().data(), "w+");
    if (!logFile) {
        const int lastErrno = errno;
        qWarning() << "Failed to create log file" << logFileName
            << ". errno=" << lastErrno << ", strerror=" << strerror(lastErrno);
        return;
    }
    qInstallMsgHandler(ktlMessageOutput);
    qDebug() << "logging started to " << logFileName << " by " << this;
}
开发者ID:ktechlab,项目名称:ktechlab-0.3,代码行数:16,代码来源:logtofilemsghandler.cpp


示例2: main

int main(int argc, char **argv)
{
  if (logFileOutput) {
#if defined(HAVE_QT5)
    qInstallMessageHandler(LogFile::msgHandler);
#else
    qInstallMsgHandler(LogFile::msgHandler);
#endif
  }

  MainApplication app(argc, argv);

  if (app.isClosing())
    return 0;

  return app.exec();
}
开发者ID:DanMan,项目名称:quiterss,代码行数:17,代码来源:main.cpp


示例3: instance

    static LoggerPrivate* instance()
    {
      LoggerPrivate* result = 0;
      {
        result = m_self;
      }

      if (!result)
      {
        m_self = new LoggerPrivate;
        qInstallMsgHandler(qtLoggerMessageHandler);
        qAddPostRoutine(cleanupLoggerPrivate);
        result = m_self;
      }

      return result;
    }
开发者ID:therealbop,项目名称:qgltennis,代码行数:17,代码来源:Logger.cpp


示例4: main

int main(int argc, char *argv[]) {

    if (getenv("QT_RADIO_NO_DEBUG")) fOutputDisabled = 1;
    qInstallMsgHandler(myMessageOutput);

    // initialize resources, if needed
    // Q_INIT_RESOURCE(resfile);

    QApplication app(argc, argv);

    // create and show your widgets here
    UI widget;

    widget.show();

    return app.exec();
}
开发者ID:kj6dzb,项目名称:ghpsdr3-alex,代码行数:17,代码来源:main.cpp


示例5: main

int main(int argc, char* argv[]){

  QCoreApplication::setOrganizationName("Ibrahim Sha'ath");
  QCoreApplication::setOrganizationDomain("ibrahimshaath.co.uk");
  QCoreApplication::setApplicationName(GuiStrings::getInstance()->appName());

  // libav setup
  av_register_all();
  av_log_set_level(AV_LOG_ERROR);
  av_lockmgr_register(NULL);

  // primitive command line use
  if(argc > 2){
    int cliResult = commandLineInterface(argc,argv);
    if(cliResult >= 0)
      return cliResult;
  }

  qInstallMsgHandler(LoggingHandler);

  QApplication a(argc, argv);

  QTranslator qtTranslator;
  qtTranslator.load("qt_" + QLocale::system().name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
  a.installTranslator(&qtTranslator);

  QString localeParam = "%1/Translations/is_keyfinder_%2.qm";
#if defined Q_OS_MAC
  QDir dir(QApplication::applicationDirPath());
  dir.cdUp();
  QString localePath = localeParam.arg(dir.absolutePath()).arg(QLocale::system().name());
#elif defined Q_OS_LINUX
  QString localePath = localeParam.arg(WORK_CACHEDIR).arg(QLocale::system().name());
#else
  QString localePath = localeParam.arg(QCoreApplication::applicationDirPath()).arg(QLocale::system().name());
#endif

  QTranslator myappTranslator;
  myappTranslator.load(localePath);
  a.installTranslator(&myappTranslator);

  MainMenuHandler* menuHandler = new MainMenuHandler(0);
  menuHandler->new_Batch_Window(true);

  return a.exec();
}
开发者ID:birkestroem,项目名称:is_KeyFinder,代码行数:46,代码来源:main.cpp


示例6: main

int main( int argc, char ** argv )
{
    while (argc > 1) {
        if (strcmp(argv[--argc], "-d") == 0) {
            // daemonize
            openlog(APPNAME, 0, LOG_DAEMON);
            qInstallMsgHandler(toSyslog);
            if (daemon_init() != 0) {
                fprintf(stderr, "%s: Error: Unable to daemonize\n", APPNAME);
                return 1;
	    }
	}
    }

    OQWSServer a(argc, argv, QApplication::GuiServer);
    return a.exec();
}
开发者ID:opieproject,项目名称:opie,代码行数:17,代码来源:main.cpp


示例7: main

int main(int argc, char **argv)
{
#ifndef DEBUG
    qInstallMsgHandler(debugMessagesFilter);
#endif
    QtSingleApplication a(argc, argv);

    a.setApplicationName("ImageShack Uploader");
    a.setOrganizationName("ImageShack");
    a.setOrganizationDomain("imageshack.us");
    a.setApplicationVersion(VERSION);

    QStringList filelist;
    for (int i=1; i< argc; i++)
        filelist << QString::fromLocal8Bit(argv[i]);
    if ((argc==2) && (QString(argv[1]) == "-unregister"))
    {
        qDebug() << "unregistering...";
#ifdef Q_OS_WIN
        WindowsExplorerIntegrator().deintegrate();
#endif
        QSettings sets;
        sets.clear();
        return 0;
    }
    if (a.isRunning() && argc>1)
    {
        a.sendMessage(filelist.join("\r\n"), 5000);
        return 0;
    }

    MainWindow w;
    if (filelist.size()) w.commandLineAddFile(filelist.join("\r\n"));
    QObject::connect(&a,
                     SIGNAL(messageReceived(const QString&)),
                     &w,
                     SLOT(commandLineAddFile(const QString&)));

#ifdef Q_OS_WIN
    WindowsExplorerIntegrator().integrate();
#endif

    w.show();

    return a.exec();
}
开发者ID:altamimi513,项目名称:imageshack-uploader,代码行数:46,代码来源:main.cpp


示例8: main

int main( int _argc, char* _argv[] )
{
    try{
        App Application(_argc, _argv);

        QCoreApplication::setOrganizationName("genome-tools");
        QCoreApplication::setApplicationName(_APPNAME);

        gArgs().Init(QCoreApplication::arguments());
        for(int j=1; j< _argc;j++) {
              QString s(_argv[j]);
              if(s.contains("pass"))
                  for(int i=0;i<s.size();i++)
                      _argv[j][i]='*';
        }
        _logfile.setFileName(gArgs().getArgs("log").toString());
        _logfile.open(QIODevice::WriteOnly|QIODevice::Append);

#ifdef _WARDROBE_
        gSettings().Init(gArgs().getArgs("wardrobe").toString());
#endif

#if QT_VERSION >= 0x050000
        qInstallMessageHandler(printMsgHandler);
#else
        qInstallMsgHandler(printMsgHandler);
#endif

        FSTM *machine = new FSTM();
        QObject::connect(machine,SIGNAL(finished()),QCoreApplication::instance(),SLOT(quit()));
        QTimer::singleShot(0, machine, SLOT(start()));
        return Application.exec();
    }
    catch(char *str)
    {
        cerr << "Error rised:"<<str << endl;
    }
    catch(exception &e )
    {
        cerr << "Caught " << e.what( ) << endl;
        cerr << "Type " << typeid( e ).name( ) << endl;
    }
    catch(...)
    {
    }
}
开发者ID:portah,项目名称:repeats,代码行数:46,代码来源:Main.hpp


示例9: main

int main(int argc, char *argv[]){
	qDebug()<<"Starting up.";
	qInstallMsgHandler(dbgout);
	qDebug()<<"Debug output is on."<<endl;
	qDebug()<<"Creating QApplication...";
	QApplication a(argc, argv); qDebug()<<"done."<<endl;
	qDebug()<<"Creating WPI...";
	WPI wpi; qDebug()<<"done."<<endl;
	qDebug()<<"Setting up signals and slots...";
	QObject::connect(&a,SIGNAL(aboutToQuit()),&wpi,SLOT(aboutToQuit()));
	QTimer::singleShot(100,&wpi,SLOT(run())); qDebug()<<"done."<<endl;
	qDebug()<<"Entering main event loop."<<endl;
	int rc=a.exec();
	qDebug().nospace()<<"Exited main event loop with rc="<<rc<<"."<<endl;
	qDebug()<<"Quitting."<<endl;
	return rc;
}
开发者ID:dbanet,项目名称:QWarpIN,代码行数:17,代码来源:main.cpp


示例10: main

int main( int argc, char ** argv ) {
    qInstallMsgHandler(SysTrace::debug);
    QApplication app( argc, argv );
#if defined(Q_OS_MAC)
    QDir dir(QApplication::applicationDirPath());
    dir.cdUp();
    dir.cd("plugins");
    QApplication::addLibraryPath(dir.absolutePath());
#endif
    QString absolutePath = QCoreApplication::instance()->applicationDirPath();
    // portable installation:
    // check for a configuration file in the program folder.
    QSettings *user;
    if(QFileInfo(absolutePath + "/RockboxUtility.ini").isFile())
        user = new QSettings(absolutePath + "/RockboxUtility.ini", QSettings::IniFormat, 0);
    else user = new QSettings(QSettings::IniFormat, QSettings::UserScope, "rockbox.org", "RockboxUtility");

    QString applang = QLocale::system().name();
    QTranslator translator;
    QTranslator qttrans;
    // install translator
    if(!user->value("lang", "").toString().isEmpty()) {
        applang = user->value("lang", "").toString();
    }
    if(!applang.isEmpty()) {
        if(!translator.load("rbutil_" + applang, absolutePath))
            translator.load("rbutil_" + applang, ":/lang");
        if(!qttrans.load("qt_" + applang,
            QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
            qttrans.load("qt_" + applang, ":/lang");

        QLocale::setDefault(applang);
    }
    delete user;
    app.installTranslator(&translator);
    app.installTranslator(&qttrans);
    if(applang.startsWith("he"))
        app.setLayoutDirection(Qt::RightToLeft);

    RbUtilQt window(0);
    window.show();

//    app.connect( &app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()) );
    return app.exec();

}
开发者ID:a-martinez,项目名称:rockbox,代码行数:46,代码来源:main.cpp


示例11: main

int main(int argc, char *argv[]) {
    const char *logname;

    if ( (logname = getenv("SWIPL_LOGFILE")) ) {
        logfile = fopen(logname, "w");
#if QT_VERSION < 0x050000
        previous = qInstallMsgHandler(logger);
#else
        previous = qInstallMessageHandler(logger);
#endif
    }

    auto a = new swipl_win(argc, argv);
    int rc = a->exec();
    qDebug() << "main loop finished" << rc;
    return rc;
}
开发者ID:ddgold,项目名称:design_patterns,代码行数:17,代码来源:main.cpp


示例12: QSocketNotifier

void
Phantom::onInitialized()
{
    // Add 'phantom' object to the global scope
    m_page->mainFrame()->addToJavaScriptWindowObject("phantom", this);

    // Bootstrap the PhantomJS scope
    m_page->mainFrame()->evaluateJavaScript(Utils::readResourceFileUtf8(":/bootstrap.js"));

    // Listen for stdin closing
    pStdinNotifier = new QSocketNotifier(STDIN_FILENO, QSocketNotifier::Read, this);
    connect(pStdinNotifier, SIGNAL(activated(int)), this, SLOT(onStdin()));
    pStdinNotifier->setEnabled(true);

    // Avoid printing qWarnings (the above notifier generates one at program exit)
    qInstallMsgHandler(messageOutput);
}
开发者ID:noblesamurai,项目名称:phantomjs,代码行数:17,代码来源:phantom.cpp


示例13: QObject

	Server::Server ()
	: QObject ()
	{
		qInstallMsgHandler (Write);
		const auto pid = QCoreApplication::applicationPid ();

		RegisterTypes ();

		auto sb = QDBusConnection::sessionBus ();
		const auto& serviceName = QString ("org.LeechCraft.Wrapper_%1").arg (pid);
		qDebug () << "registering service..." << sb.registerService (serviceName);
		qDebug () << "registering primary object..." << sb.registerObject ("/org/LeechCraft/Control",
				this, QDBusConnection::ExportAllContents);

		QLocalSocket socket;
		socket.connectToServer (QString ("lc_waiter_%1").arg (pid));
		qDebug () << "notifying master..." << socket.waitForConnected ();
	}
开发者ID:ROOAARR,项目名称:leechcraft,代码行数:18,代码来源:server.cpp


示例14: main

int main(int argc, char *argv[])
{
    qInstallMsgHandler(msgOutput);

    QApplication app(argc, argv);

    reditor::REditor * edit = new reditor::REditor();
    reditor::RMainWnd * mwnd = new reditor::RMainWnd(edit);
    edit->attachTo( static_cast<reditor::REditWnd *>(mwnd->centralWidget()) );
    edit->attachToMainWnd(mwnd); // TODO create reditor manager class and implement all slots there to make possible multiple editor windows
    mwnd->resize(800, 600);
    mwnd->show();
    // can't be moved earlier because it requires initiated OpenGL engine to load textures to GPU memory
    rscDB.load(reditor::RConfig::texturesDir(""), reditor::RConfig::modelsDir(""));
    mwnd->initObjPickers();

    return app.exec();
}
开发者ID:ddaroo,项目名称:RoomEdit,代码行数:18,代码来源:main.cpp


示例15: locker

void Logger::openLog(const QString &APath)
{
	QMutexLocker locker(&FMutex);
	LoggerData *q = instance()->d;
	if (!q->logFile.isOpen() && !APath.isEmpty())
	{
		QDir logDir(APath);
		QStringList logFiles = logDir.entryList(QStringList()<<"*.log",QDir::Files,QDir::Name);
		while (logFiles.count() > MAX_LOG_FILES)
			QFile::remove(logDir.absoluteFilePath(logFiles.takeFirst()));

#ifndef DEBUG_MODE
		qInstallMsgHandler(qtMessagesHandler);
#endif
		q->logFile.setFileName(logDir.absoluteFilePath(DateTime(QDateTime::currentDateTime()).toX85DateTime().replace(":","-") +".log"));
		q->logFile.open(QFile::WriteOnly|QFile::Truncate);
	}
}
开发者ID:ChALkeR,项目名称:vacuum-im,代码行数:18,代码来源:logger.cpp


示例16: main

Q_DECL_EXPORT int main(int argc, char **argv) {
    bb::cascades::Application app(argc, argv);

#ifdef QT_DEBUG
    qInstallMsgHandler(standardOutput);
#endif // QT_DEBUG

    QTranslator translator;
    QString locale_string = QLocale().name();
    QString filename = QString( "Altimeter_%1" ).arg( locale_string );
    if (translator.load(filename, "app/native/qm")) {
        app.installTranslator( &translator );
    }

    new ApplicationUI(&app);

    return bb::cascades::Application::exec();
}
开发者ID:Kernald,项目名称:altimeter-bb10,代码行数:18,代码来源:main.cpp


示例17: main

int main()
{
  qInstallMsgHandler(myMessageHandler);
  SkosModel g_skosModel;
  SkosParser g_skosParser(&g_skosModel);
  g_skosParser.parseFile("example.tur", Soprano::SerializationTurtle);
  g_skosModel.removeConceptScheme(QUrl("http://example.org/ns/ConceptScheme"));
  g_skosModel.removeConcept(QUrl("http://example.org/ns/AnotherConcept"));
  g_skosModel.removeLabel(Soprano::Node("Ukryty smok","pl"), 
                          HiddenLabelType,
                          QUrl("http://example.org/ns/MyConcept"));
  g_skosModel.removeLabel(Soprano::Node("Ukryty smok","pl"), 
                          HiddenLabelType,
                          QUrl("http://example.org/ns/MyConcept"));
  SkosSerializer g_skosSerializer(&g_skosModel);
  g_skosSerializer.serialize(QString("out2.txt"), Soprano::SerializationTurtle);
  return 0;
}
开发者ID:mpichlin,项目名称:KPW,代码行数:18,代码来源:main.cpp


示例18: dbgSetupSignals

// signal handlers setup
void dbgSetupSignals()
{
  SYNC_F
  _dbgSigAdd(SIGINT );	// ctrl+c
  _dbgSigAdd(SIGTERM);	// kill (terminate, no force)
  _dbgSigAdd(SIGHUP );
  _dbgSigAdd(SIGABRT);	// uncaught c++ exception
  _dbgSigAdd(SIGSEGV);	// segmentation fault
  _dbgSigAdd(SIGBUS );
  _dbgSigAdd(SIGILL );
  _dbgSigAdd(SIGFPE );	// floating point exception
  //atexit(_dbgShutdown);
  std::set_terminate (_dbgShutdown);
  std::set_unexpected(_dbgShutdown);
  #ifdef HAVE_QT
  qInstallMsgHandler(_qtMsgHandler);
  #endif
}
开发者ID:119-org,项目名称:TND,代码行数:19,代码来源:dbg.cpp


示例19: main

int main(int argc, char** argv) {
   // Register a new Message Handler for qDebug/qWarning/qCritical/qFatal
#ifdef INSTALL_MESSAGE_HANDLER
   qInstallMsgHandler(messageHandler);
#endif

   // Create the Application
   QApplication app(argc, argv);
   app.setApplicationName(APP_NAME);
   app.setApplicationVersion(APP_VERSION);
   app.setOrganizationName(ORG_NAME);
   app.setOrganizationDomain(ORG_DOMAIN);

   // Init Resource Files
   Q_INIT_RESOURCE(qmls);

   // MainView, that will hold the QML UI
   MainView mainView;

#if defined(Q_OS_SYMBIAN)
   qt_SetDefaultIap(); // This will avoid the browser to keep asking for an IAP
#elif defined(Q_WS_MAEMO_5)
   mainView.setAttribute(Qt::WA_Maemo5NonComposited, true); //< This will avoid the use of Composite on this Parentless-Widget
   mainView.setAttribute(Qt::WA_Maemo5AutoOrientation, true); //< "Qt::WA_Maemo5PortraitOrientation" or "Qt::WA_Maemo5LandscapeOrientation" or "Qt::WA_Maemo5AutoOrientation"
#endif

#if defined(Q_OS_MAC) || defined(Q_OS_WIN32)
   //desktop build, just open a window
//   mainView.setWindowFlags(Qt::FramelessWindowHint);
   mainView.show();
#else
	//TODO recognise whether Q_OS_LINUX is defined and understand whether is meego or desktop linux
   //mobile builds, we want the whole screen!
   mainView.showFullScreen();
#endif


   // The Core of the Application
   Core core(&mainView);
   core.start();

   return app.exec();
}
开发者ID:veskuh,项目名称:Helium-Mobile-Browser,代码行数:43,代码来源:main.cpp


示例20: main

int main( int argc, char **argv )
{
	qInstallMsgHandler( myMessageOutput );

	QApplication app(argc, argv);

	if (!QSystemTrayIcon::isSystemTrayAvailable())
	{
		QMessageBox::critical(0, ki18n("Systray"),
		                      ki18n("I couldn't detect any system tray "
								   "on this system."));
		return 1;
	}
	QApplication::setQuitOnLastWindowClosed(false);

	Ktw w( argc, argv );
	w.initWorkflow();
	return app.exec();
}
开发者ID:openSUSE,项目名称:krb5-ticket-watcher,代码行数:19,代码来源:main.cpp



注:本文中的qInstallMsgHandler函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ qIsNaN函数代码示例发布时间:2022-05-30
下一篇:
C++ qInstallMessageHandler函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap