本文整理汇总了C++中qInstallMessageHandler函数的典型用法代码示例。如果您正苦于以下问题:C++ qInstallMessageHandler函数的具体用法?C++ qInstallMessageHandler怎么用?C++ qInstallMessageHandler使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qInstallMessageHandler函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: QCOMPARE
void tst_qdeclarativeengine::outputWarningsToStandardError()
{
QDeclarativeEngine engine;
QCOMPARE(engine.outputWarningsToStandardError(), true);
QDeclarativeComponent c(&engine);
c.setData("import QtQuick 1.0; QtObject { property int a: undefined }", QUrl());
QVERIFY(c.isReady() == true);
warnings.clear();
QtMessageHandler old = qInstallMessageHandler(msgHandler);
QObject *o = c.create();
qInstallMessageHandler(old);
QVERIFY(o != 0);
delete o;
QCOMPARE(warnings.count(), 1);
QCOMPARE(warnings.at(0), QLatin1String("<Unknown File>:1: Unable to assign [undefined] to int a"));
warnings.clear();
engine.setOutputWarningsToStandardError(false);
QCOMPARE(engine.outputWarningsToStandardError(), false);
old = qInstallMessageHandler(msgHandler);
o = c.create();
qInstallMessageHandler(old);
QVERIFY(o != 0);
delete o;
QCOMPARE(warnings.count(), 0);
}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:41,代码来源:tst_qdeclarativeengine.cpp
示例17: g_messageOutput
void g_messageOutput(QtMsgType type, const QMessageLogContext& context, const QString& msg)
{
if (msg.contains("requested for null window or window without handle"))
return;
if (msg.contains("QBackingStore::flush() called with non-exposed window, behavior is undefined"))
return;
if (msg.contains("Cannot create accessible interface for object"))
return;
qInstallMessageHandler(NULL);
QString message = QString("%1\n\nfile: %2: %3\nat function: %4")
.arg(msg)
.arg(context.file)
.arg(context.line)
.arg(context.function);
switch (type)
{
case QtDebugMsg:
TRACE1("Debug: %s\n", msg.toLocal8Bit().constData());
break;
case QtWarningMsg:
TRACE1("Warning: %s\n", message.toLocal8Bit().constData());
QMessageBox::warning(g_pApp->getMainWnd(), "QtWarning", message);
break;
case QtCriticalMsg:
QMessageBox::critical(g_pApp->getMainWnd(), "QtCritical", message);
break;
case QtFatalMsg:
QMessageBox::critical(g_pApp->getMainWnd(), "QtFatal", message);
break;
}
qInstallMessageHandler(g_messageOutput);
}
开发者ID:cerevra,项目名称:rdo_studio,代码行数:41,代码来源:application.cpp
示例18: qInstallMsgHandler
bool CoreApplication::init()
{
if (Quassel::init() && _internal->init()) {
#if QT_VERSION < 0x050000
qInstallMsgHandler(Logger::logMessage);
#else
qInstallMessageHandler(Logger::logMessage);
#endif
return true;
}
return false;
}
开发者ID:TC01,项目名称:quassel,代码行数:12,代码来源:coreapplication.cpp
示例19: main
int main(int argc, char *argv[])
{
qInstallMessageHandler(myMessageOutput);
QApplication a(argc, argv);
Log::display();
Server myServer;
return a.exec();
}
开发者ID:armanr,项目名称:QtWebsocket,代码行数:12,代码来源:main.cpp
示例20: main
int main(int argc, char **argv) {
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) && !TEST
// install message handler
qInstallMessageHandler(SDDM::MessageHandler);
#endif
// create application
SDDM::DaemonApp app(argc, argv);
// run application
return app.exec();
}
开发者ID:CSRedRat,项目名称:sddm,代码行数:12,代码来源:DaemonApp.cpp
注:本文中的qInstallMessageHandler函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论