本文整理汇总了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();
}
示例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();
}
示例3: qInstallMessageHandler
Logger::~Logger() {
if (defaultLogger==this) {
#if QT_VERSION >= 0x050000
qInstallMessageHandler(0);
#else
qInstallMsgHandler(0);
#endif
defaultLogger=0;
}
}
示例4: main
int main(int argc, char *argv[])
{
qInstallMessageHandler(customMessageHandler);
QCoreApplication a(argc, argv);
MyTcpServer ser;
ser.listen(QHostAddress::Any,6666);
return a.exec();
}
示例5: QErrorMessage
QErrorMessage * QErrorMessage::qtHandler()
{
if (!qtMessageHandler) {
qtMessageHandler = new QErrorMessage(0);
qAddPostRoutine(deleteStaticcQErrorMessage); // clean up
qtMessageHandler->setWindowTitle(QApplication::applicationName());
qInstallMessageHandler(jump);
}
return qtMessageHandler;
}
示例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);
}
}
示例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");
}
示例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;
}
示例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;
}
}
示例10: main
int main(int argc, char *argv[])
{
debugMessages.clear();
qInstallMessageHandler(stdConsoleOutput);
QApplication a(argc, argv);
CMainWindow w;
w.show();
return a.exec();
}
示例11: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
qInstallMessageHandler(myMessageOutput);
w.show();
ct.start();
return a.exec();
}
示例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";
}
示例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;
}
示例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();
}
示例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();
}