I'm new to the Qt / QML topic, and I'm trying to install a logging handler in my C ++ business logic. The following code snippet sets up the handler and sets up a special category:
int main(int argc, char *argv[]) { qInstallMessageHandler(myMessageOutput); QLoggingCategory mainEx("main.ex"); qCDebug(mainEx) << "debug message"; ... }
The result is a call from the Qt server to the following installed message handler:
void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg) { ... }
In Qt 5, you can also write debugging messages directly in QML with:
console.debug("debug message")
But the "cateory" in the QMessageLogConext is always "qml". Is it possible to set another category directly in QML?
c ++ qt qml
fischeth
source share