We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I get a runtime panic when running the below code:
panic: object does not expose a "closeButtonClicked" signal
I got it to work fine in C++ with the same qml file.
package main
import ( "fmt" "github.com/niemeyer/qml" )
func main() { qml.Init(nil) engine := qml.NewEngine() component, err := engine.LoadFile("qmltest2.qml") if err != nil { panic(err) }
window := component.CreateWindow(nil) component.On("closeButtonClicked", func() { fmt.Println("Close button was clicked") }) window.Show() window.Wait()
}
import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Window 2.0 import QtQuick.Layouts 1.0
Item { id: root width: 200 height: 200
signal closeButtonClicked() ColumnLayout { anchors.fill: parent anchors.margins: 3 spacing: 2 Button { objectName: "mCloseButton" id: mCloseButton; text: qsTr("Close") anchors.horizontalCenter: parent.horizontalCenter onClicked: root.closeButtonClicked() } }
The text was updated successfully, but these errors were encountered:
@eivindro, the following works:
package main import ( "fmt" "github.com/niemeyer/qml" ) func main() { qml.Init(nil) engine := qml.NewEngine() component, err := engine.LoadFile("qmltest2.qml") if err != nil { panic(err) } window := component.CreateWindow(nil) window.Root().On("closeButtonClicked", func() { fmt.Println("Close button was clicked") }) window.Show() window.Wait() }
Sorry, something went wrong.
@oblitum You are right your way works. Hmm, it is a bit difficult to map the QML C++ documention to go-qml sometimes. Anyway, thanks!
Merge pull request #8 from hexid/fix-warnings
24d8b58
Fix warnings regarding PyObject_HEAD_INIT
No branches or pull requests
I get a runtime panic when running the below code:
panic: object does not expose a "closeButtonClicked" signal
I got it to work fine in C++ with the same qml file.
package main
import (
"fmt"
"github.com/niemeyer/qml"
)
func main() {
qml.Init(nil)
engine := qml.NewEngine()
component, err := engine.LoadFile("qmltest2.qml")
if err != nil {
panic(err)
}
}
import QtQuick 2.1
import QtQuick.Controls 1.0
import QtQuick.Window 2.0
import QtQuick.Layouts 1.0
Item {
id: root
width: 200
height: 200
}
The text was updated successfully, but these errors were encountered: