当前位置: 首页>>代码示例>>C++>>正文


C++ qInstallMessageHandler函数代码示例

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


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

示例1: main

int main(int argc, char *argv[])
{
    qInstallMessageHandler(logMessageOutput);
    QApplication a(argc, argv);
    MainWindow w;
    w.show();

    return a.exec();
}
开发者ID:USgHIFU,项目名称:USgHIFU-qt,代码行数:9,代码来源:main.cpp

示例2: main

int main(int argc, char *argv[])
{
#ifdef Q_OS_WIN
    signal(SIGBREAK, signalHandler);
#else
    signal(SIGHUP, signalHandler);
#endif
    signal(SIGINT, signalHandler);

    qInstallMessageHandler(messageOutput);

    QCoreApplication a(argc, argv);

    if (!QDir("../data/").exists())
    {
        if (!QDir().mkdir("../data/"))
        {
            DEBUG_FUNCTION("Cant open data folder! Exiting...");
            return 0;
        }
    }

    QFile file("../data/log.txt");

    log_file = &file;

    if (!log_file->open(QFile::WriteOnly | QFile::Text | QFile::Append))
    {
        qInstallMessageHandler(nullptr);
        qDebug() << "Couldn't log to file!";
    }

    QSettings settings("../data/settings.ini", QSettings::IniFormat);

    global_settings = &settings;

    DEBUG_FUNCTION("Session started!");

    SslServer server;
    Q_UNUSED(server)

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

示例3: qInstallMessageHandler

Logger::~Logger() {
    if (defaultLogger==this) {
#if QT_VERSION >= 0x050000
        qInstallMessageHandler(0);
#else
        qInstallMsgHandler(0);
#endif
        defaultLogger=0;
    }
}
开发者ID:Rekall,项目名称:Rekall,代码行数:10,代码来源:logger.cpp

示例4: main

int main(int argc, char *argv[])
{
    qInstallMessageHandler(customMessageHandler);
    QCoreApplication a(argc, argv);

    MyTcpServer ser;
    ser.listen(QHostAddress::Any,6666);

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

示例5: QErrorMessage

QErrorMessage * QErrorMessage::qtHandler()
{
    if (!qtMessageHandler) {
        qtMessageHandler = new QErrorMessage(0);
        qAddPostRoutine(deleteStaticcQErrorMessage); // clean up
        qtMessageHandler->setWindowTitle(QApplication::applicationName());
        qInstallMessageHandler(jump);
    }
    return qtMessageHandler;
}
开发者ID:ghjinlei,项目名称:qt5,代码行数:10,代码来源:qerrormessage.cpp

示例6: locker

    void LogManager::doSetHandleQtMessages(bool handleQtMessages)
    {
        QMutexLocker locker(&mObjectGuard);

        if (instance()->mHandleQtMessages == handleQtMessages)
            return;

        instance()->mHandleQtMessages = handleQtMessages;
        if (instance()->mHandleQtMessages)
        {
            static_logger()->trace("Activate Qt message handling");
            instance()->mOldQtMsgHandler = qInstallMessageHandler(qtMessageHandler);
        }
        else
        {
            static_logger()->trace("Deactivate Qt message handling");
            qInstallMessageHandler(instance()->mOldQtMsgHandler);
        }
    }
开发者ID:yiminyangguang520,项目名称:log4t,代码行数:19,代码来源:logmanager.cpp

示例7: QT_VERSION_CHECK

// Before all tests
void HandleSignalRouterUnitTests::initTestCase()
{
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
    qInstallMsgHandler(myMessageOutput);
#else
    qInstallMessageHandler(myMessageOutput);
#endif
    // Help the QSignalSpy handle QVariant
    qRegisterMetaType<QVariant>("QVariant");
}
开发者ID:rburchell,项目名称:ck,代码行数:11,代码来源:testhandlesignalrouter.cpp

示例8: main

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

	qRegisterMetaType<GenericDAO>();
	qRegisterMetaType<TrackDAO>();
	qRegisterMetaTypeStreamOperators<TrackDAO>("TrackDAO");
	qRegisterMetaType<QFileInfo>();
	qRegisterMetaType<PluginInfo>();
	qRegisterMetaTypeStreamOperators<PluginInfo>("PluginInfo");
#if defined(Q_OS_WIN)
	qInstallMessageHandler(debugOutput);
#endif

	QtSingleApplication app(SOFT, argc, argv);
	app.setOrganizationName(COMPANY);
	app.setApplicationName(SOFT);
	app.setApplicationVersion(VERSION);
	app.setAttribute(Qt::AA_UseHighDpiPixmaps);

	if (app.isRunning()) {
		app.forwardArgsToServer();
		return 0;
	}

	SettingsPrivate *settings = SettingsPrivate::instance();
	app.installTranslator(&settings->playerTranslator);
	app.installTranslator(&settings->defaultQtTranslator);

	app.setStyle(new MiamStyle);
	MainWindow *window = new MainWindow;
	app.setActivationWindow(window);

	logBrowser = new LogBrowser;
	QObject::connect(window->actionShowDebug, &QAction::triggered, [=]() { logBrowser->show(); });
	QObject::connect(&app, &QtSingleApplication::sendArgs, window, &MainWindow::processArgs);

	if (settings->isCustomColors()) {
		app.setPalette(settings->value("customPalette").value<QPalette>());
	}

	window->init();
	window->show();
	window->loadPlugins();
	window->activateLastView();
	QStringList args;
	for (int i = 0; i < argc; i++) {
		args << argv[i];
	}
	window->processArgs(args);

	int result = app.exec();
	delete logBrowser;
	return result;
}
开发者ID:percevall,项目名称:Miam-Player,代码行数:55,代码来源:main.cpp

示例9: QQmlDebugService

QDebugMessageService::QDebugMessageService(QObject *parent) :
    QQmlDebugService(s_key, 2, parent), oldMsgHandler(0),
    prevState(QQmlDebugService::NotConnected)
{
    // don't execute stateChanged() in parallel
    QMutexLocker lock(&initMutex);
    if (state() == Enabled) {
        oldMsgHandler = qInstallMessageHandler(DebugMessageHandler);
        prevState = Enabled;
    }
}
开发者ID:2gis,项目名称:2gisqt5android,代码行数:11,代码来源:qdebugmessageservice.cpp

示例10: main

int main(int argc, char *argv[])
{
    debugMessages.clear();
    qInstallMessageHandler(stdConsoleOutput);

    QApplication a(argc, argv);
    CMainWindow w;
    w.show();

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

示例11: main

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;

    qInstallMessageHandler(myMessageOutput);
    w.show();
    ct.start();

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

示例12: QMainWindow

MainServerWindow::MainServerWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainServerWindow)
{
    if(INSTANCE)
        throw new std::runtime_error("One instance is already running!");
    ui->setupUi(this);
    INSTANCE = this;
    qInstallMessageHandler(MainServerWindow::msgHandler);
    qDebug() << "Installed Message Handler";
}
开发者ID:Wohlhabend-Networks,项目名称:PGE-Project,代码行数:11,代码来源:mainserverwindow.cpp

示例13: main

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

	qRegisterMetaType<GenericDAO>();
	qRegisterMetaType<TrackDAO>();
	qRegisterMetaTypeStreamOperators<TrackDAO>("TrackDAO");
	qRegisterMetaType<QFileInfo>();
	qRegisterMetaType<PluginInfo>();
	qRegisterMetaTypeStreamOperators<PluginInfo>("PluginInfo");
	qInstallMessageHandler(debugOutput);

	QtSingleApplication app(SOFT, argc, argv);

	if (app.isRunning()) {
		QString arg = QApplication::arguments().join(";");
		app.sendMessage(arg);
		return 0;
	}

	app.setStyle(new MiamStyle);
	MainWindow *window = new MainWindow;
	logBrowser = new LogBrowser;
	QObject::connect(window->actionShowDebug, &QAction::triggered, [=]() {
		logBrowser->show();
	});
	QObject::connect(&app, &QtSingleApplication::sendArgs, window, &MainWindow::processArgs);
	app.setActivationWindow(window);

	SettingsPrivate *settings = SettingsPrivate::instance();
	if (settings->isCustomColors()) {
		app.setPalette(settings->value("customPalette").value<QPalette>());
	}
	app.setOrganizationName(COMPANY);
	app.setApplicationName(SOFT);
	app.setApplicationVersion(VERSION);

	window->init();
	window->show();
	window->loadPlugins();
	window->activateLastView();

	// It this application was started from a file (for example)
	if (argc > 1) {
		QStringList args;
		for (int i = 0; i < argc; i++) {
			args << argv[i];
		}
		window->processArgs(args);
	}
	int result = app.exec();
	delete logBrowser;
	return result;
}
开发者ID:arnolddumas,项目名称:Miam-Player,代码行数:54,代码来源:main.cpp

示例14: main

int main(int argc, char *argv[])
{
    // Install the local debug message handler
    qInstallMessageHandler(debugOutputHandler);

    QApplication a(argc, argv);

    // Set application name and version
    QCoreApplication::setApplicationName("ld-analyse");
    QCoreApplication::setApplicationVersion("1.1");
    QCoreApplication::setOrganizationDomain("domesday86.com");

    // Set up the command line parser
    QCommandLineParser parser;
    parser.setApplicationDescription(
        "ld-analyse - TBC output analysis\n"
        "\n"
        "(c)2018 Simon Inns\n"
        "GPLv3 Open-Source - github: https://github.com/happycube/ld-decode");
    parser.addHelpOption();
    parser.addVersionOption();

    // Option to show debug (-d)
    QCommandLineOption showDebugOption(QStringList() << "d" << "debug",
                                       QCoreApplication::translate("main", "Show debug"));
    parser.addOption(showDebugOption);

    // Positional argument to specify input video file
    parser.addPositionalArgument("input", QCoreApplication::translate("main", "Specify input TBC file"));

    // Process the command line arguments given by the user
    parser.process(a);

    // Get the configured settings from the parser
    bool isDebugOn = parser.isSet(showDebugOption);

    // Process the command line options
    if (isDebugOn) showDebug = true;

    // Get the arguments from the parser
    QString inputFileName;
    QStringList positionalArguments = parser.positionalArguments();
    if (positionalArguments.count() == 1) {
        inputFileName = positionalArguments.at(0);
    } else {
        inputFileName.clear();
    }

    // Start the GUI application
    MainWindow w(inputFileName);
    w.show();

    return a.exec();
}
开发者ID:happycube,项目名称:ld-decode,代码行数:54,代码来源:main.cpp

示例15: main

int main(int argc, char* argv[])
{
    qSetMessagePattern("%{type} %{threadid} %{message}");
    NetworkViewerApp app(argc,argv);
    app.init();

    qInstallMessageHandler(myMessageOutput);

    //See also void qSetMessagePattern(const QString & pattern)
    return app.exec();
}
开发者ID:openecosys,项目名称:networkviewer,代码行数:11,代码来源:networkviewer.cpp


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