Yes, You can: complete solution is combination of Yours 1st and 2nd and some 3rd step:
- Create setters and getters wrappers for the child widgets in the QWidget using Q_PROPERTY
- Add this line to plugin widget (respectively "__qt__passive_textEdit" for the textEdit), QtDesigner then allows to click on the combobox and change the selected value. This behavior described here.
- Change property in property editor and mark it as changed by following code which You can add to combobox index change slot or handler:
changeQtDesignerProperty("currentIndex", index);
where
void MyPlugin::changeQtDesignerProperty(QString propertyName, QVariant value)
{
#if defined(QT_PLUGIN)
QDesignerFormWindowInterface *form =
QDesignerFormWindowInterface::findFormWindow(this);
if(form)
{
if(!mSheet) // Need to create sheet only once
{
QDesignerFormEditorInterface *editor = form->core();
QExtensionManager *manager = editor->extensionManager();
mSheet = qt_extension(manager, this);
}
// Set property in Qt Designer
int propertyIndex = mSheet->indexOf(propertyName);
mSheet->setProperty(propertyIndex, value);
mSheet->setChanged(propertyIndex, true);
}
#endif
}
With other properties need to do the same. And need to delete mSheet;
in MyPlugin
destructor. mSheet
initialized as QDesignerPropertySheetExtension *mSheet = 0;
.
Unlike 2nd step, 3rd step is well documented in Qt Doc. Even with examples.