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

Plugins not recognized by QT tools #242

Open
semtexzv opened this issue Feb 5, 2022 · 0 comments
Open

Plugins not recognized by QT tools #242

semtexzv opened this issue Feb 5, 2022 · 0 comments

Comments

@semtexzv
Copy link
Contributor

semtexzv commented Feb 5, 2022

I've been playing around, trying to get Rust plugins recognized by Qt Designer Studio, but failing miserably.
After some investigation, I have tracked it down to this:

It seems that the generated metadata is incomplete.

Test case:

  1. Simple cdylib crate, lib.rs with:
use std::ffi::CStr;
use cstr::cstr;
use qmetaobject::*;

#[derive(Default, QObject)]
struct QTTest {
    base: qt_base_class!(trait QObject),
}

#[derive(Default, QObject)]
struct QExampleQmlPlugin {
    base: qt_base_class!(trait QQmlExtensionPlugin),
    plugin: qt_plugin!("org.qt-project.Qt.QQmlExtensionInterface/1.0"),
}

impl QQmlExtensionPlugin for QExampleQmlPlugin {
    fn register_types(&mut self, uri: &CStr) {
        assert_eq!(uri, cstr!("XFlow"));
        qml_register_type::<QTTest>(uri, 1, 0, cstr!("XFlow"));
    }
}

Running

cd target/debug
QT_PLUGIN_PATH=`pwd` qtplugininfo ./lib<whatever>.so

results in

IID "org.qt-project.Qt.QQmlExtensionInterface/1.0" Qt 5.1.0 (debug)
qtplugininfo: ./libxflow_gui.so: invalid metadata, user data is not a JSON object

And running

cd target/debug
QT_PLUGIN_PATH=`pwd`  qmlplugindump -v XFlow 1.0  ./libxflow_gui.so

fails outright with

QQmlComponent: Component is not ready
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant