Skip to content
hnbdr edited this page Jul 15, 2024 · 3 revisions

At the moment, debugger and QtQuick are only available in Windows Qt6 builds.

Debugger

  1. Install Qt Creator
  2. Run tiled with argument -qmljsdebugger=port:<port>,host:localhost,block

Select any free <port>, for example 12345.

The block directive is optional; it pauses execution until a debugger is connected, which allows extensions to be debugged at early stages of initialization)

  1. Open the extension script in Qt Creator
  2. Use Debug > Start Debugging > Attach to QML Port

QtQuick

Only the basic libraries are installed, which allows you to use the modules:

  • QtQuick
  • QtQuick.Controls
  • QtQuick.Dialogs
  • QtQuick.Layouts

If you need any more, I can easily add them.

Example of use:

const qmlString = `
    import QtQuick
    import QtQuick.Controls
    import QtQuick.Dialogs
    import QtQuick.Layouts

    Window {
        id: mainWindow
        signal okClicked()
        transientParent: null
        visible: true

        ColumnLayout {
          RowLayout {
            Text {
                text: "Hello!"
                color: "navy"
            }
          }

          RowLayout {
            Button {
                text: "Ok"
                onClicked: mainWindow.okClicked()
            }
            Button {
                text: "Cancel"
            }
          }
        }
    }`

const newObject = Qt.createQmlObject(qmlString, tiled, 'myDynamicSnippet')

newObject.okClicked.connect(() => tiled.log('Clicked!'))

Clone this wiki locally