8#include <QtDesigner/membersheet.h>
9#include <QtDesigner/abstractformwindow.h>
10#include <QtDesigner/abstractformeditor.h>
11#include <QtDesigner/abstractpropertyeditor.h>
13#include <QtDesigner/qextensionmanager.h>
14#include <private/qdesigner_utils_p.h>
15#include <QtCore/qdebug.h>
16#include <QtCore/qtimer.h>
20using namespace Qt::StringLiterals;
26 return value.canConvert<qdesigner_internal::PropertySheetStringValue>() ?
27 qvariant_cast<qdesigner_internal::PropertySheetStringValue>(value).value() :
32 QDesignerPropertySheet(object, parent),
33 m_controlProperty(controlPropertyName),
34 m_propertyGroup(u"QAxWidget"_s)
37 const int controlIndex = QDesignerPropertySheet::indexOf(m_controlProperty);
38 setPropertyGroup(controlIndex, m_propertyGroup);
44 if (propertyName(index) == m_controlProperty)
46 return QDesignerPropertySheet::isEnabled(index);
52 return propertyName(index) !=
"classContext"_L1;
68 const QString name = propertyName(index);
69 const auto it = m_currentProperties.changedProperties.find(name);
70 if (it != m_currentProperties.changedProperties.end())
71 m_currentProperties.changedProperties.erase(it);
72 if (name != m_controlProperty)
73 return QDesignerPropertySheet::reset(index);
75 QTimer::singleShot(0,
this, &QAxWidgetPropertySheet::updatePropertySheet);
83 return propertyName(index) == m_controlProperty ?
84 QVariant(axWidget()->control()) :
85 QDesignerPropertySheet::property(index);
92 const QString name = propertyName(index);
93 m_currentProperties.changedProperties[name] = value;
94 if (name != m_controlProperty) {
95 QDesignerPropertySheet::setProperty(index, value);
99 if (name == m_controlProperty) {
100 const QString clsid = designerPropertyToString(value);
101 if (clsid.isEmpty() || !axWidget()->loadControl(clsid))
104 QTimer::singleShot(100,
this, &QAxWidgetPropertySheet::updatePropertySheet);
110 const int index = QDesignerPropertySheet::indexOf(name);
114 const QVariant dummValue(0);
116 const int newIndex = that->createFakeProperty(name, dummValue);
117 that->setPropertyGroup(newIndex, m_propertyGroup);
124 struct SavedProperties tmp = m_currentProperties;
126 QDesignerFormWindowInterface *formWin = QDesignerFormWindowInterface::findFormWindow(axw);
127 Q_ASSERT(formWin !=
nullptr);
129 tmp.clsid = axw->control();
132 delete qt_extension<QDesignerMemberSheetExtension *>(formWin->core()->extensionManager(), axw);
133 reloadPropertySheet(tmp, formWin);
137 QDesignerFormWindowInterface *formWin)
139 QDesignerFormEditorInterface *core = formWin->core();
141 auto sheet = qt_extension<QDesignerPropertySheetExtension *>(core->extensionManager(),
144 bool foundGeometry =
false;
145 const QString geometryProperty =
"geometry"_L1;
146 for (
auto i = properties.changedProperties.cbegin(), cend = properties.changedProperties.cend();
148 const QString name = i.key();
149 const int index = sheet->indexOf(name);
155 if (name == geometryProperty) {
156 sheet->setChanged(index,
true);
157 foundGeometry =
true;
161 sheet->setChanged(index, !designerPropertyToString(i.value()).isEmpty());
164 sheet->setChanged(index,
true);
165 sheet->setProperty(index, i.value());
169 sheet->setChanged(sheet->indexOf(geometryProperty),
true);
171 if (core->propertyEditor()->object() == properties.widget) {
172 formWin->clearSelection(
true);
173 formWin->selectWidget(properties.widget);
Combined button and popup list for selecting options.