void ActionEditor::slotNewAction() { NewActionDialog dlg(this); dlg.setWindowTitle(tr("New action")); if (dlg.exec() == QDialog::Accepted) { const ActionData actionData = dlg.actionData(); m_actionView->clearSelection(); QAction *action = new QAction(formWindow()); action->setObjectName(actionData.name); formWindow()->ensureUniqueObjectName(action); action->setText(actionData.text); QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core()->extensionManager(), action); if (!actionData.toolTip.isEmpty()) setInitialProperty(sheet, QLatin1String(toolTipPropertyC), actionData.toolTip); if (actionData.checkable) setInitialProperty(sheet, QLatin1String(checkablePropertyC), QVariant(true)); if (!actionData.keysequence.value().isEmpty()) setInitialProperty(sheet, QLatin1String(shortcutPropertyC), QVariant::fromValue(actionData.keysequence)); sheet->setProperty(sheet->indexOf(QLatin1String(iconPropertyC)), QVariant::fromValue(actionData.icon)); AddActionCommand *cmd = new AddActionCommand(formWindow()); cmd->init(action); formWindow()->commandHistory()->push(cmd); } }
static PyObject *meth_QDesignerPropertySheetExtension_setProperty(PyObject *sipSelf, PyObject *sipArgs) { PyObject *sipParseErr = NULL; PyObject *sipOrigSelf = sipSelf; { int a0; const QVariant* a1; int a1State = 0; QDesignerPropertySheetExtension *sipCpp; if (sipParseArgs(&sipParseErr, sipArgs, "BiJ1", &sipSelf, sipType_QDesignerPropertySheetExtension, &sipCpp, &a0, sipType_QVariant, &a1, &a1State)) { if (!sipOrigSelf) { sipAbstractMethod(sipName_QDesignerPropertySheetExtension, sipName_setProperty); return NULL; } sipCpp->setProperty(a0,*a1); sipReleaseType(const_cast<QVariant *>(a1),sipType_QVariant,a1State); Py_INCREF(Py_None); return Py_None; } } /* Raise an exception if the arguments couldn't be parsed. */ sipNoMethod(sipParseErr, sipName_QDesignerPropertySheetExtension, sipName_setProperty, doc_QDesignerPropertySheetExtension_setProperty); return NULL; }
bool ItemViewPropertySheet::reset(int index) { const FakePropertyMap::iterator it = d->m_propertyIdMap.find(index); if (it != d->m_propertyIdMap.end()) { QDesignerPropertySheetExtension *headerSheet = it.value().m_sheet; const int headerIndex = it.value().m_id; const bool resetRC = headerSheet->reset(headerIndex); // Resetting for "visible" might fail and the stored default // of the Widget database is "false" due to the widget not being // visible at the time it was determined. Reset to "true" manually. if (!resetRC && headerSheet->propertyName(headerIndex) == QLatin1String(visibleProperty)) { headerSheet->setProperty(headerIndex, QVariant(true)); headerSheet->setChanged(headerIndex, false); return true; } return resetRC; } else { return QDesignerPropertySheet::reset(index); } }
void QAxWidgetPropertySheet::reloadPropertySheet(const struct SavedProperties &properties, QDesignerFormWindowInterface *formWin) { QDesignerFormEditorInterface *core = formWin->core(); //Recreation of the property sheet QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension *>(core->extensionManager(), properties.widget); bool foundGeometry = false; const QString geometryProperty = QLatin1String(geometryPropertyC); const SavedProperties::NamePropertyMap::const_iterator cend = properties.changedProperties.constEnd(); for (SavedProperties::NamePropertyMap::const_iterator i = properties.changedProperties.constBegin(); i != cend; ++i) { const QString name = i.key(); const int index = sheet->indexOf(name); if (index == -1) continue; // filter out geometry as this will resize the control // to is default size even if it is attached to an layout // but set the changed flag to work around preview bug... if (name == geometryProperty) { sheet->setChanged(index, true); foundGeometry = true; continue; } if (name == QLatin1String(controlPropertyName)) { sheet->setChanged(index, !i.value().toString().isEmpty()); continue; } sheet->setChanged(index, true); sheet->setProperty(index, i.value()); } if (!foundGeometry) // Make sure geometry is always changed in Designer sheet->setChanged(sheet->indexOf(geometryProperty), true); if (core->propertyEditor()->object() == properties.widget) { formWin->clearSelection(true); formWin->selectWidget(properties.widget); } }