246void QDesignerIntegrationInterface::emitObjectNameChanged(QDesignerFormWindowInterface *formWindow, QObject *object,
const QString &newName,
const QString &oldName)
248 emit objectNameChanged(formWindow, object, newName, oldName);
251void QDesignerIntegrationInterface::emitNavigateToSlot(
const QString &objectName,
252 const QString &signalSignature,
253 const QStringList ¶meterNames)
255 emit navigateToSlot(objectName, signalSignature, parameterNames);
334 QDesignerFormEditorInterface *core =
q->core();
335 if (QDesignerPropertyEditor *designerPropertyEditor= qobject_cast<QDesignerPropertyEditor *>(core->propertyEditor())) {
336 QObject::connect(designerPropertyEditor, &QDesignerPropertyEditor::propertyValueChanged,
337 q, QOverload<
const QString &,
const QVariant &,
bool>::of(&QDesignerIntegration::updateProperty));
338 QObject::connect(designerPropertyEditor, &QDesignerPropertyEditor::resetProperty,
339 q, &QDesignerIntegration::resetProperty);
340 QObject::connect(designerPropertyEditor, &QDesignerPropertyEditor::addDynamicProperty,
341 q, &QDesignerIntegration::addDynamicProperty);
342 QObject::connect(designerPropertyEditor, &QDesignerPropertyEditor::removeDynamicProperty,
343 q, &QDesignerIntegration::removeDynamicProperty);
346 QObject::connect(core->formWindowManager(), &QDesignerFormWindowManagerInterface::formWindowAdded,
347 q, &QDesignerIntegrationInterface::setupFormWindow);
349 QObject::connect(core->formWindowManager(), &QDesignerFormWindowManagerInterface::activeFormWindowChanged,
350 q, &QDesignerIntegrationInterface::updateActiveFormWindow);
352 m_gradientManager =
new QtGradientManager(q);
355 const QString gradientsFile = u"/gradients.xml"_s;
356 m_gradientsPath = dataDirectory() + gradientsFile;
360#if QT_VERSION >= QT_VERSION_CHECK(7
, 0
, 0
)
361 const QString source = QFileInfo::exists(m_gradientsPath)
362 ? m_gradientsPath : legacyDataDirectory() + gradientsFile;
364 const QString source = m_gradientsPath;
368 if (f.open(QIODevice::ReadOnly)) {
369 QtGradientUtils::restoreState(m_gradientManager, QString::fromLatin1(f.readAll()));
372 QFile defaultGradients(u":/qt-project.org/designer/defaultgradients.xml"_s);
373 if (defaultGradients.open(QIODevice::ReadOnly)) {
374 QtGradientUtils::restoreState(m_gradientManager, QString::fromLatin1(defaultGradients.readAll()));
375 defaultGradients.close();
379 if (WidgetDataBase *widgetDataBase = qobject_cast<WidgetDataBase*>(core->widgetDataBase()))
380 widgetDataBase->grabStandardWidgetBoxIcons();
385 QDesignerFormWindowInterface *formWindow =
q->core()->formWindowManager()->activeFormWindow();
390 getSelection(selection);
391 if (selection.empty())
394 SetPropertyCommand *cmd =
new SetPropertyCommand(formWindow);
396 if (cmd->init(selection.selection(), name, value, propertyEditorObject(), enableSubPropertyHandling)) {
397 formWindow->commandHistory()->push(cmd);
400 qDebug() <<
"Unable to set property " << name <<
'.';
406 QDesignerFormWindowInterface *formWindow =
q->core()->formWindowManager()->activeFormWindow();
411 getSelection(selection);
412 if (selection.empty())
415 ResetPropertyCommand *cmd =
new ResetPropertyCommand(formWindow);
417 if (cmd->init(selection.selection(), name, propertyEditorObject())) {
418 formWindow->commandHistory()->push(cmd);
421 qDebug() <<
"** WARNING Unable to reset property " << name <<
'.';
427 QDesignerFormWindowInterface *formWindow =
q->core()->formWindowManager()->activeFormWindow();
432 getSelection(selection);
433 if (selection.empty())
436 AddDynamicPropertyCommand *cmd =
new AddDynamicPropertyCommand(formWindow);
437 if (cmd->init(selection.selection(), propertyEditorObject(), name, value)) {
438 formWindow->commandHistory()->push(cmd);
441 qDebug() <<
"** WARNING Unable to add dynamic property " << name <<
'.';
447 QDesignerFormWindowInterface *formWindow =
q->core()->formWindowManager()->activeFormWindow();
452 getSelection(selection);
453 if (selection.empty())
456 RemoveDynamicPropertyCommand *cmd =
new RemoveDynamicPropertyCommand(formWindow);
457 if (cmd->init(selection.selection(), propertyEditorObject(), name)) {
458 formWindow->commandHistory()->push(cmd);
461 qDebug() <<
"** WARNING Unable to remove dynamic property " << name <<
'.';
474 QDesignerFormEditorInterface *core =
q->core();
475 QDesignerFormWindowInterface *formWindow = core->formWindowManager()->activeFormWindow();
479 selection = formWindow->cursor()->current();
482 if (QDesignerActionEditorInterface *actionEditor = core->actionEditor())
483 actionEditor->setFormWindow(formWindow);
485 if (QDesignerPropertyEditorInterface *propertyEditor = core->propertyEditor())
486 propertyEditor->setObject(selection);
488 if (QDesignerObjectInspectorInterface *objectInspector = core->objectInspector())
489 objectInspector->setFormWindow(formWindow);
553 qdesigner_internal::WidgetDataBase *widgetDataBase = qobject_cast<qdesigner_internal::WidgetDataBase*>(formEditor->widgetDataBase());
554 if (widgetDataBase) {
555 widgetDataBase->loadPlugins();
558 if (qdesigner_internal::WidgetFactory *widgetFactory = qobject_cast<qdesigner_internal::WidgetFactory*>(formEditor->widgetFactory())) {
559 widgetFactory->loadPlugins();
562 if (widgetDataBase) {
563 widgetDataBase->grabDefaultPropertyValues();
569 QDesignerFormEditorInterface *formEditor =
q->core();
570 if (QDesignerPluginManager *pm = formEditor->pluginManager())
571 pm->registerNewPlugins();
577 if (QDesignerWidgetBox *wb = qobject_cast<QDesignerWidgetBox*>(formEditor->widgetBox())) {
578 const QDesignerWidgetBox::LoadMode oldLoadMode = wb->loadMode();
579 wb->setLoadMode(QDesignerWidgetBox::LoadCustomWidgetsOnly);
581 wb->setLoadMode(oldLoadMode);
612 QDesignerFormEditorInterface *core =
q->core();
613 QObject *currentObject = core->propertyEditor()->object();
618 QString currentPropertyName = core->propertyEditor()->currentPropertyName();
619 if (!currentPropertyName.isEmpty())
620 className = classForProperty(core, currentObject, currentPropertyName);
621 if (className.isEmpty()) {
622 currentPropertyName.clear();
623 className = qdesigner_internal::WidgetFactory::classNameOf(core, currentObject);
625 QString helpId = fixHelpClassName(className);
626 if (!currentPropertyName.isEmpty()) {
628 helpId += currentPropertyName;
638QDesignerIntegration::QDesignerIntegration(QDesignerFormEditorInterface *core, QObject *parent) :
639 QDesignerIntegrationInterface(core, parent),
640 d(
new qdesigner_internal::QDesignerIntegrationPrivate(
this))
689void QDesignerIntegration::setResourceFileWatcherBehaviour(ResourceFileWatcherBehaviour behaviour)
691 if (d->m_resourceFileWatcherBehaviour != behaviour) {
692 d->m_resourceFileWatcherBehaviour = behaviour;
693 core()->resourceModel()->setWatcherEnabled(behaviour != QDesignerIntegrationInterface::NoResourceFileWatcher);
697void QDesignerIntegration::updateProperty(
const QString &name,
const QVariant &value,
bool enableSubPropertyHandling)
699 d->updateProperty(name, value, enableSubPropertyHandling);
700 emit propertyChanged(core()->formWindowManager()->activeFormWindow(), name, value);
728void QDesignerIntegration::setupFormWindow(QDesignerFormWindowInterface *formWindow)
730 d->setupFormWindow(formWindow);
731 connect(formWindow, &QDesignerFormWindowInterface::selectionChanged,
732 this, &QDesignerIntegrationInterface::updateSelection);
virtual QString propertyGroup(int index) const =0
virtual int indexOf(const QString &name) const =0