forked from mapeditor/tiled
-
Notifications
You must be signed in to change notification settings - Fork 0
Home
hnbdr edited this page Jul 15, 2024
·
3 revisions
At the moment, debugger and QtQuick are only available in Windows Qt6 builds.
- Install Qt Creator
- 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)
- Open the extension script in Qt Creator
- Use Debug > Start Debugging > Attach to QML Port
Only the basic libraries are installed, which allows you to use the modules:
QtQuickQtQuick.ControlsQtQuick.DialogsQtQuick.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!'))