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. Open a secondary window ans sent messages to it
Forum Updated to NodeBB v4.3 + New Features

Open a secondary window ans sent messages to it

Scheduled Pinned Locked Moved Solved QML and Qt Quick
qml windowmessages
3 Posts 2 Posters 362 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.
  • SteMMoS Offline
    SteMMoS Offline
    SteMMo
    wrote on last edited by SteMMo
    #1

    Hi all,
    I need to create a main window and together a secondary window, both visible.
    The main window contains some controls (buttons and up/down control): when the user presses one of these control I need to send a 'message' to the secondary window that will update some text content.
    First problem is to create the window: when I can create it?
    How?
    So far I'm trying to create it on a click of my custom control:

    ApplicationWindow {
        id: root
        visible: true
        width: 640
        height: 480
        title: qsTr("Baseball Table")
    
        property var win;
    
        MainForm {
    
            anchors.fill: parent
    
            upDownStrike.onPressedUp: {
                console.log("Strk+")
                var component = Qt.createComponent("qrc:/Table.qml");
                root.win = component.createObject(root);
                if (root.win){
                    root.win.show();
                }
            }
    
            upDownStrike.onPressedDown: console.log("Strk-")
        }
    

    This way I receive the error:

    qml: Strk+
    QQmlComponent: Component is not ready
    

    so the event is triggered but there is something wrong in my (simple) code.
    Which type the Secondary window should be? Item ? ApplicationWindow ?

    Once created the window, how can i send some message/information to secondary window?

    Thanks!

    1 Reply Last reply
    0
    • SteMMoS Offline
      SteMMoS Offline
      SteMMo
      wrote on last edited by
      #2

      Solved!
      In the Table.qml header there was a missing include file.
      Quite annoying: why this error was not shown before 'Component is not ready' message?

      I found it including the object defined in the Table.qml directly in the main file.

      1 Reply Last reply
      0
      • GrecKoG Offline
        GrecKoG Offline
        GrecKo
        Qt Champions 2018
        wrote on last edited by
        #3

        You can check the status of component with its status property and the errorString() method.

        1 Reply Last reply
        0

        • Login

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