696int QDesignerPropertySheet::addDynamicProperty(
const QString &propName,
const QVariant &value)
698 using Info = QDesignerPropertySheetPrivate::Info;
699 if (!value.isValid())
701 if (!canAddDynamicProperty(propName))
705 switch (value.metaType().id()) {
706 case QMetaType::QIcon:
707 v = QVariant::fromValue(qdesigner_internal::PropertySheetIconValue());
709 case QMetaType::QPixmap:
710 v = QVariant::fromValue(qdesigner_internal::PropertySheetPixmapValue());
712 case QMetaType::QString:
713 v = QVariant::fromValue(qdesigner_internal::PropertySheetStringValue(value.toString()));
715 case QMetaType::QStringList:
716 v = QVariant::fromValue(qdesigner_internal::PropertySheetStringListValue(value.toStringList()));
718 case QMetaType::QKeySequence: {
719 const QKeySequence keySequence = qvariant_cast<QKeySequence>(value);
720 v = QVariant::fromValue(qdesigner_internal::PropertySheetKeySequenceValue(keySequence));
725 if (d->m_addIndex.contains(propName)) {
726 const int idx = d->m_addIndex.value(propName);
728 setVisible(idx,
true);
729 d->m_addProperties.insert(idx, v);
730 setChanged(idx,
false);
731 const int index = d->m_meta->indexOfProperty(propName);
732 Info &info = d->ensureInfo(index);
733 info.defaultValue = value;
734 info.kind = QDesignerPropertySheetPrivate::DynamicProperty;
735 switch (value.metaType().id()) {
736 case QMetaType::QIcon:
737 case QMetaType::QPixmap:
738 d->addResourceProperty(idx, value.metaType().id());
740 case QMetaType::QString:
741 d->addStringProperty(idx);
743 case QMetaType::QKeySequence:
744 d->addKeySequenceProperty(idx);
750 const int index = count();
751 d->m_addIndex.insert(propName, index);
752 d->m_addProperties.insert(index, v);
753 Info &info = d->ensureInfo(index);
755 info.changed =
false;
756 info.defaultValue = value;
757 info.kind = QDesignerPropertySheetPrivate::DynamicProperty;
758 setPropertyGroup(index, tr(
"Dynamic Properties"));
759 switch (value.metaType().id()) {
760 case QMetaType::QIcon:
761 case QMetaType::QPixmap:
762 d->addResourceProperty(index, value.metaType().id());
764 case QMetaType::QString:
765 d->addStringProperty(index);
767 case QMetaType::QStringList:
768 d->addStringListProperty(index);
770 case QMetaType::QKeySequence:
771 d->addKeySequenceProperty(index);
788bool QDesignerPropertySheet::isDynamic(
int index)
const
790 if (!d->m_addProperties.contains(index))
793 switch (propertyType(index)) {
795 if (d->m_objectType == ObjectLabel)
798 case PropertyLayoutLeftMargin:
799 case PropertyLayoutTopMargin:
800 case PropertyLayoutRightMargin:
801 case PropertyLayoutBottomMargin:
802 case PropertyLayoutSpacing:
803 case PropertyLayoutHorizontalSpacing:
804 case PropertyLayoutVerticalSpacing:
805 case PropertyLayoutObjectName:
806 case PropertyLayoutSizeConstraint:
807 case PropertyLayoutFieldGrowthPolicy:
808 case PropertyLayoutRowWrapPolicy:
809 case PropertyLayoutLabelAlignment:
810 case PropertyLayoutFormAlignment:
811 case PropertyLayoutBoxStretch:
812 case PropertyLayoutGridRowStretch:
813 case PropertyLayoutGridColumnStretch:
814 case PropertyLayoutGridRowMinimumHeight:
815 case PropertyLayoutGridColumnMinimumWidth:
816 if (d->m_object->isWidgetType() && d->m_canHaveLayoutAttributes)
871int QDesignerPropertySheet::createFakeProperty(
const QString &propertyName,
const QVariant &value)
873 using Info = QDesignerPropertySheetPrivate::Info;
875 const int index = d->m_meta->indexOfProperty(propertyName);
877 if (!(d->m_meta->property(index)->attributes() & QDesignerMetaPropertyInterface::DesignableAttribute))
879 Info &info = d->ensureInfo(index);
880 info.visible =
false;
881 info.kind = QDesignerPropertySheetPrivate::FakeProperty;
882 QVariant v = value.isValid() ? value : metaProperty(index);
883 switch (v.metaType().id()) {
884 case QMetaType::QString:
885 v = QVariant::fromValue(qdesigner_internal::PropertySheetStringValue());
887 case QMetaType::QStringList:
888 v = QVariant::fromValue(qdesigner_internal::PropertySheetStringListValue());
890 case QMetaType::QKeySequence:
891 v = QVariant::fromValue(qdesigner_internal::PropertySheetKeySequenceValue());
894 d->m_fakeProperties.insert(index, v);
897 if (!value.isValid())
900 const int newIndex = count();
901 d->m_addIndex.insert(propertyName, newIndex);
902 d->m_addProperties.insert(newIndex, value);
903 Info &info = d->ensureInfo(newIndex);
904 info.propertyType = propertyTypeFromName(propertyName);
905 info.kind = QDesignerPropertySheetPrivate::FakeProperty;
986QVariant QDesignerPropertySheet::property(
int index)
const
988 if (d->invalidIndex(Q_FUNC_INFO, index))
990 if (isAdditionalProperty(index)) {
991 if (isFakeLayoutProperty(index)) {
992 QDesignerPropertySheetExtension *layoutPropertySheet;
993 if (d->layout(&layoutPropertySheet) && layoutPropertySheet) {
994 const QString newPropName = d->transformLayoutPropertyName(index);
995 if (!newPropName.isEmpty()) {
996 const int newIndex = layoutPropertySheet->indexOf(newPropName);
998 return layoutPropertySheet->property(newIndex);
1003 return d->m_addProperties.value(index);
1006 if (isFakeProperty(index)) {
1007 return d->m_fakeProperties.value(index);
1010 if (d->isResourceProperty(index))
1011 return d->resourceProperty(index);
1013 if (d->isStringProperty(index)) {
1014 QString strValue = metaProperty(index).toString();
1015 qdesigner_internal::PropertySheetStringValue value = d->stringProperty(index);
1016 if (strValue != value.value()) {
1017 value.setValue(strValue);
1018 d->setStringProperty(index, value);
1020 return QVariant::fromValue(value);
1023 if (d->isStringListProperty(index)) {
1024 const QStringList listValue = metaProperty(index).toStringList();
1025 qdesigner_internal::PropertySheetStringListValue value = d->stringListProperty(index);
1026 if (listValue != value.value()) {
1027 value.setValue(listValue);
1028 d->setStringListProperty(index, value);
1030 return QVariant::fromValue(value);
1033 if (d->isKeySequenceProperty(index)) {
1034 QKeySequence keyValue = qvariant_cast<QKeySequence>(metaProperty(index));
1035 qdesigner_internal::PropertySheetKeySequenceValue value = d->keySequenceProperty(index);
1036 if (keyValue != value.value()) {
1037 value.setValue(keyValue);
1038 d->setKeySequenceProperty(index, value);
1040 return QVariant::fromValue(value);
1043 QVariant result = metaProperty(index);
1048 if (result.typeId() == QMetaType::Bool && !result.toBool()
1049 && d->m_object->isWidgetType()
1050 && propertyType(index) == PropertyVisible) {
1051 if (
auto *hv = qobject_cast<QHeaderView *>(d->m_object)) {
1052 if (
auto *parent = hv->parentWidget()) {
1053 if (!parent->isVisible())
1054 result = QVariant(!hv->testAttribute(Qt::WA_WState_Hidden));
1084QVariant QDesignerPropertySheet::resolvePropertyValue(
int index,
const QVariant &value)
const
1086 if (value.canConvert<qdesigner_internal::PropertySheetEnumValue>())
1087 return qvariant_cast<qdesigner_internal::PropertySheetEnumValue>(value).value;
1089 if (value.canConvert<qdesigner_internal::PropertySheetFlagValue>())
1090 return qvariant_cast<qdesigner_internal::PropertySheetFlagValue>(value).value;
1092 if (value.canConvert<qdesigner_internal::PropertySheetStringValue>())
1093 return qvariant_cast<qdesigner_internal::PropertySheetStringValue>(value).value();
1095 if (value.canConvert<qdesigner_internal::PropertySheetStringListValue>())
1096 return qvariant_cast<qdesigner_internal::PropertySheetStringListValue>(value).value();
1098 if (value.canConvert<qdesigner_internal::PropertySheetKeySequenceValue>())
1099 return QVariant::fromValue(qvariant_cast<qdesigner_internal::PropertySheetKeySequenceValue>(value).value());
1101 if (value.canConvert<qdesigner_internal::PropertySheetPixmapValue>()) {
1102 const QString path = qvariant_cast<qdesigner_internal::PropertySheetPixmapValue>(value).path();
1104 return defaultResourceProperty(index);
1105 if (d->m_pixmapCache) {
1106 return d->m_pixmapCache->pixmap(qvariant_cast<qdesigner_internal::PropertySheetPixmapValue>(value));
1110 if (value.canConvert<qdesigner_internal::PropertySheetIconValue>()) {
1111 const unsigned mask = qvariant_cast<qdesigner_internal::PropertySheetIconValue>(value).mask();
1113 return defaultResourceProperty(index);
1115 return d->m_iconCache->icon(qvariant_cast<qdesigner_internal::PropertySheetIconValue>(value));
1158void QDesignerPropertySheet::setProperty(
int index,
const QVariant &value)
1160 if (d->invalidIndex(Q_FUNC_INFO, index))
1162 if (isAdditionalProperty(index)) {
1163 if (d->m_objectType == ObjectLabel && propertyType(index) == PropertyBuddy) {
1164 QFormBuilderExtra::applyBuddy(value.toString(), QFormBuilderExtra::BuddyApplyVisibleOnly, qobject_cast<QLabel *>(d->m_object));
1165 d->m_addProperties[index] = toByteArray(value);
1169 if (isFakeLayoutProperty(index)) {
1170 QDesignerPropertySheetExtension *layoutPropertySheet;
1171 if (d->layout(&layoutPropertySheet) && layoutPropertySheet) {
1172 const QString newPropName = d->transformLayoutPropertyName(index);
1173 if (!newPropName.isEmpty()) {
1174 const int newIndex = layoutPropertySheet->indexOf(newPropName);
1176 layoutPropertySheet->setProperty(newIndex, value);
1181 if (isDynamicProperty(index) || isDefaultDynamicProperty(index)) {
1182 if (d->isResourceProperty(index))
1183 d->setResourceProperty(index, value);
1184 if (d->isStringProperty(index))
1185 d->setStringProperty(index, qvariant_cast<qdesigner_internal::PropertySheetStringValue>(value));
1186 if (d->isStringListProperty(index))
1187 d->setStringListProperty(index, qvariant_cast<qdesigner_internal::PropertySheetStringListValue>(value));
1188 if (d->isKeySequenceProperty(index))
1189 d->setKeySequenceProperty(index, qvariant_cast<qdesigner_internal::PropertySheetKeySequenceValue>(value));
1190 d->m_object->setProperty(propertyName(index).toUtf8(), resolvePropertyValue(index, value));
1191 if (d->m_object->isWidgetType()) {
1192 QWidget *w = qobject_cast<QWidget *>(d->m_object);
1193 w->setStyleSheet(w->styleSheet());
1196 d->m_addProperties[index] = value;
1197 }
else if (isFakeProperty(index)) {
1198 setFakeProperty(index, value);
1200 if (d->isResourceProperty(index))
1201 d->setResourceProperty(index, value);
1202 if (d->isStringProperty(index))
1203 d->setStringProperty(index, qvariant_cast<qdesigner_internal::PropertySheetStringValue>(value));
1204 if (d->isStringListProperty(index))
1205 d->setStringListProperty(index, qvariant_cast<qdesigner_internal::PropertySheetStringListValue>(value));
1206 if (d->isKeySequenceProperty(index))
1207 d->setKeySequenceProperty(index, qvariant_cast<qdesigner_internal::PropertySheetKeySequenceValue>(value));
1208 const QDesignerMetaPropertyInterface *p = d->m_meta->property(index);
1209 p->write(d->m_object, resolvePropertyValue(index, value));
1210 if (qobject_cast<QGroupBox *>(d->m_object) && propertyType(index) == PropertyCheckable) {
1211 const int idx = indexOf(u"focusPolicy"_s);
1212 if (!isChanged(idx)) {
1213 qdesigner_internal::PropertySheetEnumValue e = qvariant_cast<qdesigner_internal::PropertySheetEnumValue>(property(idx));
1214 if (value.toBool()) {
1215 const QDesignerMetaPropertyInterface *p = d->m_meta->property(idx);
1216 p->write(d->m_object, Qt::NoFocus);
1217 e.value = Qt::StrongFocus;
1220 setFakeProperty(idx, v);
1222 e.value = Qt::NoFocus;
1225 setFakeProperty(idx, v);
1241bool QDesignerPropertySheet::reset(
int index)
1243 if (d->invalidIndex(Q_FUNC_INFO, index))
1245 if (d->isStringProperty(index)) {
1246 qdesigner_internal::PropertySheetStringValue value;
1248 if (propertyName(index) ==
"objectName"_L1) {
1249 const QVariant classNameDefaultV = d->m_object->property(
"_q_classname");
1250 if (classNameDefaultV.isValid())
1251 value.setValue(classNameDefaultV.toString());
1252 }
else if (!isAdditionalProperty(index)) {
1253 const QDesignerMetaPropertyInterface *property = d->m_meta->property(index);
1254 if ((property->accessFlags() & QDesignerMetaPropertyInterface::ResetAccess) && property->reset(d->m_object))
1255 value.setValue(property->read(d->m_object).toString());
1259 setProperty(index, QVariant::fromValue(value));
1262 if (d->isStringListProperty(index))
1263 setProperty(index, QVariant::fromValue(qdesigner_internal::PropertySheetStringListValue()));
1264 if (d->isKeySequenceProperty(index))
1265 setProperty(index, QVariant::fromValue(qdesigner_internal::PropertySheetKeySequenceValue()));
1266 if (d->isResourceProperty(index)) {
1267 setProperty(index, d->emptyResourceProperty(index));
1270 if (isDynamic(index)) {
1271 const QString propName = propertyName(index);
1272 const QVariant oldValue = d->m_addProperties.value(index);
1273 const QVariant defaultValue = d->m_info.value(index).defaultValue;
1274 QVariant newValue = defaultValue;
1275 if (d->isStringProperty(index)) {
1276 newValue = QVariant::fromValue(qdesigner_internal::PropertySheetStringValue(newValue.toString()));
1277 }
else if (d->isStringListProperty(index)) {
1278 newValue = QVariant::fromValue(qdesigner_internal::PropertySheetStringListValue(newValue.toStringList()));
1279 }
else if (d->isKeySequenceProperty(index)) {
1280 const QKeySequence keySequence = qvariant_cast<QKeySequence>(newValue);
1281 newValue = QVariant::fromValue(qdesigner_internal::PropertySheetKeySequenceValue(keySequence));
1283 if (oldValue == newValue)
1285 d->m_object->setProperty(propName.toUtf8(), defaultValue);
1286 d->m_addProperties[index] = newValue;
1288 }
else if (!d->m_info.value(index).defaultValue.isNull()) {
1289 setProperty(index, d->m_info.value(index).defaultValue);
1292 if (isAdditionalProperty(index)) {
1293 const PropertyType pType = propertyType(index);
1294 if (d->m_objectType == ObjectLabel && pType == PropertyBuddy) {
1295 setProperty(index, QVariant(QByteArray()));
1298 if (isFakeLayoutProperty(index)) {
1301 case PropertyLayoutObjectName:
1302 setProperty(index, QString());
1304 case PropertyLayoutSizeConstraint:
1305 setProperty(index, QVariant(QLayout::SetDefaultConstraint));
1307 case PropertyLayoutBoxStretch:
1308 case PropertyLayoutGridRowStretch:
1309 case PropertyLayoutGridColumnStretch:
1310 case PropertyLayoutGridRowMinimumHeight:
1311 case PropertyLayoutGridColumnMinimumWidth:
1312 case PropertyLayoutFieldGrowthPolicy:
1313 case PropertyLayoutRowWrapPolicy:
1314 case PropertyLayoutLabelAlignment:
1315 case PropertyLayoutFormAlignment: {
1316 QDesignerPropertySheetExtension *layoutPropertySheet;
1317 if (d->layout(&layoutPropertySheet) && layoutPropertySheet)
1318 return layoutPropertySheet->reset(layoutPropertySheet->indexOf(d->transformLayoutPropertyName(index)));
1326 switch (d->m_objectType) {
1327 case ObjectLayoutWidget:
1328 if (pType == PropertyLayoutLeftMargin ||
1329 pType == PropertyLayoutTopMargin ||
1330 pType == PropertyLayoutRightMargin ||
1331 pType == PropertyLayoutBottomMargin)
1337 setProperty(index, value);
1342 if (isFakeProperty(index)) {
1343 const QDesignerMetaPropertyInterface *p = d->m_meta->property(index);
1344 const bool result = p->reset(d->m_object);
1345 d->m_fakeProperties[index] = p->read(d->m_object);
1348 if (propertyType(index) == PropertyGeometry && d->m_object->isWidgetType()) {
1349 if (QWidget *w = qobject_cast<QWidget*>(d->m_object)) {
1350 QWidget *widget = w;
1351 if (qdesigner_internal::Utils::isCentralWidget(d->m_fwb, widget) && d->m_fwb->parentWidget())
1352 widget = d->m_fwb->parentWidget();
1354 if (widget != w && widget->parentWidget()) {
1355 QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
1356 widget->parentWidget()->adjustSize();
1358 QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
1359 widget->adjustSize();
1365 const QDesignerMetaPropertyInterface *p = d->m_meta->property(index);
1366 return p->reset(d->m_object);
1390void QDesignerPropertySheet::setChanged(
int index,
bool changed)
1392 if (d->invalidIndex(Q_FUNC_INFO, index))
1394 if (isAdditionalProperty(index)) {
1395 if (isFakeLayoutProperty(index)) {
1396 QDesignerPropertySheetExtension *layoutPropertySheet;
1397 if (d->layout(&layoutPropertySheet) && layoutPropertySheet) {
1398 const QString newPropName = d->transformLayoutPropertyName(index);
1399 if (!newPropName.isEmpty()) {
1400 const int newIndex = layoutPropertySheet->indexOf(newPropName);
1402 layoutPropertySheet->setChanged(newIndex, changed);
1407 if (d->isReloadableProperty(index)) {
1410 d->m_fwb->addReloadableProperty(
this, index);
1412 d->m_fwb->removeReloadableProperty(
this, index);
1415 d->ensureInfo(index).changed = changed;
1418bool QDesignerPropertySheet::isFakeLayoutProperty(
int index)
const
1420 if (!isAdditionalProperty(index))
1423 switch (propertyType(index)) {
1424 case PropertyLayoutObjectName:
1425 case PropertyLayoutSizeConstraint:
1427 case PropertyLayoutLeftMargin:
1428 case PropertyLayoutTopMargin:
1429 case PropertyLayoutRightMargin:
1430 case PropertyLayoutBottomMargin:
1431 case PropertyLayoutSpacing:
1432 case PropertyLayoutHorizontalSpacing:
1433 case PropertyLayoutVerticalSpacing:
1434 case PropertyLayoutFieldGrowthPolicy:
1435 case PropertyLayoutRowWrapPolicy:
1436 case PropertyLayoutLabelAlignment:
1437 case PropertyLayoutFormAlignment:
1438 case PropertyLayoutBoxStretch:
1439 case PropertyLayoutGridRowStretch:
1440 case PropertyLayoutGridColumnStretch:
1441 case PropertyLayoutGridRowMinimumHeight:
1442 case PropertyLayoutGridColumnMinimumWidth:
1443 return d->m_canHaveLayoutAttributes;
1458bool QDesignerPropertySheet::isVisible(
int index)
const
1460 if (d->invalidIndex(Q_FUNC_INFO, index))
1463 const PropertyType type = propertyType(index);
1464 if (isAdditionalProperty(index)) {
1465 if (isFakeLayoutProperty(index) && d->m_object->isWidgetType()) {
1466 const QLayout *currentLayout = d->layout();
1469 const int visibleMask = qdesigner_internal::LayoutProperties::visibleProperties(currentLayout);
1471 case PropertyLayoutSpacing:
1472 return visibleMask & qdesigner_internal::LayoutProperties::SpacingProperty;
1473 case PropertyLayoutHorizontalSpacing:
1474 case PropertyLayoutVerticalSpacing:
1475 return visibleMask & qdesigner_internal::LayoutProperties::HorizSpacingProperty;
1476 case PropertyLayoutFieldGrowthPolicy:
1477 return visibleMask & qdesigner_internal::LayoutProperties::FieldGrowthPolicyProperty;
1478 case PropertyLayoutRowWrapPolicy:
1479 return visibleMask & qdesigner_internal::LayoutProperties::RowWrapPolicyProperty;
1480 case PropertyLayoutLabelAlignment:
1481 return visibleMask & qdesigner_internal::LayoutProperties::LabelAlignmentProperty;
1482 case PropertyLayoutFormAlignment:
1483 return visibleMask & qdesigner_internal::LayoutProperties::FormAlignmentProperty;
1484 case PropertyLayoutBoxStretch:
1485 return visibleMask & qdesigner_internal::LayoutProperties::BoxStretchProperty;
1486 case PropertyLayoutGridRowStretch:
1487 return visibleMask & qdesigner_internal::LayoutProperties::GridRowStretchProperty;
1488 case PropertyLayoutGridColumnStretch:
1489 return visibleMask & qdesigner_internal::LayoutProperties::GridColumnStretchProperty;
1490 case PropertyLayoutGridRowMinimumHeight:
1491 return visibleMask & qdesigner_internal::LayoutProperties::GridRowMinimumHeightProperty;
1492 case PropertyLayoutGridColumnMinimumWidth:
1493 return visibleMask & qdesigner_internal::LayoutProperties::GridColumnMinimumWidthProperty;
1499 return d->m_info.value(index).visible;
1502 if (isFakeProperty(index)) {
1504 case PropertyWindowModality:
1505 case PropertyWindowOpacity:
1506 return d->m_info.value(index).visible;
1513 const bool visible = d->m_info.value(index).visible;
1515 case PropertyWindowTitle:
1516 case PropertyWindowIcon:
1517 case PropertyWindowFilePath:
1518 case PropertyWindowOpacity:
1519 case PropertyWindowIconText:
1520 case PropertyWindowModified:
1528 const QDesignerMetaPropertyInterface *p = d->m_meta->property(index);
1529 if (!(p->accessFlags() & QDesignerMetaPropertyInterface::WriteAccess))
1532 return p->attributes().testFlag(QDesignerMetaPropertyInterface::DesignableAttribute);
1542bool QDesignerPropertySheet::isEnabled(
int index)
const
1544 if (d->invalidIndex(Q_FUNC_INFO, index))
1546 if (isAdditionalProperty(index))
1549 if (isFakeProperty(index))
1553 if (propertyType(index) == PropertyGeometry && d->m_object->isWidgetType()) {
1555 const qdesigner_internal::LayoutInfo::Type lt = qdesigner_internal::LayoutInfo::laidoutWidgetType(d->m_core, qobject_cast<QWidget *>(d->m_object), &isManaged);
1556 return !isManaged || lt == qdesigner_internal::LayoutInfo::NoLayout;
1559 if (d->m_info.value(index).visible)
1565 const QDesignerMetaPropertyInterface *p = d->m_meta->property(index);
1566 if (!p->accessFlags().testFlag(QDesignerMetaPropertyInterface::WriteAccess))
1569 if (!p->attributes().testFlag(QDesignerMetaPropertyInterface::DesignableAttribute))
1572 const PropertyType type = propertyType(index);
1573 if (type == PropertyChecked && d->m_objectFlags.testFlag(CheckableProperty))
1574 return d->m_object->property(
"checkable").toBool();
1657QObject *QDesignerAbstractPropertySheetFactory::extension(QObject *object,
const QString &iid)
const
1662 if (iid != m_impl->m_propertySheetId && iid != m_impl->m_dynamicPropertySheetId)
1665 QObject *ext = m_impl->m_extensions.value(object, 0);
1666 if (!ext && (ext = createPropertySheet(object,
const_cast<QDesignerAbstractPropertySheetFactory*>(
this)))) {
1667 connect(ext, &QObject::destroyed,
this, &QDesignerAbstractPropertySheetFactory::objectDestroyed);
1668 connect(object, &QObject::destroyed,
this, &QDesignerAbstractPropertySheetFactory::objectDestroyed);
1669 m_impl->m_extensions.insert(object, ext);