Plugins not recognized by QT tools
semtexzv opened this issue · 0 comments
semtexzv commented
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:
- 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