From scopy_dev_plugin
Provides C++ patterns for IIOWidgetBuilder to create spinbox, combo, checkbox, and read-only widgets binding UI to IIO device attributes in plugins.
How this skill is triggered — by the user, by Claude, or both
Slash command
/scopy_dev_plugin:iiowidget-patternsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Rules for creating `IIOWidget` instances to bind UI controls to IIO device attributes.
Rules for creating IIOWidget instances to bind UI controls to IIO device attributes.
IIOWidget *widget = IIOWidgetBuilder(parent)
.device(dev) // or .channel(ch) if channel-specific
.attribute("attr")
.optionsAttribute("attr_available")
.title("Attribute Display Name")
.uiStrategy(IIOWidgetBuilder::RangeUi)
.infoMessage("Hover tooltip text")
.group(m_group)
.buildSingle();
connect(this, &MyTool::readRequested, widget, &IIOWidget::readAsync);
IIOWidget *widget = IIOWidgetBuilder(parent)
.device(dev)
.attribute("attr")
.optionsValues("MIN MAX STEP") // e.g. "0 100 1"
.title("Attribute Display Name")
.uiStrategy(IIOWidgetBuilder::RangeUi)
.group(m_group)
.buildSingle();
IIOWidget *widget = IIOWidgetBuilder(parent)
.device(dev)
.attribute("attr")
.optionsAttribute("attr_available")
.title("Attribute Display Name")
.uiStrategy(IIOWidgetBuilder::ComboUi)
.group(m_group)
.buildSingle();
QMap<QString, QString> optionsMap;
optionsMap["value1"] = "Display_Text_1";
optionsMap["value2"] = "Display_Text_2";
QString optionsValues = "Display_Text_1 Display_Text_2";
IIOWidget *widget = IIOWidgetBuilder(parent)
.device(dev)
.attribute("attr")
.optionsValues(optionsValues)
.title("Attribute Display Name")
.uiStrategy(IIOWidgetBuilder::ComboUi)
.group(m_group)
.buildSingle();
widget->setUItoDataConversion([optionsMap](QString displayValue) {
return IIOWidgetUtils::comboUiToDataConversionFunction(displayValue, &optionsMap);
});
widget->setDataToUIConversion([optionsMap](QString attrValue) {
return IIOWidgetUtils::comboDataToUiConversionFunction(attrValue, &optionsMap);
});
IIOWidget *widget = IIOWidgetBuilder(parent)
.device(dev)
.attribute("attr")
.title("Attribute Display Name")
.uiStrategy(IIOWidgetBuilder::CheckBoxUi)
.group(m_group)
.buildSingle();
IIOWidget *widget = IIOWidgetBuilder(parent)
.channel(ch)
.attribute("status_attr")
.title("Status Display Name")
.group(m_group)
.buildSingle();
widget->setEnabled(false);
QTimer *timer = new QTimer(parent);
int *failCount = new int(0);
connect(timer, &QTimer::timeout, widget, &IIOWidget::readAsync);
connect(widget, &IIOWidget::currentStateChanged, timer,
[timer, failCount](IIOWidget::State state, QString) {
if(state == IIOWidget::Error) {
(*failCount)++;
if(*failCount >= 2) timer->stop();
} else if(state == IIOWidget::Correct) {
*failCount = 0;
}
});
timer->start(1000);
When an attribute needs unit conversion (e.g., Hz to MHz), set ALL THREE functions:
widget->setDataToUIConversion([](QString data) {
return QString::number(data.toDouble() / 1e6, 'f', 6);
});
widget->setRangeToUIConversion([](QString data) {
return QString::number(data.toDouble() / 1e6, 'f', 6);
});
widget->setUItoDataConversion([](QString data) {
return QString::number(data.toDouble() * 1e6, 'f', 0);
});
readRequested -> readAsync (caller's responsibility)currentStateChanged signal (NOT readFailed/readSuccess — those don't exist).group(m_group) in the builder chain"Fast_Attack" not "Fast Attack"Range/Spinbox: Has *_available attr? YES -> use .optionsAttribute(). NO -> use .optionsValues("MIN MAX STEP")
Combo: Has *_available attr? YES -> .optionsAttribute(). NO -> custom values with .optionsValues() + conversion functions
Each strategy has a dedicated file with real codebase examples:
| Strategy | File | Use Case |
|---|---|---|
RangeUi | range-widget.md | Numeric attributes with min/max/step (spinbox/slider) |
ComboUi | combo-widget.md | Discrete options (dropdown) |
CheckBoxUi | checkbox-widget.md | Boolean/enable toggle |
EditableUi | editable-widget.md | Free-form text input (no range) |
| Read-only | readonly-widget.md | Disabled display with optional timer polling |
TemperatureUi | temperature-widget.md | Temperature with critical threshold warnings |
npx claudepluginhub analogdevicesinc/scopy --plugin scopy_dev_pluginDefines C++ patterns for Scopy plugin API classes: ApiObject inheritance, Q_INVOKABLE tool/widget methods, friend access to IIOWidgetGroup, and plugin lifecycle integration. For API and test automation development.
Builds and inspects Blueprint widget trees in UAsset files via CLI for add, remove, write, read, init, and parent-class operations.
Guides creation of reusable Makepad widgets with patterns for modal, collapsible, drag-drop, text/image toggle, and page flip. Triggers on widget design keywords like 'reusable widget'.