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. Import Causing - Qt Quick Emulation Layer Crashed
Forum Updated to NodeBB v4.3 + New Features

Import Causing - Qt Quick Emulation Layer Crashed

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 1.4k 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.
  • G Offline
    G Offline
    gerardbyrne
    wrote on last edited by
    #1

    I have been using Qt Creator for a short while and the QML files presented themselves in the Design window just fine. Suddenly now the QML files give me an error as shown below.
    My file starts with

    import QtQuick 2.0
    import QtQuick.Window 2.10
    import QtMultimedia 5.9

    import "jsscript.js" as MyScript

    Window {
    id: splashscreen
    visible: true

    If I comment the import "jsscript.js" as MyScript in the Designer window the file displays fine.

    Is there a reason why this has started to happen. Thanks for any help.
    0_1546041710496_1Error.png

    0_1546041721981_2Version.png

    1 Reply Last reply
    0
    • KazuoAsanoK Offline
      KazuoAsanoK Offline
      KazuoAsano
      Qt Champions 2018
      wrote on last edited by
      #2

      @gerardbyrne ,

      QtQuick designer of QtCreator doesn't support JavaScript.
      It can only change the design related function.

      Qt Documentation : Qt Quick UI Forms
      0_1546072527277_QtQuickUi.png

      Therefore, QML file distinguish between as below two files.

      • A. Using in QtQuick designer file:
        ${ObjectName}Form.ui.qml

      • B. JavaScript / Signal Handlers processing file:
        ${ObjectName}.qml

      It would be preferable if B file use only in Edit mode at QtCreator.
      For example:

      SampleForm.ui.qml (this file can use in QtQuickDesigner)

      import QtQuick 2.4
      
      Rectangle {
        id: rectangle
        color: "blue"
        property alias mouseArea: mouseArea
      
          MouseArea {
              id: mouseArea
              width: parent.width
              height: parent.height
          }
      }
      

      Sample.qml(this file can use Edit mode in Qt Creator)

      import QtQuick 2.4
      import "Console_log.js" as DebugLog 
      
      SampleForm {
        mouseArea.onClicked: {  //this file can use slot function
          DebugLog.log()    //this file can use js
        }
      }
      

      You may be also deepen my comment's understanding by below blog post.

      Qt Blog Proposal: Qt Quick Designer Workflow

      1 Reply Last reply
      2
      • G Offline
        G Offline
        gerardbyrne
        wrote on last edited by
        #3

        Thank you for you help, I appreciate you taking the time to help me.

        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