Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
I want to open a file with my program by double-click it. I google and find the file path strored in argv in main function. So I use
setContextPropertyto pass the argv to QML. But I use
ApplicationWindowin QML so
Component.onCompleteddoesn't trigger. How should I call my initial function after
@webberg Are you sure
ApplicationWindowis called ? How do you load the QML from C++ ?
But I use ApplicationWindow in QML so Component.onCompleted doesn't trigger.
@p3c0 I'm sure it is called because ApplicationWindow is showed and all menu works well. The Creator tips me that Component has only these members:
deleteLater errorString objectName progress status url Error Loading Null Ready
I try to add print("test") to the onCompleted method. After program show I get nothing "test" in output window.
@webberg AFAIK all QML types have that signal handler. There must be some other problem. Can you post a minimal example ?
@p3c0 You are right. I write a minimal example and it works. The I comment my code but still couldn't find the output. Finally I find I use
qInstallMessageHandlerredirect output to log file. Thx very much!