21#include <QtDesigner/abstractformeditor.h>
22#include <QtDesigner/abstractintegration.h>
23#include <QtDesigner/private/ui4_p.h>
24#include <QtDesigner/private/formbuilderextra_p.h>
25#include <QtDesigner/private/resourcebuilder_p.h>
26#include <QtDesigner/private/textbuilder_p.h>
27#include <qdesigner_widgetitem_p.h>
30#include <widgetdatabase_p.h>
31#include <metadatabase_p.h>
33#include <layoutinfo_p.h>
34#include <spacer_widget_p.h>
35#include <pluginmanager_p.h>
36#include <widgetfactory_p.h>
37#include <abstractlanguage.h>
38#include <abstractintrospection_p.h>
40#include <qlayout_widget_p.h>
41#include <qdesigner_utils_p.h>
42#include <QtDesigner/private/ui4_p.h>
45#include <QtDesigner/propertysheet.h>
46#include <QtDesigner/abstractformeditor.h>
47#include <QtDesigner/extrainfo.h>
48#include <QtDesigner/abstractformwindowtool.h>
49#include <QtDesigner/qextensionmanager.h>
50#include <QtDesigner/container.h>
51#include <abstractdialoggui_p.h>
53#include <QtWidgets/qmenu.h>
54#include <QtWidgets/qmessagebox.h>
55#include <QtWidgets/qlayout.h>
56#include <QtWidgets/qformlayout.h>
57#include <QtWidgets/qtabwidget.h>
58#include <QtWidgets/qtoolbox.h>
59#include <QtWidgets/qstackedwidget.h>
60#include <QtWidgets/qtoolbar.h>
61#include <QtWidgets/qtabbar.h>
62#include <QtWidgets/qbuttongroup.h>
63#include <QtWidgets/qapplication.h>
64#include <QtWidgets/qmainwindow.h>
65#include <QtWidgets/qsplitter.h>
66#include <QtWidgets/qmdiarea.h>
67#include <QtWidgets/qmenubar.h>
68#include <QtWidgets/qfiledialog.h>
69#include <QtWidgets/qheaderview.h>
70#include <QtWidgets/qwizard.h>
71#include <private/qlayoutengine_p.h>
73#include <QtGui/qaction.h>
74#include <QtGui/qactiongroup.h>
76#include <QtCore/qbuffer.h>
77#include <QtCore/qdir.h>
78#include <QtCore/qmetaobject.h>
79#include <QtCore/qdebug.h>
80#include <QtCore/qversionnumber.h>
81#include <QtCore/qxmlstream.h>
86Q_DECLARE_METATYPE(QWidgetList)
90using namespace Qt::StringLiterals;
92using QFBE = QFormBuilderExtra;
95 using DomPropertyList = QList<DomProperty *>;
101#define OLD_RESOURCE_FORMAT
107 if (qtVersion >= QVersionNumber{6, 6, 2})
110 switch (qtVersion.majorVersion()) {
112 switch (qtVersion.minorVersion()) {
114 if (qtVersion.microVersion() >= 4)
118 if (qtVersion.microVersion() >= 13)
125 if (qtVersion >= QVersionNumber{5, 15, 18})
138 void setPixmapCache(DesignerPixmapCache *pixmapCache) { m_pixmapCache = pixmapCache; }
139 void setIconCache(DesignerIconCache *iconCache) { m_iconCache = iconCache; }
147 QVariant
loadResource(
const QDir &workingDirectory,
const DomProperty *icon)
const override;
151 DomProperty *
saveResource(
const QDir &workingDirectory,
const QVariant &value)
const override;
156 QDesignerFormEditorInterface *m_core;
157 DesignerPixmapCache *m_pixmapCache;
158 DesignerIconCache *m_iconCache;
161 mutable QMap<QString,
bool> m_usedQrcFiles;
162 mutable QMap<QString,
bool> m_loadedQrcFiles;
167 m_pixmapCache(pixmapCache),
168 m_iconCache(iconCache),
174static inline void setIconPixmap(QIcon::Mode m, QIcon::State s,
const QDir &workingDirectory,
175 QString path, PropertySheetIconValue &icon,
179 path = QFileInfo(workingDirectory, path).absoluteFilePath();
180 icon.setPixmap(m, s, PropertySheetPixmapValue(path));
185 switch (property->kind()) {
186 case DomProperty::Pixmap: {
188 DomResourcePixmap *dp = property->elementPixmap();
189 if (!dp->text().isEmpty()) {
191 pixmap.setPath(dp->text());
193 pixmap.setPath(QFileInfo(workingDirectory, dp->text()).absoluteFilePath());
196 if (dp->hasAttributeResource())
197 m_loadedQrcFiles.insert(QFileInfo(workingDirectory, dp->attributeResource()).absoluteFilePath(),
false);
200 return QVariant::fromValue(pixmap);
203 case DomProperty::IconSet: {
205 DomResourceIcon *di = property->elementIconSet();
206 const bool hasTheme = di->hasAttributeTheme();
208 const QString &theme = di->attributeTheme();
209 const qsizetype themeEnum = theme.startsWith(
"QIcon::"_L1)
210 ? QDesignerResourceBuilder::themeIconIndex(theme) : -1;
212 icon.setThemeEnum(themeEnum);
214 icon.setTheme(theme);
216 if (
const int flags = iconStateFlags(di)) {
217 if (flags & NormalOff)
218 setIconPixmap(QIcon::Normal, QIcon::Off, workingDirectory, di->elementNormalOff()->text(), icon, m_lang);
219 if (flags & NormalOn)
220 setIconPixmap(QIcon::Normal, QIcon::On, workingDirectory, di->elementNormalOn()->text(), icon, m_lang);
221 if (flags & DisabledOff)
222 setIconPixmap(QIcon::Disabled, QIcon::Off, workingDirectory, di->elementDisabledOff()->text(), icon, m_lang);
223 if (flags & DisabledOn)
224 setIconPixmap(QIcon::Disabled, QIcon::On, workingDirectory, di->elementDisabledOn()->text(), icon, m_lang);
225 if (flags & ActiveOff)
226 setIconPixmap(QIcon::Active, QIcon::Off, workingDirectory, di->elementActiveOff()->text(), icon, m_lang);
227 if (flags & ActiveOn)
228 setIconPixmap(QIcon::Active, QIcon::On, workingDirectory, di->elementActiveOn()->text(), icon, m_lang);
229 if (flags & SelectedOff)
230 setIconPixmap(QIcon::Selected, QIcon::Off, workingDirectory, di->elementSelectedOff()->text(), icon, m_lang);
231 if (flags & SelectedOn)
232 setIconPixmap(QIcon::Selected, QIcon::On, workingDirectory, di->elementSelectedOn()->text(), icon, m_lang);
233 }
else if (!hasTheme) {
235 setIconPixmap(QIcon::Normal, QIcon::Off, workingDirectory, di->text(), icon, m_lang);
236 if (di->hasAttributeResource())
237 m_loadedQrcFiles.insert(QFileInfo(workingDirectory, di->attributeResource()).absoluteFilePath(),
false);
240 return QVariant::fromValue(icon);
262 DomProperty *p =
new DomProperty;
265 DomResourcePixmap *rp =
new DomResourcePixmap;
266 const QString pixPath = pix.path();
267 switch (pix.pixmapSource(m_core)) {
268 case PropertySheetPixmapValue::LanguageResourcePixmap:
269 rp->setText(pixPath);
271 case PropertySheetPixmapValue::ResourcePixmap: {
272 rp->setText(pixPath);
273 const QString qrcFile = m_core->resourceModel()->qrcPath(pixPath);
274 if (!qrcFile.isEmpty()) {
275 m_usedQrcFiles.insert(qrcFile,
false);
277 rp->setAttributeResource(workingDirectory.relativeFilePath(qrcFile));
282 case PropertySheetPixmapValue::FilePixmap:
283 rp->setText(m_saveRelative ? workingDirectory.relativeFilePath(pixPath) : pixPath);
286 p->setElementPixmap(rp);
291 const auto &pixmaps = icon.paths();
292 const int themeEnum = icon.themeEnum();
293 const QString theme = themeEnum != -1
294 ? QDesignerResourceBuilder::fullyQualifiedThemeIconName(themeEnum) : icon.theme();
295 if (!pixmaps.isEmpty() || !theme.isEmpty()) {
296 DomResourceIcon *ri =
new DomResourceIcon;
297 if (!theme.isEmpty())
298 ri->setAttributeTheme(theme);
299 for (
auto itPix = pixmaps.cbegin(), end = pixmaps.cend(); itPix != end; ++itPix) {
300 const QIcon::Mode mode = itPix.key().first;
301 const QIcon::State state = itPix.key().second;
302 DomResourcePixmap *rp =
new DomResourcePixmap;
303 const PropertySheetPixmapValue &pix = itPix.value();
304 const PropertySheetPixmapValue::PixmapSource ps = pix.pixmapSource(m_core);
305 const QString pixPath = pix.path();
306 rp->setText(ps == PropertySheetPixmapValue::FilePixmap && m_saveRelative ? workingDirectory.relativeFilePath(pixPath) : pixPath);
307 if (state == QIcon::Off) {
310 ri->setElementNormalOff(rp);
312 ri->setText(rp->text());
314 if (ps == PropertySheetPixmapValue::ResourcePixmap) {
317 const QString qrcFile = m_core->resourceModel()->qrcPath(ri->text());
318 if (!qrcFile.isEmpty()) {
319 m_usedQrcFiles.insert(qrcFile,
false);
321 ri->setAttributeResource(workingDirectory.relativeFilePath(qrcFile));
326 case QIcon::Disabled: ri->setElementDisabledOff(rp);
break;
327 case QIcon::Active: ri->setElementActiveOff(rp);
break;
328 case QIcon::Selected: ri->setElementSelectedOff(rp);
break;
332 case QIcon::Normal: ri->setElementNormalOn(rp);
break;
333 case QIcon::Disabled: ri->setElementDisabledOn(rp);
break;
334 case QIcon::Active: ri->setElementActiveOn(rp);
break;
335 case QIcon::Selected: ri->setElementSelectedOn(rp);
break;
339 p->setElementIconSet(ri);
354template <
class DomElement>
357 const QString propertyComment = data.disambiguation();
358 if (!propertyComment.isEmpty())
359 e->setAttributeComment(propertyComment);
360 const QString propertyExtracomment = data.comment();
361 if (!propertyExtracomment.isEmpty())
362 e->setAttributeExtraComment(propertyExtracomment);
363 const QString &id = data.id();
365 e->setAttributeId(id);
366 if (!data.translatable())
367 e->setAttributeNotr(u"true"_s);
370template <
class DomElement>
373 if (e->hasAttributeComment())
374 data->setDisambiguation(e->attributeComment());
375 if (e->hasAttributeExtraComment())
376 data->setComment(e->attributeExtraComment());
377 if (e->hasAttributeId())
378 data->setId(e->attributeId());
379 if (e->hasAttributeNotr()) {
380 const QString notr = e->attributeNotr();
381 const bool translatable = !(notr ==
"true"_L1 || notr ==
"yes"_L1);
382 data->setTranslatable(translatable);
400 if (
const DomString *domString = text->elementString()) {
402 translationParametersFromDom(domString, &stringValue);
403 return QVariant::fromValue(stringValue);
405 return QVariant(QString());
410 if (value.canConvert<PropertySheetStringValue>())
411 return QVariant::fromValue(qvariant_cast<PropertySheetStringValue>(value).value());
417 DomString *domString =
new DomString();
418 domString->setText(value);
419 DomProperty *property =
new DomProperty();
420 property->setElementString(domString);
425 const PropertySheetTranslatableData &translatableData)
427 DomString *domString =
new DomString();
428 domString->setText(value);
429 translationParametersToDom(translatableData, domString);
430 DomProperty *property =
new DomProperty();
431 property->setElementString(domString);
439 return stringToDomProperty(str.value(), str);
441 if (value.canConvert<QString>())
442 return stringToDomProperty(value.toString());
448 m_formWindow(formWindow),
454 QDesignerFormEditorInterface *core = m_formWindow
->core();
455 if (
const QDesignerLanguageExtension *le = qt_extension<QDesignerLanguageExtension*>(core->extensionManager(), core))
456 d->m_language = le->name();
458 setWorkingDirectory(formWindow->absoluteDir());
459 setResourceBuilder(m_resourceBuilder);
463 const QString designerWidget = u"QDesignerWidget"_s;
464 const QString layoutWidget = u"QLayoutWidget"_s;
465 const QString widget = u"QWidget"_s;
466 m_internal_to_qt.insert(layoutWidget, widget);
467 m_internal_to_qt.insert(designerWidget, widget);
468 m_internal_to_qt.insert(u"QDesignerDialog"_s, u"QDialog"_s);
469 m_internal_to_qt.insert(u"QDesignerMenuBar"_s, u"QMenuBar"_s);
470 m_internal_to_qt.insert(u"QDesignerMenu"_s, u"QMenu"_s);
471 m_internal_to_qt.insert(u"QDesignerDockWidget"_s, u"QDockWidget"_s);
474 for (
auto it = m_internal_to_qt.cbegin(), cend = m_internal_to_qt.cend(); it != cend; ++it ) {
475 if (it.value() != designerWidget && it.value() != layoutWidget)
476 m_qt_to_internal.insert(it.value(), it.key());
485 return d->readUi(dev);
490 return QApplication::translate(
"Designer",
"Qt Widgets Designer");
498 const auto qtVersion = m_formWindow
->core()->integration()->qtVersion();
499 d->m_fullyQualifiedEnums = supportsQualifiedEnums(qtVersion);
500 d->m_separateSizeConstraints = qtVersion >= QVersionNumber(7, 0, 0);
501 QAbstractFormBuilder::save(dev, widget);
506 QAbstractFormBuilder::saveDom(ui, widget);
509 Q_ASSERT(sheet !=
nullptr);
511 const QVariant classVar = sheet->property(sheet->indexOf(u"objectName"_s));
513 if (classVar.canConvert<QString>())
514 classStr = classVar.toString();
517 ui->setElementClass(classStr);
519 for (
int index = 0; index < m_formWindow
->toolCount(); ++index) {
520 QDesignerFormWindowToolInterface *tool = m_formWindow->tool(index);
521 Q_ASSERT(tool !=
nullptr);
522 tool->saveToDom(ui, widget);
525 const QString author = m_formWindow->author();
526 if (!author.isEmpty()) {
527 ui->setElementAuthor(author);
530 const QString comment = m_formWindow->comment();
531 if (!comment.isEmpty()) {
532 ui->setElementComment(comment);
535 const QString exportMacro = m_formWindow->exportMacro();
536 if (!exportMacro.isEmpty()) {
537 ui->setElementExportMacro(exportMacro);
540 if (m_formWindow->useIdBasedTranslations())
541 ui->setAttributeIdbasedtr(
true);
543 if (core()->integration()->qtVersion() >= QVersionNumber(6, 10, 0)) {
544 const QString label = m_formWindow->idBasedTranslationLabel();
545 if (!label.isEmpty())
546 ui->setAttributeLabel(label);
549 if (!m_formWindow->connectSlotsByName())
550 ui->setAttributeConnectslotsbyname(
false);
552 const QVariantMap designerFormData = m_formWindow->formData();
553 if (!designerFormData.isEmpty()) {
554 DomPropertyList domPropertyList;
555 for (
auto it = designerFormData.cbegin(), cend = designerFormData.cend(); it != cend; ++it) {
556 if (DomProperty *prop = variantToDomProperty(
this, widget->metaObject(), it.key(), it.value()))
557 domPropertyList += prop;
559 if (!domPropertyList.isEmpty()) {
560 DomDesignerData* domDesignerFormData =
new DomDesignerData;
561 domDesignerFormData->setElementProperty(domPropertyList);
562 ui->setElementDesignerdata(domDesignerFormData);
566 if (!m_formWindow->includeHints().isEmpty()) {
567 const QString local = u"local"_s;
568 const QString global = u"global"_s;
569 QList<DomInclude *> ui_includes;
570 const QStringList &includeHints = m_formWindow->includeHints();
571 ui_includes.reserve(includeHints.size());
572 for (QString includeHint : includeHints) {
573 if (includeHint.isEmpty())
575 DomInclude *incl =
new DomInclude;
576 const QString location = includeHint.at(0) == u'<' ? global : local;
577 includeHint.remove(u'"');
578 includeHint.remove(u'<');
579 includeHint.remove(u'>');
580 incl->setAttributeLocation(location);
581 incl->setText(includeHint);
582 ui_includes.append(incl);
585 DomIncludes *includes =
new DomIncludes;
586 includes->setElementInclude(ui_includes);
587 ui->setElementIncludes(includes);
590 int defaultMargin = INT_MIN, defaultSpacing = INT_MIN;
593 if (defaultMargin != INT_MIN || defaultSpacing != INT_MIN) {
594 DomLayoutDefault *def =
new DomLayoutDefault;
595 if (defaultMargin != INT_MIN)
596 def->setAttributeMargin(defaultMargin);
597 if (defaultSpacing != INT_MIN)
598 def->setAttributeSpacing(defaultSpacing);
599 ui->setElementLayoutDefault(def);
602 QString marginFunction, spacingFunction;
603 m_formWindow->layoutFunction(&marginFunction, &spacingFunction);
604 if (!marginFunction.isEmpty() || !spacingFunction.isEmpty()) {
605 DomLayoutFunction *def =
new DomLayoutFunction;
607 if (!marginFunction.isEmpty())
608 def->setAttributeMargin(marginFunction);
609 if (!spacingFunction.isEmpty())
610 def->setAttributeSpacing(spacingFunction);
611 ui->setElementLayoutFunction(def);
614 QString pixFunction = m_formWindow->pixmapFunction();
615 if (!pixFunction.isEmpty()) {
616 ui->setElementPixmapFunction(pixFunction);
619 if (QDesignerExtraInfoExtension *extra = qt_extension<QDesignerExtraInfoExtension*>(core()->extensionManager(), core()))
620 extra->saveUiExtraInfo(ui);
622 if (MetaDataBase *metaDataBase = qobject_cast<MetaDataBase *>(core()->metaDataBase())) {
623 const MetaDataBaseItem *item = metaDataBase->metaDataBaseItem(m_formWindow->mainContainer());
624 const QStringList fakeSlots = item->fakeSlots();
625 const QStringList fakeSignals =item->fakeSignals();
626 if (!fakeSlots.isEmpty() || !fakeSignals.isEmpty()) {
627 DomSlots *domSlots =
new DomSlots();
628 domSlots->setElementSlot(fakeSlots);
629 domSlots->setElementSignal(fakeSignals);
630 ui->setElementSlots(domSlots);
637 QScopedPointer<DomUI> ui(readUi(dev));
638 return ui.isNull() ?
nullptr : loadUi(ui.data(), parentWidget);
643 QWidget *widget = create(ui, parentWidget);
646 widget->setProperty(
"_q_classname", widget->objectName());
647 else if (d->m_errorString.isEmpty())
648 d->m_errorString = QFormBuilderExtra::msgInvalidUiFile();
666 if (QDesignerExtraInfoExtension *extra = qt_extension<QDesignerExtraInfoExtension*>(core()->extensionManager(), core())) {
667 if (!extra->loadUiExtraInfo(ui)) {
668 const QString errorMessage = QApplication::translate(
"Designer",
"This file cannot be read because the extra info extension failed to load.");
669 core()->dialogGui()->message(parentWidget->window(), QDesignerDialogGuiInterface::FormLoadFailureMessage,
670 QMessageBox::Warning, messageBoxTitle(), errorMessage, QMessageBox::Ok);
675 qdesigner_internal::WidgetFactory *factory = qobject_cast<qdesigner_internal::WidgetFactory*>(core()->widgetFactory());
676 Q_ASSERT(factory !=
nullptr);
678 QDesignerFormWindowInterface *previousFormWindow = factory->currentFormWindow(m_formWindow);
680 m_isMainWidget =
true;
682 QWidget *mainWidget = QAbstractFormBuilder::create(ui, parentWidget);
685 m_formWindow->setUseIdBasedTranslations(ui->attributeIdbasedtr());
686 m_formWindow->setIdBasedTranslationLabel(ui->attributeLabel());
688 const bool connectSlotsByName = !ui->hasAttributeConnectslotsbyname() || ui->attributeConnectslotsbyname();
689 m_formWindow->setConnectSlotsByName(connectSlotsByName);
692 if (mainWidget && m_formWindow) {
693 m_formWindow->setAuthor(ui->elementAuthor());
694 m_formWindow->setComment(ui->elementComment());
695 m_formWindow->setExportMacro(ui->elementExportMacro());
698 QVariantMap designerFormData;
699 if (ui->hasElementDesignerdata()) {
700 const DomPropertyList domPropertyList = ui->elementDesignerdata()->elementProperty();
701 for (
auto *prop : domPropertyList) {
702 const QVariant vprop = domPropertyToVariant(
this, mainWidget->metaObject(), prop);
703 if (vprop.metaType().id() != QMetaType::UnknownType)
704 designerFormData.insert(prop->attributeName(), vprop);
707 m_formWindow->setFormData(designerFormData);
709 m_formWindow->setPixmapFunction(ui->elementPixmapFunction());
711 if (DomLayoutDefault *def = ui->elementLayoutDefault()) {
712 m_formWindow->setLayoutDefault(def->attributeMargin(), def->attributeSpacing());
715 if (DomLayoutFunction *fun = ui->elementLayoutFunction()) {
716 m_formWindow->setLayoutFunction(fun->attributeMargin(), fun->attributeSpacing());
719 if (DomIncludes *includes = ui->elementIncludes()) {
720 const auto global =
"global"_L1;
721 QStringList includeHints;
722 const auto &elementInclude = includes->elementInclude();
723 for (DomInclude *incl : elementInclude) {
724 QString text = incl->text();
729 if (incl->hasAttributeLocation() && incl->attributeLocation() == global ) {
737 includeHints.append(text);
740 m_formWindow->setIncludeHints(includeHints);
745 auto *mdb = core()->metaDataBase();
746 for (
auto *child : mainWidget->children()) {
747 if (QButtonGroup *bg = qobject_cast<QButtonGroup*>(child))
751 for (
int index = 0; index < m_formWindow
->toolCount(); ++index) {
752 QDesignerFormWindowToolInterface *tool = m_formWindow->tool(index);
753 Q_ASSERT(tool !=
nullptr);
754 tool->loadFromDom(ui, mainWidget);
758 factory->currentFormWindow(previousFormWindow);
760 if (
const DomSlots *domSlots = ui->elementSlots()) {
761 if (MetaDataBase *metaDataBase = qobject_cast<MetaDataBase *>(core()->metaDataBase())) {
762 QStringList fakeSlots;
763 QStringList fakeSignals;
764 if (addFakeMethods(domSlots, fakeSlots, fakeSignals)) {
765 MetaDataBaseItem *item = metaDataBase->metaDataBaseItem(mainWidget);
766 item->setFakeSlots(fakeSlots);
767 item->setFakeSignals(fakeSignals);
773 bool hasExplicitGeometry =
false;
774 const auto &properties = ui->elementWidget()->elementProperty();
775 if (!properties.isEmpty()) {
776 for (
const DomProperty *p : properties) {
777 if (p->attributeName() ==
"geometry"_L1) {
778 hasExplicitGeometry =
true;
783 if (hasExplicitGeometry) {
786 const QSize size = mainWidget->size();
787 const QSize minSize = size.expandedTo(qSmartMinSize(mainWidget));
789 mainWidget->resize(minSize);
793 mainWidget->adjustSize();
800 const QDesignerWidgetDataBaseInterface *wdb = core()->widgetDataBase();
801 const int wdbIndex = wdb->indexOfObject(mainWidget);
802 if (wdbIndex != -1) {
803 QDesignerWidgetDataBaseItemInterface *item = wdb->item(wdbIndex);
805 if (item->isPromoted() && !item->isContainer()) {
806 item->setContainer(
true);
807 qWarning(
"** WARNING The form's main container is an unknown custom widget '%s'."
808 " Defaulting to a promoted instance of '%s', assuming container.",
809 item->name().toUtf8().constData(), item->extends().toUtf8().constData());
818 const QString className = ui_widget->attributeClass();
819 if (!m_isMainWidget && className ==
"QWidget"_L1
820 && !ui_widget->elementLayout().isEmpty()
821 && !ui_widget->hasAttributeNative()) {
826 if (container ==
nullptr) {
828 ui_widget->setAttributeClass(u"QLayoutWidget"_s);
833 const auto &actionRefs = ui_widget->elementAddAction();
834 ui_widget->setElementAddAction(QList<DomActionRef *>());
836 QWidget *w = QAbstractFormBuilder::create(ui_widget, parentWidget);
839 ui_widget->setElementAddAction(actionRefs);
845 QDesignerMenu *menu = qobject_cast<QDesignerMenu*>(w);
846 QDesignerMenuBar *menuBar = qobject_cast<QDesignerMenuBar*>(w);
851 for (DomActionRef *ui_action_ref : actionRefs) {
852 const QString name = ui_action_ref->attributeName();
853 if (name ==
"separator"_L1) {
854 QAction *sep =
new QAction(w);
855 sep->setSeparator(
true);
858 }
else if (QAction *a = d->m_actions.value(name)) {
860 }
else if (QActionGroup *g = d->m_actionGroups.value(name)) {
861 w->addActions(g->actions());
862 }
else if (QMenu *menu = w->findChild<QMenu*>(name)) {
863 w->addAction(menu->menuAction());
864 addMenuAction(menu->menuAction());
869 menu->adjustSpecialActions();
871 menuBar->adjustSpecialActions();
873 ui_widget->setAttributeClass(className);
874 applyExtensionDataFromDOM(
this, core(), ui_widget, w);
881 QLayout *l = QAbstractFormBuilder::create(ui_layout, layout, parentWidget);
883 if (QGridLayout *gridLayout = qobject_cast<QGridLayout*>(l)) {
884 QLayoutSupport::createEmptyCells(gridLayout);
886 if (QFormLayout *formLayout = qobject_cast<QFormLayout*>(l))
887 QLayoutSupport::createEmptyCells(formLayout);
897 if (ui_layoutItem->kind() == DomLayoutItem::Spacer) {
898 const DomSpacer *domSpacer = ui_layoutItem->elementSpacer();
899 Spacer *spacer =
static_cast<Spacer*>(core()->widgetFactory()->createWidget(u"Spacer"_s, parentWidget));
900 if (domSpacer->hasAttributeName())
901 changeObjectName(spacer, domSpacer->attributeName());
902 core()->metaDataBase()->add(spacer);
904 spacer->setInteractiveMode(
false);
905 applyProperties(spacer, ui_layoutItem->elementSpacer()->elementProperty());
906 spacer->setInteractiveMode(
true);
909 m_formWindow->manageWidget(spacer);
910 if (QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core()->extensionManager(), spacer))
911 sheet->setChanged(sheet->indexOf(u"orientation"_s),
true);
914 return new QWidgetItem(spacer);
916 if (ui_layoutItem->kind() == DomLayoutItem::Layout && parentWidget) {
917 DomLayout *ui_layout = ui_layoutItem->elementLayout();
918 QLayoutWidget *layoutWidget =
new QLayoutWidget(m_formWindow, parentWidget);
919 core()->metaDataBase()->add(layoutWidget);
922 (
void) create(ui_layout,
nullptr, layoutWidget);
923 return new QWidgetItem(layoutWidget);
925 return QAbstractFormBuilder::create(ui_layoutItem, layout, parentWidget);
930 m_formWindow->unify(o, objName,
true);
931 o->setObjectName(objName);
936
943 case DomProperty::Set: {
944 const QVariant sheetValue = sheet->property(index);
945 if (sheetValue.canConvert<PropertySheetFlagValue>()) {
948 v = f.metaFlags.parseFlags(p->elementSet(), &ok);
950 designerWarning(f.metaFlags.messageParseFailed(p->elementSet()));
955 case DomProperty::Enum: {
956 const QVariant sheetValue = sheet->property(index);
957 if (sheetValue.canConvert<PropertySheetEnumValue>()) {
960 v = e.metaEnum.parseEnum(p->elementEnum(), &ok);
962 designerWarning(e.metaEnum.messageParseFailed(p->elementEnum()));
976 const QString &propertyName = p->attributeName();
978 case DomProperty::Set:
979 if (propertyName == u"features" && o->inherits(
"QDockWidget")
980 && p->elementSet() == u"QDockWidget::AllDockWidgetFeatures") {
984 case DomProperty::Enum:
985 if (propertyName == u"sizeAdjustPolicy" && o->inherits(
"QComboBox")
986 && p->elementEnum() == u"QComboBox::AdjustToMinimumContentsLength") {
998 if (properties.isEmpty())
1006 if (dynamicSheet !=
nullptr && !dynamicSheet->dynamicPropertiesAllowed())
1007 dynamicSheet =
nullptr;
1009 for (DomProperty *p : properties) {
1010 if (isDeprecatedQt5Property(o, p))
1012 const QString &propertyName = p->attributeName();
1013 if (propertyName ==
"numDigits"_L1 && o->inherits(
"QLCDNumber")) {
1014 applyProperty(o, p, u"digitCount"_s, sheet, dynamicSheet);
1015#if QT_VERSION < QT_VERSION_CHECK(7
, 0
, 0
)
1016 }
else if (propertyName ==
"horizontalSizeConstraint"_L1 && o->inherits(
"QLayout")) {
1017 applyProperty(o, p, u"sizeConstraint"_s, sheet, dynamicSheet);
1019 }
else if (propertyName ==
"sizeConstraint"_L1 && o->inherits(
"QLayout")) {
1020 applyProperty(o, p, u"horizontalSizeConstraint"_s, sheet, dynamicSheet);
1021 applyProperty(o, p, u"verticalSizeConstraint"_s, sheet, dynamicSheet);
1024 applyProperty(o, p, propertyName, sheet, dynamicSheet);
1029void QDesignerResource::applyProperty(QObject *o, DomProperty* p,
const QString &propertyName,
1033 const int index = sheet->indexOf(propertyName);
1035 if (!readDomEnumerationValue(p, sheet, index, v))
1036 v = toVariant(o->metaObject(), p);
1037 switch (p->kind()) {
1038 case DomProperty::String:
1040 const DomString *key = p->elementString();
1042 translationParametersFromDom(key, &keyVal);
1043 v = QVariant::fromValue(keyVal);
1045 const DomString *str = p->elementString();
1047 translationParametersFromDom(str, &strVal);
1048 v = QVariant::fromValue(strVal);
1051 case DomProperty::StringList: {
1052 const DomStringList *list = p->elementStringList();
1054 translationParametersFromDom(list, &listValue);
1055 v = QVariant::fromValue(listValue);
1061 d->applyPropertyInternally(o, propertyName, v);
1063 sheet->setProperty(index, v);
1064 sheet->setChanged(index,
true);
1065 }
else if (dynamicSheet !=
nullptr) {
1066 QVariant defaultValue = QVariant(v.metaType());
1067 bool isDefault = (v == defaultValue);
1068 if (v.canConvert<PropertySheetIconValue>()) {
1069 defaultValue = QVariant(QMetaType(QMetaType::QIcon));
1071 }
else if (v.canConvert<PropertySheetPixmapValue>()) {
1072 defaultValue = QVariant(QMetaType(QMetaType::QPixmap));
1074 }
else if (v.canConvert<PropertySheetStringValue>()) {
1075 defaultValue = QVariant(QMetaType(QMetaType::QString));
1077 }
else if (v.canConvert<PropertySheetStringListValue>()) {
1078 defaultValue = QVariant(QMetaType(QMetaType::QStringList));
1080 }
else if (v.canConvert<PropertySheetKeySequenceValue>()) {
1081 defaultValue = QVariant(QMetaType(QMetaType::QKeySequence));
1084 if (defaultValue.metaType().id() != QMetaType::User) {
1085 const int idx = dynamicSheet->addDynamicProperty(p->attributeName(), defaultValue);
1087 sheet->setProperty(idx, v);
1088 sheet->setChanged(idx, !isDefault);
1093 if (propertyName ==
"objectName"_L1)
1094 changeObjectName(o, o->objectName());
1099 QString name = _name;
1101 m_isMainWidget =
false;
1103 QWidget *w = core()->widgetFactory()->createWidget(widgetName, parentWidget);
1107 if (name.isEmpty()) {
1108 QDesignerWidgetDataBaseInterface *db = core()->widgetDataBase();
1109 if (QDesignerWidgetDataBaseItemInterface *item = db->item(db->indexOfObject(w)))
1110 name = qtify(item->name());
1113 changeObjectName(w, name);
1116 if (!qobject_cast<QMenu*>(w) && (!parentWidget || !container)) {
1119 QWidgetList list = qvariant_cast<QWidgetList>(parentWidget->property(
"_q_widgetOrder"));
1121 parentWidget->setProperty(
"_q_widgetOrder", QVariant::fromValue(list));
1122 QWidgetList zOrder = qvariant_cast<QWidgetList>(parentWidget->property(
"_q_zOrder"));
1124 parentWidget->setProperty(
"_q_zOrder", QVariant::fromValue(zOrder));
1127 core()->metaDataBase()->add(w);
1130 w->setWindowFlags(w->windowFlags() & ~Qt::Window);
1132 w->setWindowModality(Qt::NonModal);
1137QLayout *
QDesignerResource::createLayout(
const QString &layoutName, QObject *parent,
const QString &name)
1139 QWidget *layoutBase =
nullptr;
1140 QLayout *layout = qobject_cast<QLayout*>(parent);
1142 if (parent->isWidgetType())
1143 layoutBase =
static_cast<QWidget*>(parent);
1145 Q_ASSERT( layout !=
nullptr );
1146 layoutBase = layout->parentWidget();
1149 LayoutInfo::Type layoutType = LayoutInfo::layoutType(layoutName);
1150 if (layoutType == LayoutInfo::NoLayout) {
1151 designerWarning(QCoreApplication::translate(
"QDesignerResource",
"The layout type '%1' is not supported, defaulting to grid.").arg(layoutName));
1152 layoutType = LayoutInfo::Grid;
1154 QLayout *lay = core()->widgetFactory()->createLayout(layoutBase, layout, layoutType);
1156 changeObjectName(lay, name);
1164 QDesignerMetaDataBaseItemInterface *item = core()->metaDataBase()->item(widget);
1168 if (qobject_cast<Spacer*>(widget) && !m_copyWidget)
1171 const QDesignerWidgetDataBaseInterface *wdb = core()->widgetDataBase();
1172 QDesignerWidgetDataBaseItemInterface *widgetInfo =
nullptr;
1173 const int widgetInfoIndex = wdb->indexOfObject(widget,
false);
1174 if (widgetInfoIndex != -1) {
1175 widgetInfo = wdb->item(widgetInfoIndex);
1177 QDesignerWidgetDataBaseItemInterface *customInfo = widgetInfo;
1178 while (customInfo && customInfo->isCustom()) {
1179 m_usedCustomWidgets.insert(customInfo,
true);
1180 const QString extends = customInfo->extends();
1181 if (extends == customInfo->name())
1183 const int extendsIndex = wdb->indexOfClassName(customInfo->extends());
1184 customInfo = extendsIndex != -1 ? wdb->item(extendsIndex) :
nullptr;
1188 DomWidget *w =
nullptr;
1190 if (QTabWidget *tabWidget = qobject_cast<QTabWidget*>(widget))
1192 else if (QStackedWidget *stackedWidget = qobject_cast<QStackedWidget*>(widget))
1194 else if (QToolBox *toolBox = qobject_cast<QToolBox*>(widget))
1196 else if (QToolBar *toolBar = qobject_cast<QToolBar*>(widget))
1198 else if (QDesignerDockWidget *dockWidget = qobject_cast<QDesignerDockWidget*>(widget))
1202 else if (QWizardPage *wizardPage = qobject_cast<QWizardPage*>(widget))
1205 w = QAbstractFormBuilder::createDom(widget, ui_parentWidget, recursive);
1207 Q_ASSERT( w !=
nullptr );
1209 if (!qobject_cast<QLayoutWidget*>(widget) && w->attributeClass() ==
"QWidget"_L1)
1210 w->setAttributeNative(
true);
1212 const QString className = w->attributeClass();
1213 if (m_internal_to_qt.contains(className))
1214 w->setAttributeClass(m_internal_to_qt.value(className));
1216 if (isPromoted( core(), widget)) {
1217 Q_ASSERT(widgetInfo !=
nullptr);
1219 w->setAttributeClass(widgetInfo->name());
1221 const auto &prop_list = w->elementProperty();
1222 for (DomProperty *prop : prop_list) {
1223 if (prop->attributeName() ==
"geometry"_L1) {
1224 if (DomRect *rect = prop->elementRect()) {
1225 rect->setElementX(widget->x());
1226 rect->setElementY(widget->y());
1231 }
else if (widgetInfo !=
nullptr && m_usedCustomWidgets.contains(widgetInfo)) {
1232 if (widgetInfo->name() != w->attributeClass())
1233 w->setAttributeClass(widgetInfo->name());
1235 addExtensionDataToDOM(
this, core(), w, widget);
1241 QDesignerMetaDataBaseItemInterface *item = core()->metaDataBase()->item(layout);
1243 if (item ==
nullptr) {
1244 layout = layout->findChild<QLayout*>();
1246 item = core()->metaDataBase()->item(layout);
1249 if (item ==
nullptr) {
1254 if (qobject_cast<QSplitter*>(layout->parentWidget()) != 0) {
1259 m_chain.push(layout);
1261 DomLayout *l = QAbstractFormBuilder::createDom(layout, ui_parentLayout, ui_parentWidget);
1262 Q_ASSERT(l !=
nullptr);
1272 DomLayoutItem *ui_item =
nullptr;
1274 if (Spacer *s = qobject_cast<Spacer*>(item->widget())) {
1275 if (!core()->metaDataBase()->item(s))
1278 DomSpacer *spacer =
new DomSpacer();
1279 const QString objectName = s->objectName();
1280 if (!objectName.isEmpty())
1281 spacer->setAttributeName(objectName);
1283 spacer->setElementProperty(computeProperties(item->widget()));
1285 ui_item =
new DomLayoutItem();
1286 ui_item->setElementSpacer(spacer);
1287 d->m_laidout.insert(item->widget(),
true);
1288 }
else if (QLayoutWidget *layoutWidget = qobject_cast<QLayoutWidget*>(item->widget())) {
1290 Q_ASSERT(layoutWidget->layout());
1291 DomLayout *l = createDom(layoutWidget->layout(), ui_layout, ui_parentWidget);
1292 ui_item =
new DomLayoutItem();
1293 ui_item->setElementLayout(l);
1294 d->m_laidout.insert(item->widget(),
true);
1295 }
else if (!item->spacerItem()) {
1296 ui_item = QAbstractFormBuilder::createDom(item, ui_layout, ui_parentWidget);
1305 QSimpleResource::handleDomCustomWidgets(core(), dom_custom_widgets);
1310 QDesignerMetaDataBaseItemInterface *item = core()->metaDataBase()->item(m_formWindow);
1313 QStringList tabStops;
1314 const QWidgetList &tabOrder = item->tabOrder();
1315 for (QWidget *widget : tabOrder) {
1316 if (m_formWindow->mainContainer()->isAncestorOf(widget))
1317 tabStops.append(widget->objectName());
1320 if (!tabStops.isEmpty()) {
1321 DomTabStops *dom =
new DomTabStops;
1322 dom->setElementTabStop(tabStops);
1331 if (tabStops ==
nullptr || widget ==
nullptr)
1334 QWidgetList tabOrder;
1335 const QStringList &elementTabStop = tabStops->elementTabStop();
1336 for (
const QString &widgetName : elementTabStop) {
1337 if (QWidget *w = widget->findChild<QWidget*>(widgetName)) {
1342 QDesignerMetaDataBaseItemInterface *item = core()->metaDataBase()->item(m_formWindow);
1344 item->setTabOrder(tabOrder);
1348
1349
1353 return QCoreApplication::translate(
"QDesignerResource",
1354"The container extension of the widget '%1' (%2) returned a widget not managed by Designer '%3' (%4) when queried for page #%5.\n"
1355"Container pages should only be added by specifying them in XML returned by the domXml() method of the custom widget.").
1356 arg(container->objectName(), WidgetFactory::classNameOf(core, container),
1357 page->objectName(), WidgetFactory::classNameOf(core, page)).
1363 DomWidget *ui_widget = QAbstractFormBuilder::createDom(widget, ui_parentWidget,
false);
1364 QList<DomWidget *> ui_widget_list;
1366 for (
int i=0; i<container->count(); ++i) {
1367 QWidget *page = container->widget(i);
1370 if (DomWidget *ui_page = createDom(page, ui_widget)) {
1371 ui_widget_list.append(ui_page);
1373 designerWarning(msgUnmanagedPage(core(), widget, i, page));
1377 ui_widget->setElementWidget(ui_widget_list);
1384 DomWidget *ui_widget = QAbstractFormBuilder::createDom(widget, ui_parentWidget,
false);
1385 QList<DomWidget *> ui_widget_list;
1387 for (
int i=0; i<container->count(); ++i) {
1388 QWidget *page = container->widget(i);
1390 if (DomWidget *ui_page = createDom(page, ui_widget)) {
1391 ui_widget_list.append(ui_page);
1393 designerWarning(msgUnmanagedPage(core(), widget, i, page));
1398 ui_widget->setElementWidget(ui_widget_list);
1405 DomWidget *ui_widget = QAbstractFormBuilder::createDom(toolBar, ui_parentWidget,
false);
1406 if (
const QMainWindow *mainWindow = qobject_cast<QMainWindow*>(toolBar->parentWidget())) {
1407 const bool toolBarBreak = mainWindow->toolBarBreak(toolBar);
1408 const Qt::ToolBarArea area = mainWindow->toolBarArea(toolBar);
1410 auto attributes = ui_widget->elementAttribute();
1412 DomProperty *attr =
new DomProperty();
1413 attr->setAttributeName(u"toolBarArea"_s);
1414 attr->setElementEnum(QLatin1StringView(toolBarAreaMetaEnum().valueToKey(area)));
1417 attr =
new DomProperty();
1418 attr->setAttributeName(u"toolBarBreak"_s);
1419 attr->setElementBool(toolBarBreak ? u"true"_s : u"false"_s);
1421 ui_widget->setElementAttribute(attributes);
1429 DomWidget *ui_widget = QAbstractFormBuilder::createDom(dockWidget, ui_parentWidget,
true);
1430 if (QMainWindow *mainWindow = qobject_cast<QMainWindow*>(dockWidget->parentWidget())) {
1431 const Qt::DockWidgetArea area = mainWindow->dockWidgetArea(dockWidget);
1432 DomProperty *attr =
new DomProperty();
1433 attr->setAttributeName(u"dockWidgetArea"_s);
1434 attr->setElementNumber(
int(area));
1435 ui_widget->setElementAttribute(ui_widget->elementAttribute() << attr);
1443 DomWidget *ui_widget = QAbstractFormBuilder::createDom(widget, ui_parentWidget,
false);
1444 QList<DomWidget *> ui_widget_list;
1447 const int current = widget->currentIndex();
1448 for (
int i=0; i<container->count(); ++i) {
1449 QWidget *page = container->widget(i);
1452 DomWidget *ui_page = createDom(page, ui_widget);
1454 designerWarning(msgUnmanagedPage(core(), widget, i, page));
1457 QList<DomProperty*> ui_attribute_list;
1460 widget->setCurrentIndex(i);
1462 PropertySheetIconValue icon = qvariant_cast<PropertySheetIconValue>(sheet->property(sheet->indexOf(u"currentTabIcon"_s)));
1463 DomProperty *p = resourceBuilder()->saveResource(workingDirectory(), QVariant::fromValue(icon));
1465 p->setAttributeName(QFormBuilderStrings::iconAttribute);
1466 ui_attribute_list.append(p);
1469 p = textBuilder()->saveText(sheet->property(sheet->indexOf(u"currentTabText"_s)));
1471 p->setAttributeName(QFormBuilderStrings::titleAttribute);
1472 ui_attribute_list.append(p);
1476 QVariant v = sheet->property(sheet->indexOf(u"currentTabToolTip"_s));
1478 p = textBuilder()->saveText(v);
1480 p->setAttributeName(QFormBuilderStrings::toolTipAttribute);
1481 ui_attribute_list.append(p);
1486 v = sheet->property(sheet->indexOf(u"currentTabWhatsThis"_s));
1488 p = textBuilder()->saveText(v);
1490 p->setAttributeName(QFormBuilderStrings::whatsThisAttribute);
1491 ui_attribute_list.append(p);
1495 ui_page->setElementAttribute(ui_attribute_list);
1497 ui_widget_list.append(ui_page);
1499 widget->setCurrentIndex(current);
1502 ui_widget->setElementWidget(ui_widget_list);
1509 DomWidget *ui_widget = QAbstractFormBuilder::createDom(widget, ui_parentWidget,
false);
1510 QList<DomWidget *> ui_widget_list;
1513 const int current = widget->currentIndex();
1514 for (
int i=0; i<container->count(); ++i) {
1515 QWidget *page = container->widget(i);
1518 DomWidget *ui_page = createDom(page, ui_widget);
1520 designerWarning(msgUnmanagedPage(core(), widget, i, page));
1525 QList<DomProperty*> ui_attribute_list;
1528 widget->setCurrentIndex(i);
1530 PropertySheetIconValue icon = qvariant_cast<PropertySheetIconValue>(sheet->property(sheet->indexOf(u"currentItemIcon"_s)));
1531 DomProperty *p = resourceBuilder()->saveResource(workingDirectory(), QVariant::fromValue(icon));
1533 p->setAttributeName(QFormBuilderStrings::iconAttribute);
1534 ui_attribute_list.append(p);
1536 p = textBuilder()->saveText(sheet->property(sheet->indexOf(u"currentItemText"_s)));
1538 p->setAttributeName(QFormBuilderStrings::labelAttribute);
1539 ui_attribute_list.append(p);
1543 QVariant v = sheet->property(sheet->indexOf(u"currentItemToolTip"_s));
1545 p = textBuilder()->saveText(v);
1547 p->setAttributeName(QFormBuilderStrings::toolTipAttribute);
1548 ui_attribute_list.append(p);
1552 ui_page->setElementAttribute(ui_attribute_list);
1554 ui_widget_list.append(ui_page);
1556 widget->setCurrentIndex(current);
1559 ui_widget->setElementWidget(ui_widget_list);
1566 DomWidget *ui_widget = QAbstractFormBuilder::createDom(wizardPage, ui_parentWidget,
true);
1569 const QString pageIdPropertyName = QLatin1StringView(QWizardPagePropertySheet::pageIdProperty);
1570 const int pageIdIndex = sheet->indexOf(pageIdPropertyName);
1571 if (pageIdIndex != -1 && sheet->isChanged(pageIdIndex)) {
1572 DomProperty *property = variantToDomProperty(
this, wizardPage->metaObject(), pageIdPropertyName, sheet->property(pageIdIndex));
1574 property->elementString()->setAttributeNotr(u"true"_s);
1575 DomPropertyList attributes = ui_widget->elementAttribute();
1576 attributes.push_back(property);
1577 ui_widget->setElementAttribute(attributes);
1585 if (qobject_cast<
const QToolBox *>(w))
1586 return QToolBoxWidgetPropertySheet::checkProperty(propertyName);
1587 if (qobject_cast<
const QTabWidget *>(w))
1588 return QTabWidgetPropertySheet::checkProperty(propertyName);
1589 if (qobject_cast<
const QStackedWidget *>(w))
1590 return QStackedWidgetPropertySheet::checkProperty(propertyName);
1591 if (qobject_cast<
const QMdiArea *>(w))
1598 const QDesignerMetaObjectInterface *meta = core()->introspection()->metaObject(obj);
1600 const int pindex = meta->indexOfProperty(prop);
1601 if (pindex != -1 && !meta->property(pindex)->attributes().testFlag(QDesignerMetaPropertyInterface::StoredAttribute))
1604 if (prop ==
"objectName"_L1 || prop ==
"spacerName"_L1)
1607 if (!d->m_separateSizeConstraints && prop ==
"verticalSizeConstraint"_L1)
1610 QWidget *check_widget =
nullptr;
1611 if (obj->isWidgetType())
1612 check_widget =
static_cast<QWidget*>(obj);
1614 if (check_widget && prop ==
"geometry"_L1) {
1617 if (m_selected && m_selected == check_widget)
1620 return !LayoutInfo::isWidgetLaidout(core(), check_widget);
1628 const int pindex = sheet->indexOf(prop);
1629 if (sheet->isAttribute(pindex))
1633 return sheet->isChanged(pindex);
1634 if (!sheet->isVisible(pindex))
1644 if (item->widget() ==
nullptr) {
1648 QGridLayout *grid = qobject_cast<QGridLayout*>(layout);
1649 QBoxLayout *box = qobject_cast<QBoxLayout*>(layout);
1651 if (grid !=
nullptr) {
1652 const int rowSpan = ui_item->hasAttributeRowSpan() ? ui_item->attributeRowSpan() : 1;
1653 const int colSpan = ui_item->hasAttributeColSpan() ? ui_item->attributeColSpan() : 1;
1654 grid->addWidget(item->widget(), ui_item->attributeRow(), ui_item->attributeColumn(), rowSpan, colSpan, item->alignment());
1657 if (box !=
nullptr) {
1662 return QAbstractFormBuilder::addItem(ui_item, item, layout);
1667 core()->metaDataBase()->add(widget);
1669 if (! QAbstractFormBuilder::addItem(ui_widget, widget, parentWidget) || qobject_cast<QMainWindow*> (parentWidget)) {
1671 container->addWidget(widget);
1674 if (QTabWidget *tabWidget = qobject_cast<QTabWidget*>(parentWidget)) {
1675 const int tabIndex = tabWidget->count() - 1;
1676 const int current = tabWidget->currentIndex();
1678 tabWidget->setCurrentIndex(tabIndex);
1680 const auto &attributes = ui_widget->elementAttribute();
1682 if (
auto *picon = QFBE::propertyByName(attributes, QFormBuilderStrings::iconAttribute)) {
1683 QVariant v = resourceBuilder()->loadResource(workingDirectory(), picon);
1684 sheet->setProperty(sheet->indexOf(u"currentTabIcon"_s), v);
1686 if (
auto *ptext = QFBE::propertyByName(attributes, QFormBuilderStrings::titleAttribute)) {
1687 QVariant v = textBuilder()->loadText(ptext);
1688 sheet->setProperty(sheet->indexOf(u"currentTabText"_s), v);
1690 if (
auto *ptext = QFBE::propertyByName(attributes, QFormBuilderStrings::toolTipAttribute)) {
1691 QVariant v = textBuilder()->loadText(ptext);
1692 sheet->setProperty(sheet->indexOf(u"currentTabToolTip"_s), v);
1694 if (
auto *ptext = QFBE::propertyByName(attributes, QFormBuilderStrings::whatsThisAttribute)) {
1695 QVariant v = textBuilder()->loadText(ptext);
1696 sheet->setProperty(sheet->indexOf(u"currentTabWhatsThis"_s), v);
1698 tabWidget->setCurrentIndex(current);
1699 }
else if (QToolBox *toolBox = qobject_cast<QToolBox*>(parentWidget)) {
1700 const int itemIndex = toolBox->count() - 1;
1701 const int current = toolBox->currentIndex();
1703 toolBox->setCurrentIndex(itemIndex);
1705 const auto &attributes = ui_widget->elementAttribute();
1707 if (
auto *picon = QFBE::propertyByName(attributes, QFormBuilderStrings::iconAttribute)) {
1708 QVariant v = resourceBuilder()->loadResource(workingDirectory(), picon);
1709 sheet->setProperty(sheet->indexOf(u"currentItemIcon"_s), v);
1711 if (
auto *ptext = QFBE::propertyByName(attributes, QFormBuilderStrings::labelAttribute)) {
1712 QVariant v = textBuilder()->loadText(ptext);
1713 sheet->setProperty(sheet->indexOf(u"currentItemText"_s), v);
1715 if (
auto *ptext = QFBE::propertyByName(attributes, QFormBuilderStrings::toolTipAttribute)) {
1716 QVariant v = textBuilder()->loadText(ptext);
1717 sheet->setProperty(sheet->indexOf(u"currentItemToolTip"_s), v);
1719 toolBox->setCurrentIndex(current);
1727 m_copyWidget =
true;
1729 DomUI *ui = copy(selection);
1731 d->m_laidout.clear();
1732 m_copyWidget =
false;
1737 QXmlStreamWriter writer(dev);
1738 writer.setAutoFormatting(
true);
1739 writer.setAutoFormattingIndent(1);
1740 writer.writeStartDocument();
1742 writer.writeEndDocument();
1749 if (selection.empty())
1752 m_copyWidget =
true;
1754 DomWidget *ui_widget =
new DomWidget();
1755 ui_widget->setAttributeName(clipboardObjectName);
1756 bool hasItems =
false;
1758 if (!selection.m_widgets.isEmpty()) {
1759 QList<DomWidget *> ui_widget_list;
1760 for (
auto *w : selection.m_widgets) {
1762 DomWidget *ui_child = createDom(w, ui_widget);
1763 m_selected =
nullptr;
1765 ui_widget_list.append(ui_child);
1767 if (!ui_widget_list.isEmpty()) {
1768 ui_widget->setElementWidget(ui_widget_list);
1773 if (!selection.m_actions.isEmpty()) {
1774 QList<DomAction *> domActions;
1775 for (QAction* action : std::as_const(selection.m_actions)) {
1776 if (DomAction *domAction = createDom(action))
1777 domActions += domAction;
1779 if (!domActions.isEmpty()) {
1780 ui_widget-> setElementAction(domActions);
1785 d->m_laidout.clear();
1786 m_copyWidget =
false;
1793 DomUI *ui =
new DomUI();
1794 ui->setAttributeVersion(currentUiVersion);
1795 ui->setElementWidget(ui_widget);
1796 ui->setElementResources(
saveResources(m_resourceBuilder->usedQrcFiles()
));
1798 ui->setElementCustomWidgets(cws);
1805 const int saved = m_isMainWidget;
1806 m_isMainWidget =
false;
1811 const DomWidget *topLevel = ui->elementWidget();
1813 const auto &domWidgets = topLevel->elementWidget();
1814 if (!domWidgets.isEmpty()) {
1815 const QPoint offset = m_formWindow->grid();
1816 for (DomWidget* domWidget : domWidgets) {
1817 if (QWidget *w = create(domWidget, widgetParent)) {
1818 w->move(w->pos() + offset);
1820 rc.m_widgets.append(w);
1824 const auto domActions = topLevel->elementAction();
1825 for (DomAction *domAction : domActions) {
1826 if (QAction *a = create(domAction, actionParent))
1827 rc.m_actions .append(a);
1830 m_isMainWidget = saved;
1832 if (QDesignerExtraInfoExtension *extra = qt_extension<QDesignerExtraInfoExtension*>(core()->extensionManager(), core()))
1833 extra->loadUiExtraInfo(ui);
1843 QXmlStreamReader reader(dev);
1844 bool uiInitialized =
false;
1846 while (!reader.atEnd()) {
1847 if (reader.readNext() == QXmlStreamReader::StartElement) {
1848 if (reader.name().compare(
"ui"_L1, Qt::CaseInsensitive)) {
1850 uiInitialized =
true;
1853 reader.raiseError(QCoreApplication::translate(
"QDesignerResource",
"Unexpected element <%1>").arg(reader.name().toString()));
1857 if (reader.hasError()) {
1859 designerWarning(QCoreApplication::translate(
"QDesignerResource",
"Error while pasting clipboard contents at line %1, column %2: %3")
1860 .arg(reader.lineNumber()).arg(reader.columnNumber())
1861 .arg(reader.errorString()));
1862 uiInitialized =
false;
1863 }
else if (!uiInitialized) {
1865 designerWarning(QCoreApplication::translate(
"QDesignerResource",
"Error while pasting clipboard contents: The root element <ui> is missing."));
1869 return FormBuilderClipboard();
1878 QAbstractFormBuilder::layoutInfo(layout, parent, margin, spacing);
1883 if (m_usedCustomWidgets.isEmpty())
1888 QDesignerFormEditorInterface *core = m_formWindow
->core();
1889 QDesignerWidgetDataBaseInterface *db = core->widgetDataBase();
1890 const bool isInternalWidgetDataBase = qobject_cast<
const WidgetDataBase *>(db);
1891 QMap<
int, DomCustomWidget *> orderedMap;
1893 for (
auto it = m_usedCustomWidgets.cbegin(), end = m_usedCustomWidgets.cend(); it != end; ++it) {
1894 QDesignerWidgetDataBaseItemInterface *item = it.key();
1895 const QString name = item->name();
1896 DomCustomWidget *custom_widget =
new DomCustomWidget;
1898 custom_widget->setElementClass(name);
1899 if (item->isContainer())
1900 custom_widget->setElementContainer(item->isContainer());
1902 if (!item->includeFile().isEmpty()) {
1903 DomHeader *header =
new DomHeader;
1904 const IncludeSpecification spec = includeSpecification(item->includeFile());
1905 header->setText(spec.first);
1907 header->setAttributeLocation(u"global"_s);
1909 custom_widget->setElementHeader(header);
1910 custom_widget->setElementExtends(item->extends());
1913 if (isInternalWidgetDataBase) {
1914 WidgetDataBaseItem *internalItem =
static_cast<WidgetDataBaseItem *>(item);
1915 const QStringList fakeSlots = internalItem->fakeSlots();
1916 const QStringList fakeSignals = internalItem->fakeSignals();
1917 if (!fakeSlots.isEmpty() || !fakeSignals.isEmpty()) {
1918 DomSlots *domSlots =
new DomSlots();
1919 domSlots->setElementSlot(fakeSlots);
1920 domSlots->setElementSignal(fakeSignals);
1921 custom_widget->setElementSlots(domSlots);
1923 const QString addPageMethod = internalItem->addPageMethod();
1924 if (!addPageMethod.isEmpty())
1925 custom_widget->setElementAddPageMethod(addPageMethod);
1928 orderedMap.insert(db->indexOfClassName(name), custom_widget);
1931 DomCustomWidgets *customWidgets =
new DomCustomWidgets;
1932 customWidgets->setElementCustomWidget(orderedMap.values().toVector());
1933 return customWidgets;
1939 if (qobject_cast<QGridLayout *>(object)) {
1940 const int h = sheet->property(sheet->indexOf(u"horizontalSpacing"_s)).toInt();
1941 const int v = sheet->property(sheet->indexOf(u"verticalSpacing"_s)).toInt();
1951 QList<DomProperty*> properties;
1954 const int count = sheet->count();
1955 QList<DomProperty *> spacingProperties;
1956 const bool compressSpacings = canCompressSpacings(object);
1957 for (
int index = 0; index < count; ++index) {
1961 const QString propertyName = sheet->propertyName(index);
1963 if (propertyName ==
"windowModality"_L1 && !sheet->isVisible(index))
1966 const QVariant value = sheet->property(index);
1967 if (DomProperty *p = createProperty(object, propertyName, value)) {
1968 if (compressSpacings && (propertyName ==
"horizontalSpacing"_L1
1969 || propertyName ==
"verticalSpacing"_L1)) {
1970 spacingProperties.append(p);
1972 properties.append(p);
1976 if (compressSpacings) {
1977 if (spacingProperties.size() == 2) {
1978 DomProperty *spacingProperty = spacingProperties.at(0);
1979 spacingProperty->setAttributeName(u"spacing"_s);
1980 properties.append(spacingProperty);
1981 delete spacingProperties.at(1);
1983 properties += spacingProperties;
1990DomProperty *
QDesignerResource::applyProperStdSetAttribute(QObject *object,
const QString &propertyName, DomProperty *property)
1995 QExtensionManager *mgr = core()->extensionManager();
1998 const QDesignerPropertySheet *designerSheet = qobject_cast<QDesignerPropertySheet*>(core()->extensionManager()->extension(object, Q_TYPEID(QDesignerPropertySheetExtension)));
1999 const int index = sheet->indexOf(propertyName);
2000 if ((dynamicSheet && dynamicSheet
->isDynamicProperty(index
)) || (designerSheet && designerSheet->isDefaultDynamicProperty(index)))
2001 property->setAttributeStdset(0);
2007static inline bool hasSetter(QDesignerFormEditorInterface *core, QObject *object,
const QString &propertyName)
2009 const QDesignerMetaObjectInterface *meta = core->introspection()->metaObject(object);
2010 const int pindex = meta->indexOfProperty(propertyName);
2013 return meta->property(pindex)->hasSetter();
2016DomProperty *
QDesignerResource::createProperty(QObject *object,
const QString &propertyName,
const QVariant &value)
2018 if (!checkProperty(object, propertyName)) {
2024 const auto mode = d->m_fullyQualifiedEnums
2025 ? DesignerMetaFlags::FullyQualified : DesignerMetaFlags::Qualified;
2026 const QString flagString = f.metaFlags.toString(f.value, mode);
2027 if (flagString.isEmpty())
2030 DomProperty *p =
new DomProperty;
2032 if (!hasSetter(core(), object, propertyName))
2033 p->setAttributeStdset(0);
2034 p->setAttributeName(propertyName);
2035 p->setElementSet(flagString);
2036 return applyProperStdSetAttribute(object, propertyName, p);
2040 const auto mode = d->m_fullyQualifiedEnums
2041 ? DesignerMetaEnum::FullyQualified : DesignerMetaEnum::Qualified;
2043 const QString id = e.metaEnum.toString(e.value, mode, &ok);
2045 designerWarning(e.metaEnum.messageToStringFailed(e.value));
2049 DomProperty *p =
new DomProperty;
2051 if (!hasSetter(core(), object, propertyName))
2052 p->setAttributeStdset(0);
2054 if (!d->m_separateSizeConstraints && propertyName ==
"horizontalSizeConstraint"_L1
2055 && object->inherits(
"QLayout")) {
2056 p->setAttributeName(
"sizeConstraint"_L1);
2058 p->setAttributeName(propertyName);
2060 p->setElementEnum(id);
2061 return applyProperStdSetAttribute(object, propertyName, p);
2065 DomProperty *p = stringToDomProperty(strVal.value(), strVal);
2066 if (!hasSetter(core(), object, propertyName))
2067 p->setAttributeStdset(0);
2069 p->setAttributeName(propertyName);
2071 return applyProperStdSetAttribute(object, propertyName, p);
2075 DomProperty *p =
new DomProperty;
2076 if (!hasSetter(core(), object, propertyName))
2077 p->setAttributeStdset(0);
2079 p->setAttributeName(propertyName);
2081 DomStringList *domStringList =
new DomStringList();
2082 domStringList->setElementString(listValue.value());
2083 translationParametersToDom(listValue, domStringList);
2084 p->setElementStringList(domStringList);
2085 return applyProperStdSetAttribute(object, propertyName, p);
2089 DomProperty *p = stringToDomProperty(keyVal.value().toString(), keyVal);
2090 if (!hasSetter(core(), object, propertyName))
2091 p->setAttributeStdset(0);
2093 p->setAttributeName(propertyName);
2095 return applyProperStdSetAttribute(object, propertyName, p);
2098 return applyProperStdSetAttribute(object, propertyName, QAbstractFormBuilder::createProperty(object, propertyName, value));
2101QStringList
QDesignerResource::mergeWithLoadedPaths(
const QStringList &paths)
const
2103 QStringList newPaths = paths;
2105 const QStringList loadedPaths = m_resourceBuilder->loadedQrcFiles();
2106 std::remove_copy_if(loadedPaths.cbegin(), loadedPaths.cend(),
2107 std::back_inserter(newPaths),
2108 [&newPaths] (
const QString &path) {
return newPaths.contains(path); });
2117 if (resources !=
nullptr) {
2118 const auto &dom_include = resources->elementInclude();
2119 for (DomResource *res : dom_include) {
2120 QString path = QDir::cleanPath(m_formWindow->absoluteDir().absoluteFilePath(res->attributeLocation()));
2121 while (!QFile::exists(path)) {
2122 QWidget *dialogParent = m_formWindow->core()->topLevel();
2123 const QString promptTitle = QCoreApplication::translate(
"qdesigner_internal::QDesignerResource",
"Loading qrc file");
2124 const QString prompt = QCoreApplication::translate(
"qdesigner_internal::QDesignerResource",
"The specified qrc file <p><b>%1</b></p><p>could not be found. Do you want to update the file location?</p>").arg(path);
2126 const QMessageBox::StandardButton answer = core()->dialogGui()->message(dialogParent, QDesignerDialogGuiInterface::ResourceLoadFailureMessage,
2127 QMessageBox::Warning, promptTitle, prompt, QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes);
2128 if (answer == QMessageBox::Yes) {
2129 const QFileInfo fi(path);
2130 const QString fileDialogTitle = QCoreApplication::translate(
"qdesigner_internal::QDesignerResource",
"New location for %1").arg(fi.fileName());
2131 const QString fileDialogPattern = QCoreApplication::translate(
"qdesigner_internal::QDesignerResource",
"Resource files (*.qrc)");
2132 path = core()->dialogGui()->getOpenFileName(dialogParent, fileDialogTitle, fi.absolutePath(), fileDialogPattern);
2135 m_formWindow->setProperty(
"_q_resourcepathchanged", QVariant(
true));
2140 if (!path.isEmpty()) {
2142 m_formWindow->addResourceFile(path);
2148 paths = mergeWithLoadedPaths(paths);
2151 QtResourceSet *resourceSet = m_formWindow->resourceSet();
2153 QStringList newPaths = resourceSet->activeResourceFilePaths();
2154 std::remove_copy_if(paths.cbegin(), paths.cend(),
2155 std::back_inserter(newPaths),
2156 [&newPaths] (
const QString &path) {
return newPaths.contains(path); });
2157 resourceSet->activateResourceFilePaths(newPaths);
2159 resourceSet = m_formWindow
->core()->resourceModel()->addResourceSet(paths);
2160 m_formWindow->setResourceSet(resourceSet);
2161 QObject::connect(m_formWindow->core()->resourceModel(), &QtResourceModel::resourceSetActivated,
2162 m_formWindow, &FormWindowBase::resourceSetActivated);
2169 switch (m_formWindow->resourceFileSaveMode()) {
2170 case QDesignerFormWindowInterface::SaveAllResourceFiles:
2171 paths = m_formWindow->activeResourceFilePaths();
2173 case QDesignerFormWindowInterface::SaveOnlyUsedResourceFiles:
2174 paths = m_resourceBuilder->usedQrcFiles();
2176 case QDesignerFormWindowInterface::DontSaveResourceFiles:
2184 QtResourceSet *resourceSet = m_formWindow->resourceSet();
2185 QList<DomResource *> dom_include;
2187 const QStringList activePaths = resourceSet->activeResourceFilePaths();
2188 for (
const QString &path : activePaths) {
2189 if (qrcPaths.contains(path)) {
2190 DomResource *dom_res =
new DomResource;
2191 QString conv_path = path;
2192 if (m_resourceBuilder->isSaveRelative())
2193 conv_path = m_formWindow->absoluteDir().relativeFilePath(path);
2194 conv_path.replace(QDir::separator(), u'/');
2195 dom_res->setAttributeLocation(conv_path);
2196 dom_include.append(dom_res);
2201 DomResources *dom_resources =
new DomResources;
2202 dom_resources->setElementInclude(dom_include);
2204 return dom_resources;
2217 if (core()->metaDataBase()->item(actionGroup) !=
nullptr) {
2218 return QAbstractFormBuilder::createDom(actionGroup);
2226 if (QAction *action = QAbstractFormBuilder::create(ui_action, parent)) {
2227 core()->metaDataBase()->add(action);
2236 if (QActionGroup *actionGroup = QAbstractFormBuilder::create(ui_action_group, parent)) {
2237 core()->metaDataBase()->add(actionGroup);
2260 if (QAction *action = QAbstractFormBuilder::createAction(parent, name)) {
2261 core()->metaDataBase()->add(action);
2270 if (QActionGroup *actionGroup = QAbstractFormBuilder::createActionGroup(parent, name)) {
2271 core()->metaDataBase()->add(actionGroup);
2279
2282 const DomPropertyList attributes = ui_widget->elementAttribute();
2283 if (attributes.isEmpty())
2286 for (
auto *prop : attributes) {
2287 const QString name = prop->attributeName();
2288 const int index = sheet->indexOf(name);
2290 const QString msg =
"Unable to apply attributive property '%1' to '%2'. It does not exist."_L1.arg(name, widget->objectName());
2291 designerWarning(msg);
2293 sheet->setProperty(index, domPropertyToVariant(
this, widget->metaObject(), prop));
2294 sheet->setChanged(index,
true);
2301 QAbstractFormBuilder::loadExtraInfo(ui_widget, widget, parentWidget);
2303 if (qobject_cast<
const QWizardPage*>(widget))
2304 applyAttributesToPropertySheet(ui_widget, widget);
virtual bool isDynamicProperty(int index) const =0
virtual bool isLanguageResource(const QString &path) const =0
static void markChangedStretchProperties(QDesignerFormEditorInterface *core, QLayout *lt, const DomLayout *domLayout)
static void stretchAttributesToDom(QDesignerFormEditorInterface *core, QLayout *lt, DomLayout *domLayout)
QVariant toNativeValue(const QVariant &value) const override
bool isResourceType(const QVariant &value) const override
QVariant loadResource(const QDir &workingDirectory, const DomProperty *icon) const override
QStringList loadedQrcFiles() const
QStringList usedQrcFiles() const
QDesignerResourceBuilder(QDesignerFormEditorInterface *core, DesignerPixmapCache *pixmapCache, DesignerIconCache *iconCache)
DomProperty * saveResource(const QDir &workingDirectory, const QVariant &value) const override
bool isSaveRelative() const
void setSaveRelative(bool relative)
void setIconCache(DesignerIconCache *iconCache)
void setPixmapCache(DesignerPixmapCache *pixmapCache)
DomActionGroup * createDom(QActionGroup *actionGroup) override
QWidget * load(QIODevice *dev, QWidget *parentWidget) override
Loads an XML representation of a widget from the given device, and constructs a new widget with the s...
bool addItem(DomLayoutItem *ui_item, QLayoutItem *item, QLayout *layout) override
DomLayoutItem * createDom(QLayoutItem *item, DomLayout *ui_layout, DomWidget *ui_parentWidget) override
DomLayout * createDom(QLayout *layout, DomLayout *ui_layout, DomWidget *ui_parentWidget) override
void applyProperties(QObject *o, const QList< DomProperty * > &properties) override
void createCustomWidgets(DomCustomWidgets *) override
QLayout * create(DomLayout *ui_layout, QLayout *layout, QWidget *parentWidget) override
void applyTabStops(QWidget *widget, DomTabStops *tabStops) override
DomWidget * saveWidget(QToolBar *toolBar, DomWidget *ui_parentWidget)
DomCustomWidgets * saveCustomWidgets() override
DomWidget * saveWidget(QDesignerDockWidget *dockWidget, DomWidget *ui_parentWidget)
DomUI * copy(const FormBuilderClipboard &selection) override
QAction * create(DomAction *ui_action, QObject *parent) override
DomUI * readUi(QIODevice *dev)
QActionGroup * create(DomActionGroup *ui_action_group, QObject *parent) override
DomWidget * saveWidget(QWizardPage *wizardPage, DomWidget *ui_parentWidget)
void saveDom(DomUI *ui, QWidget *widget) override
void createResources(DomResources *) override
void save(QIODevice *dev, QWidget *widget) override
Saves an XML representation of the given widget to the specified device in the standard UI file forma...
QLayoutItem * create(DomLayoutItem *ui_layoutItem, QLayout *layout, QWidget *parentWidget) override
DomResources * saveResources() override
QWidget * create(DomUI *ui, QWidget *parentWidget) override
QWidget * loadUi(DomUI *ui, QWidget *parentWidget)
void loadExtraInfo(DomWidget *ui_widget, QWidget *widget, QWidget *parentWidget) override
void setSaveRelative(bool relative)
QDesignerResource(FormWindow *fw)
DomWidget * createDom(QWidget *widget, DomWidget *ui_parentWidget, bool recursive=true) override
DomWidget * saveWidget(QTabWidget *widget, DomWidget *ui_parentWidget)
DomWidget * saveWidget(QToolBox *widget, DomWidget *ui_parentWidget)
FormBuilderClipboard paste(DomUI *ui, QWidget *widgetParent, QObject *actionParent=nullptr) override
DomWidget * saveWidget(QWidget *widget, QDesignerContainerExtension *container, DomWidget *ui_parentWidget)
bool addItem(DomWidget *ui_widget, QWidget *widget, QWidget *parentWidget) override
void layoutInfo(DomLayout *layout, QObject *parent, int *margin, int *spacing) override
FormBuilderClipboard paste(QIODevice *dev, QWidget *widgetParent, QObject *actionParent=nullptr) override
QList< DomProperty * > computeProperties(QObject *obj) override
DomWidget * saveWidget(QStackedWidget *widget, DomWidget *ui_parentWidget)
QWidget * create(DomWidget *ui_widget, QWidget *parentWidget) override
DomTabStops * saveTabStops() override
bool saveRelative() const
bool copy(QIODevice *dev, const FormBuilderClipboard &selection) override
~QDesignerResource() override
QDesignerTextBuilder()=default
QVariant toNativeValue(const QVariant &value) const override
DomProperty * saveText(const QVariant &value) const override
QVariant loadText(const DomProperty *icon) const override
static bool checkProperty(const QString &propertyName)
Auxiliary methods to store/retrieve settings.
static QString messageBoxTitle()
static void setIconPixmap(QIcon::Mode m, QIcon::State s, const QDir &workingDirectory, QString path, PropertySheetIconValue &icon, const QDesignerLanguageExtension *lang=nullptr)
static DomProperty * stringToDomProperty(const QString &value, const PropertySheetTranslatableData &translatableData)
QString msgUnmanagedPage(QDesignerFormEditorInterface *core, QWidget *container, int index, QWidget *page)
static DomProperty * stringToDomProperty(const QString &value)
void translationParametersToDom(const PropertySheetTranslatableData &data, DomElement *e)
static bool supportsQualifiedEnums(const QVersionNumber &qtVersion)
static bool hasSetter(QDesignerFormEditorInterface *core, QObject *object, const QString &propertyName)
static bool isDeprecatedQt5Property(const QObject *o, const DomProperty *p)
static bool readDomEnumerationValue(const DomProperty *p, const QDesignerPropertySheetExtension *sheet, int index, QVariant &v)
static bool checkContainerProperty(const QWidget *w, const QString &propertyName)
void translationParametersFromDom(const DomElement *e, PropertySheetTranslatableData *data)
#define OLD_RESOURCE_FORMAT
static constexpr auto clipboardObjectName
static constexpr auto currentUiVersion