Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. ApplicationWindow initialize
Forum Updated to NodeBB v4.3 + New Features

ApplicationWindow initialize

Scheduled Pinned Locked Moved Solved QML and Qt Quick
5 Posts 2 Posters 1.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    webberg
    wrote on 14 Oct 2016, 09:32 last edited by
    #1

    I want to open a file with my program by double-click it. I google and find the file path strored in argv[1] in main function. So I use setContextProperty to pass the argv[1] to QML. But I use ApplicationWindow in QML so Component.onCompleted doesn't trigger. How should I call my initial function after ApplicationWindow showed?

    1 Reply Last reply
    0
    • P Offline
      P Offline
      p3c0
      Moderators
      wrote on 14 Oct 2016, 09:48 last edited by
      #2

      @webberg Are you sure ApplicationWindow is called ? How do you load the QML from C++ ?

      But I use ApplicationWindow in QML so Component.onCompleted doesn't trigger.

      It should.

      157

      W 1 Reply Last reply 14 Oct 2016, 10:19
      0
      • P p3c0
        14 Oct 2016, 09:48

        @webberg Are you sure ApplicationWindow is called ? How do you load the QML from C++ ?

        But I use ApplicationWindow in QML so Component.onCompleted doesn't trigger.

        It should.

        W Offline
        W Offline
        webberg
        wrote on 14 Oct 2016, 10:19 last edited by
        #3

        @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.

        1 Reply Last reply
        0
        • P Offline
          P Offline
          p3c0
          Moderators
          wrote on 14 Oct 2016, 10:28 last edited by
          #4

          @webberg AFAIK all QML types have that signal handler. There must be some other problem. Can you post a minimal example ?

          157

          W 1 Reply Last reply 17 Oct 2016, 02:38
          1
          • P p3c0
            14 Oct 2016, 10:28

            @webberg AFAIK all QML types have that signal handler. There must be some other problem. Can you post a minimal example ?

            W Offline
            W Offline
            webberg
            wrote on 17 Oct 2016, 02:38 last edited by
            #5

            @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 qInstallMessageHandler redirect output to log file. Thx very much!

            1 Reply Last reply
            0

            1/5

            14 Oct 2016, 09:32

            • Login

            • Login or register to search.
            1 out of 5
            • First post
              1/5
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved