我试图为我的项目创建一个样式插件,插件似乎正在加载,但为什么 QStyleFactory::keys() 没有返回我的密钥?通过将 QT_DEBUG_PLUGINS 设置为 1,我收到以下消息:
Found metadata in lib .../styles/libstyles.so, metadata=
{
"IID": "this.is.my.style",
"MetaData": {
"Keys": [
"mystyle"
]
},
"className": "MyStylePlugin",
"debug": true,
"version": 329986
}
在我的主要()中:
QApplication app(argc, argv);
QApplication::setStyle(QStyleFactory::create("mystyle"));
qDebug() << QStyleFactory::keys();
最后一个 qDebug 语句打印:
Got keys from plugin meta data ()
("Windows", "Fusion") <= Shouldn't "mystyle" also show up here?