Skip to content
New issue

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

Type mismatch on Linux when sending an integer from Julia to QML #127

Open
a-ill opened this issue Jul 29, 2021 · 1 comment
Open

Type mismatch on Linux when sending an integer from Julia to QML #127

a-ill opened this issue Jul 29, 2021 · 1 comment
Labels
needs more info Clarification or reproducable example needed

Comments

@a-ill
Copy link

a-ill commented Jul 29, 2021

Here is a minimal reproducible example.


using QML, Qt5QuickControls2_jll

function get_int()
    return 1
end

function QML.loadqml(text::QByteArray; kwargs...)
    qml_engine = init_qmlengine()
    ctx = root_context(QML.CxxRef(qml_engine))
    for (key,value) in kwargs
        set_context_property(ctx, String(key), value)
    end
    component = QQmlComponent(qml_engine)
    QML.set_data(component, text, QUrl())
    create(component, qmlcontext())
    return component
end

text = QByteArray("""
    import QtQuick 2.15
    import QtQuick.Controls 2.15
    import org.julialang 1.0

    ApplicationWindow {
        visible: true
        Timer {
            running: true
            onTriggered: {
                var int_val = Julia.get_int()
                console.log(typeof int_val, int_val)
                Qt.quit()
            }
        }
    }
""")

@qmlfunction(get_int,send_int)
loadqml(text)
exec()

On Windows we get

Qt Debug: number 1 (:11, onTriggered)

On Linux we get

Qt Debug: object 1 (:11, onTriggered)

After using such a number with object type it sometimes becomes an empty object {} resulting in an error. Floats and strings do not have such an issue.

@ufechner7
Copy link
Member

Integers in QML are 32bit. Did you try sending 32 bit integers?

@ufechner7 ufechner7 added the needs more info Clarification or reproducable example needed label Sep 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs more info Clarification or reproducable example needed
Projects
None yet
Development

No branches or pull requests

2 participants