UI 接口
- 全局 UI 函数在命名空间 xplugin 下;
- pluginName 参数均传 PLUGIN_NAME(与 XPLUGIN_REGISTER 一致)。
- 返回值约定:0 成功,-1 插件名错误,-2 插件未初始化。
中心主界面
QWidget *mainWidget = new QWidget;
xplugin::CreateCenterWidget(PLUGIN_NAME, mainWidget);
底部状态栏
QLabel *statusBarLab = new QLabel;
xplugin::CreateStatusBar(PLUGIN_NAME, statusBarLab, 1); // index 默认 1
右侧扩展窗
QWidget *panel = new QWidget;
xplugin::CreateRightExpandWidgte(PLUGIN_NAME, panel, "panel1");
xplugin::SwitchRightExpandWidgte(PLUGIN_NAME, "panel1"); // name 为空则关闭
物理按键
xplugin::PhysicalButton btn;
btn.text = tr("Feed");
btn.exec_function = [](bool pressed) { /* ... */ };
QList<xplugin::PhysicalButton> left_buttons{btn};
xplugin::CreatePhyButtonList(PLUGIN_NAME, PLUGIN_NAME, left_buttons, {});
xplugin::ChangePhyButtonStatus(PLUGIN_NAME, PLUGIN_NAME, true); // 启用
xplugin::ChangeModelWindowStatus(PLUGIN_NAME, true); // 模态时不响应物理键
全屏与提示
xplugin::ChangeFullScreen(PLUGIN_NAME, true);
xplugin::ThrowLog(PLUGIN_NAME, xplugin::enThrowLogLevel::Info, tr("提示消息"));
辅助编程(RL)
通过 RLManager 注册工艺包 RL 指令组与插入/属性窗,见 接口说明 — RLManager。
xplugin::RLManager rlManager(this);
rlManager.createTypeKey("Custom");
rlManager.createGroups(tr("demo group"), "demo");
rlManager.createTypeToGroup("demo", "Custom");
rlManager.createSkeleton("Custom", "Custom");
rlManager.createInsertWidget("Custom", [](){ return new MyInsertWidget; });
- 也可用 createData(groupName, type, desc, insertFactory, propertyFactory) 一次完成普通指令注册。