7#include <QtDesigner/membersheet.h>
8#include <QtDesigner/abstractformwindow.h>
9#include <QtDesigner/abstractformeditor.h>
10#include <QtDesigner/abstractpropertyeditor.h>
12#include <QtDesigner/qextensionmanager.h>
13#include <private/qdesigner_utils_p.h>
14#include <QtCore/qdebug.h>
15#include <QtCore/qtimer.h>
19using namespace Qt::StringLiterals;
25 return value.canConvert<qdesigner_internal::PropertySheetStringValue>() ?
26 qvariant_cast<qdesigner_internal::PropertySheetStringValue>(value).value() :
31 QDesignerPropertySheet(object, parent),
32 m_controlProperty(controlPropertyName),
33 m_propertyGroup(u"QAxWidget"_s)
36 const int controlIndex = QDesignerPropertySheet::indexOf(m_controlProperty);
37 setPropertyGroup(controlIndex, m_propertyGroup);
43 if (propertyName(index) == m_controlProperty)
45 return QDesignerPropertySheet::isEnabled(index);
51 return propertyName(index) !=
"classContext"_L1;
67 const QString name = propertyName(index);
68 const auto it = m_currentProperties.changedProperties.find(name);
69 if (it != m_currentProperties.changedProperties.end())
70 m_currentProperties.changedProperties.erase(it);
71 if (name != m_controlProperty)
72 return QDesignerPropertySheet::reset(index);
74 QTimer::singleShot(0,
this, &QAxWidgetPropertySheet::updatePropertySheet);
82 return propertyName(index) == m_controlProperty ?
83 QVariant(axWidget()->control()) :
84 QDesignerPropertySheet::property(index);
91 const QString name = propertyName(index);
92 m_currentProperties.changedProperties[name] = value;
93 if (name != m_controlProperty) {
94 QDesignerPropertySheet::setProperty(index, value);
98 if (name == m_controlProperty) {
99 const QString clsid = designerPropertyToString(value);
100 if (clsid.isEmpty() || !axWidget()->loadControl(clsid))
103 QTimer::singleShot(100,
this, &QAxWidgetPropertySheet::updatePropertySheet);
109 const int index = QDesignerPropertySheet::indexOf(name);
113 const QVariant dummValue(0);
115 const int newIndex = that->createFakeProperty(name, dummValue);
116 that->setPropertyGroup(newIndex, m_propertyGroup);
123 struct SavedProperties tmp = m_currentProperties;
125 QDesignerFormWindowInterface *formWin = QDesignerFormWindowInterface::findFormWindow(axw);
126 Q_ASSERT(formWin !=
nullptr);
128 tmp.clsid = axw->control();
131 delete qt_extension<QDesignerMemberSheetExtension *>(formWin->core()->extensionManager(), axw);
132 reloadPropertySheet(tmp, formWin);
136 QDesignerFormWindowInterface *formWin)
138 QDesignerFormEditorInterface *core = formWin->core();
140 auto sheet = qt_extension<QDesignerPropertySheetExtension *>(core->extensionManager(),
143 bool foundGeometry =
false;
144 const QString geometryProperty =
"geometry"_L1;
145 for (
auto i = properties.changedProperties.cbegin(), cend = properties.changedProperties.cend();
147 const QString name = i.key();
148 const int index = sheet->indexOf(name);
154 if (name == geometryProperty) {
155 sheet->setChanged(index,
true);
156 foundGeometry =
true;
160 sheet->setChanged(index, !designerPropertyToString(i.value()).isEmpty());
163 sheet->setChanged(index,
true);
164 sheet->setProperty(index, i.value());
168 sheet->setChanged(sheet->indexOf(geometryProperty),
true);
170 if (core->propertyEditor()->object() == properties.widget) {
171 formWin->clearSelection(
true);
172 formWin->selectWidget(properties.widget);
Combined button and popup list for selecting options.