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>
87Q_DECLARE_METATYPE(QWidgetList)
91using namespace Qt::StringLiterals;
93using QFBE = QFormBuilderExtra;
96 using DomPropertyList = QList<DomProperty *>;
102#define OLD_RESOURCE_FORMAT
109 if (qtVersion >= QVersionNumber{6, 6, 2})
112 switch (qtVersion.majorVersion()) {
114 switch (qtVersion.minorVersion()) {
116 if (qtVersion.microVersion() >= 4)
120 if (qtVersion.microVersion() >= 13)
127 if (qtVersion >= QVersionNumber{5, 15, 18})
137 return qtVersion >= QVersionNumber{7, 0, 0};
146 void setPixmapCache(DesignerPixmapCache *pixmapCache) { m_pixmapCache = pixmapCache; }
147 void setIconCache(DesignerIconCache *iconCache) { m_iconCache = iconCache; }
155 QVariant
loadResource(
const QDir &workingDirectory,
const DomProperty *icon)
const override;
159 DomProperty *
saveResource(
const QDir &workingDirectory,
const QVariant &value)
const override;
164 QDesignerFormEditorInterface *m_core;
165 DesignerPixmapCache *m_pixmapCache;
166 DesignerIconCache *m_iconCache;
169 mutable QMap<QString,
bool> m_usedQrcFiles;
170 mutable QMap<QString,
bool> m_loadedQrcFiles;
175 m_pixmapCache(pixmapCache),
176 m_iconCache(iconCache),
182static inline void setIconPixmap(QIcon::Mode m, QIcon::State s,
const QDir &workingDirectory,
183 QString path, PropertySheetIconValue &icon,
187 path = QFileInfo(workingDirectory, path).absoluteFilePath();
188 icon.setPixmap(m, s, PropertySheetPixmapValue(path));
193 switch (property->kind()) {
194 case DomProperty::Pixmap: {
196 DomResourcePixmap *dp = property->elementPixmap();
197 if (!dp->text().isEmpty()) {
199 pixmap.setPath(dp->text());
201 pixmap.setPath(QFileInfo(workingDirectory, dp->text()).absoluteFilePath());
204 if (dp->hasAttributeResource())
205 m_loadedQrcFiles.insert(QFileInfo(workingDirectory, dp->attributeResource()).absoluteFilePath(),
false);
208 return QVariant::fromValue(pixmap);
211 case DomProperty::IconSet: {
213 DomResourceIcon *di = property->elementIconSet();
214 const bool hasTheme = di->hasAttributeTheme();
216 const QString &theme = di->attributeTheme();
217 const qsizetype themeEnum = theme.startsWith(
"QIcon::"_L1)
218 ? QDesignerResourceBuilder::themeIconIndex(theme) : -1;
220 icon.setThemeEnum(themeEnum);
222 icon.setTheme(theme);
224 if (
const int flags = iconStateFlags(di)) {
225 if (flags & NormalOff)
226 setIconPixmap(QIcon::Normal, QIcon::Off, workingDirectory, di->elementNormalOff()->text(), icon, m_lang);
227 if (flags & NormalOn)
228 setIconPixmap(QIcon::Normal, QIcon::On, workingDirectory, di->elementNormalOn()->text(), icon, m_lang);
229 if (flags & DisabledOff)
230 setIconPixmap(QIcon::Disabled, QIcon::Off, workingDirectory, di->elementDisabledOff()->text(), icon, m_lang);
231 if (flags & DisabledOn)
232 setIconPixmap(QIcon::Disabled, QIcon::On, workingDirectory, di->elementDisabledOn()->text(), icon, m_lang);
233 if (flags & ActiveOff)
234 setIconPixmap(QIcon::Active, QIcon::Off, workingDirectory, di->elementActiveOff()->text(), icon, m_lang);
235 if (flags & ActiveOn)
236 setIconPixmap(QIcon::Active, QIcon::On, workingDirectory, di->elementActiveOn()->text(), icon, m_lang);
237 if (flags & SelectedOff)
238 setIconPixmap(QIcon::Selected, QIcon::Off, workingDirectory, di->elementSelectedOff()->text(), icon, m_lang);
239 if (flags & SelectedOn)
240 setIconPixmap(QIcon::Selected, QIcon::On, workingDirectory, di->elementSelectedOn()->text(), icon, m_lang);
241 }
else if (!hasTheme) {
243 setIconPixmap(QIcon::Normal, QIcon::Off, workingDirectory, di->text(), icon, m_lang);
244 if (di->hasAttributeResource())
245 m_loadedQrcFiles.insert(QFileInfo(workingDirectory, di->attributeResource()).absoluteFilePath(),
false);
248 return QVariant::fromValue(icon);
270 DomProperty *p =
new DomProperty;
273 DomResourcePixmap *rp =
new DomResourcePixmap;
274 const QString pixPath = pix.path();
275 switch (pix.pixmapSource(m_core)) {
276 case PropertySheetPixmapValue::LanguageResourcePixmap:
277 rp->setText(pixPath);
279 case PropertySheetPixmapValue::ResourcePixmap: {
280 rp->setText(pixPath);
281 const QString qrcFile = m_core->resourceModel()->qrcPath(pixPath);
282 if (!qrcFile.isEmpty()) {
283 m_usedQrcFiles.insert(qrcFile,
false);
285 rp->setAttributeResource(workingDirectory.relativeFilePath(qrcFile));
290 case PropertySheetPixmapValue::FilePixmap:
291 rp->setText(m_saveRelative ? workingDirectory.relativeFilePath(pixPath) : pixPath);
294 p->setElementPixmap(rp);
299 const auto &pixmaps = icon.paths();
300 const int themeEnum = icon.themeEnum();
301 const QString theme = themeEnum != -1
302 ? QDesignerResourceBuilder::fullyQualifiedThemeIconName(themeEnum) : icon.theme();
303 if (!pixmaps.isEmpty() || !theme.isEmpty()) {
304 DomResourceIcon *ri =
new DomResourceIcon;
305 if (!theme.isEmpty())
306 ri->setAttributeTheme(theme);
307 for (
auto itPix = pixmaps.cbegin(), end = pixmaps.cend(); itPix != end; ++itPix) {
308 const QIcon::Mode mode = itPix.key().first;
309 const QIcon::State state = itPix.key().second;
310 DomResourcePixmap *rp =
new DomResourcePixmap;
311 const PropertySheetPixmapValue &pix = itPix.value();
312 const PropertySheetPixmapValue::PixmapSource ps = pix.pixmapSource(m_core);
313 const QString pixPath = pix.path();
314 rp->setText(ps == PropertySheetPixmapValue::FilePixmap && m_saveRelative ? workingDirectory.relativeFilePath(pixPath) : pixPath);
315 if (state == QIcon::Off) {
318 ri->setElementNormalOff(rp);
320 ri->setText(rp->text());
322 if (ps == PropertySheetPixmapValue::ResourcePixmap) {
325 const QString qrcFile = m_core->resourceModel()->qrcPath(ri->text());
326 if (!qrcFile.isEmpty()) {
327 m_usedQrcFiles.insert(qrcFile,
false);
329 ri->setAttributeResource(workingDirectory.relativeFilePath(qrcFile));
334 case QIcon::Disabled: ri->setElementDisabledOff(rp);
break;
335 case QIcon::Active: ri->setElementActiveOff(rp);
break;
336 case QIcon::Selected: ri->setElementSelectedOff(rp);
break;
340 case QIcon::Normal: ri->setElementNormalOn(rp);
break;
341 case QIcon::Disabled: ri->setElementDisabledOn(rp);
break;
342 case QIcon::Active: ri->setElementActiveOn(rp);
break;
343 case QIcon::Selected: ri->setElementSelectedOn(rp);
break;
347 p->setElementIconSet(ri);
362template <
class DomElement>
365 const QString propertyComment = data.disambiguation();
366 if (!propertyComment.isEmpty())
367 e->setAttributeComment(propertyComment);
368 const QString propertyExtracomment = data.comment();
369 if (!propertyExtracomment.isEmpty())
370 e->setAttributeExtraComment(propertyExtracomment);
371 const QString &id = data.id();
373 e->setAttributeId(id);
374 if (!data.translatable())
375 e->setAttributeNotr(u"true"_s);
378template <
class DomElement>
381 if (e->hasAttributeComment())
382 data->setDisambiguation(e->attributeComment());
383 if (e->hasAttributeExtraComment())
384 data->setComment(e->attributeExtraComment());
385 if (e->hasAttributeId())
386 data->setId(e->attributeId());
387 if (e->hasAttributeNotr()) {
388 const QString notr = e->attributeNotr();
389 const bool translatable = !(notr ==
"true"_L1 || notr ==
"yes"_L1);
390 data->setTranslatable(translatable);
408 if (
const DomString *domString = text->elementString()) {
410 translationParametersFromDom(domString, &stringValue);
411 return QVariant::fromValue(stringValue);
413 return QVariant(QString());
418 if (value.canConvert<PropertySheetStringValue>())
419 return QVariant::fromValue(qvariant_cast<PropertySheetStringValue>(value).value());
425 DomString *domString =
new DomString();
426 domString->setText(value);
427 DomProperty *property =
new DomProperty();
428 property->setElementString(domString);
433 const PropertySheetTranslatableData &translatableData)
435 DomString *domString =
new DomString();
436 domString->setText(value);
437 translationParametersToDom(translatableData, domString);
438 DomProperty *property =
new DomProperty();
439 property->setElementString(domString);
447 return stringToDomProperty(str.value(), str);
449 if (value.canConvert<QString>())
450 return stringToDomProperty(value.toString());
456 m_formWindow(formWindow),
462 QDesignerFormEditorInterface *core = m_formWindow
->core();
463 if (
const QDesignerLanguageExtension *le = qt_extension<QDesignerLanguageExtension*>(core->extensionManager(), core))
464 d->m_language = le->name();
466 setWorkingDirectory(formWindow->absoluteDir());
467 setResourceBuilder(m_resourceBuilder);
471 const QString designerWidget = u"QDesignerWidget"_s;
472 const QString layoutWidget = u"QLayoutWidget"_s;
473 const QString widget = u"QWidget"_s;
474 m_internal_to_qt.insert(layoutWidget, widget);
475 m_internal_to_qt.insert(designerWidget, widget);
476 m_internal_to_qt.insert(u"QDesignerDialog"_s, u"QDialog"_s);
477 m_internal_to_qt.insert(u"QDesignerMenuBar"_s, u"QMenuBar"_s);
478 m_internal_to_qt.insert(u"QDesignerMenu"_s, u"QMenu"_s);
479 m_internal_to_qt.insert(u"QDesignerDockWidget"_s, u"QDockWidget"_s);
482 for (
auto it = m_internal_to_qt.cbegin(), cend = m_internal_to_qt.cend(); it != cend; ++it ) {
483 if (it.value() != designerWidget && it.value() != layoutWidget)
484 m_qt_to_internal.insert(it.value(), it.key());
493 return d->readUi(dev);
498 return QApplication::translate(
"Designer",
"Qt Widgets Designer");
506 d->m_saveVersion = m_formWindow->core()->integration()->qtVersion();
507 d->m_fullyQualifiedEnums = supportsQualifiedEnums(d->m_saveVersion);
508 QAbstractFormBuilder::save(dev, widget);
513 QAbstractFormBuilder::saveDom(ui, widget);
516 Q_ASSERT(sheet !=
nullptr);
518 const QVariant classVar = sheet->property(sheet->indexOf(u"objectName"_s));
520 if (classVar.canConvert<QString>())
521 classStr = classVar.toString();
524 ui->setElementClass(classStr);
526 for (
int index = 0; index < m_formWindow
->toolCount(); ++index) {
527 QDesignerFormWindowToolInterface *tool = m_formWindow->tool(index);
528 Q_ASSERT(tool !=
nullptr);
529 tool->saveToDom(ui, widget);
532 const QString author = m_formWindow->author();
533 if (!author.isEmpty()) {
534 ui->setElementAuthor(author);
537 const QString comment = m_formWindow->comment();
538 if (!comment.isEmpty()) {
539 ui->setElementComment(comment);
542 const QString exportMacro = m_formWindow->exportMacro();
543 if (!exportMacro.isEmpty()) {
544 ui->setElementExportMacro(exportMacro);
547 if (m_formWindow->useIdBasedTranslations())
548 ui->setAttributeIdbasedtr(
true);
550 if (core()->integration()->qtVersion() >= QVersionNumber(6, 10, 0)) {
551 const QString label = m_formWindow->idBasedTranslationLabel();
552 if (!label.isEmpty())
553 ui->setAttributeLabel(label);
556 if (!m_formWindow->connectSlotsByName())
557 ui->setAttributeConnectslotsbyname(
false);
559 const QVariantMap designerFormData = m_formWindow->formData();
560 if (!designerFormData.isEmpty()) {
561 DomPropertyList domPropertyList;
562 for (
auto it = designerFormData.cbegin(), cend = designerFormData.cend(); it != cend; ++it) {
563 if (DomProperty *prop = variantToDomProperty(
this, widget->metaObject(), it.key(), it.value()))
564 domPropertyList += prop;
566 if (!domPropertyList.isEmpty()) {
567 DomDesignerData* domDesignerFormData =
new DomDesignerData;
568 domDesignerFormData->setElementProperty(domPropertyList);
569 ui->setElementDesignerdata(domDesignerFormData);
573 if (!m_formWindow->includeHints().isEmpty()) {
574 const QString local = u"local"_s;
575 const QString global = u"global"_s;
576 QList<DomInclude *> ui_includes;
577 const QStringList &includeHints = m_formWindow->includeHints();
578 ui_includes.reserve(includeHints.size());
579 for (QString includeHint : includeHints) {
580 if (includeHint.isEmpty())
582 DomInclude *incl =
new DomInclude;
583 const QString location = includeHint.at(0) == u'<' ? global : local;
584 includeHint.remove(u'"');
585 includeHint.remove(u'<');
586 includeHint.remove(u'>');
587 incl->setAttributeLocation(location);
588 incl->setText(includeHint);
589 ui_includes.append(incl);
592 DomIncludes *includes =
new DomIncludes;
593 includes->setElementInclude(ui_includes);
594 ui->setElementIncludes(includes);
597 int defaultMargin = INT_MIN, defaultSpacing = INT_MIN;
600 if (defaultMargin != INT_MIN || defaultSpacing != INT_MIN) {
601 DomLayoutDefault *def =
new DomLayoutDefault;
602 if (defaultMargin != INT_MIN)
603 def->setAttributeMargin(defaultMargin);
604 if (defaultSpacing != INT_MIN)
605 def->setAttributeSpacing(defaultSpacing);
606 ui->setElementLayoutDefault(def);
609 QString marginFunction, spacingFunction;
610 m_formWindow->layoutFunction(&marginFunction, &spacingFunction);
611 if (!marginFunction.isEmpty() || !spacingFunction.isEmpty()) {
612 DomLayoutFunction *def =
new DomLayoutFunction;
614 if (!marginFunction.isEmpty())
615 def->setAttributeMargin(marginFunction);
616 if (!spacingFunction.isEmpty())
617 def->setAttributeSpacing(spacingFunction);
618 ui->setElementLayoutFunction(def);
621 QString pixFunction = m_formWindow->pixmapFunction();
622 if (!pixFunction.isEmpty()) {
623 ui->setElementPixmapFunction(pixFunction);
626 if (QDesignerExtraInfoExtension *extra = qt_extension<QDesignerExtraInfoExtension*>(core()->extensionManager(), core()))
627 extra->saveUiExtraInfo(ui);
629 if (MetaDataBase *metaDataBase = qobject_cast<MetaDataBase *>(core()->metaDataBase())) {
630 const MetaDataBaseItem *item = metaDataBase->metaDataBaseItem(m_formWindow->mainContainer());
631 const QStringList fakeSlots = item->fakeSlots();
632 const QStringList fakeSignals =item->fakeSignals();
633 if (!fakeSlots.isEmpty() || !fakeSignals.isEmpty()) {
634 DomSlots *domSlots =
new DomSlots();
635 domSlots->setElementSlot(fakeSlots);
636 domSlots->setElementSignal(fakeSignals);
637 ui->setElementSlots(domSlots);
644 std::unique_ptr<DomUI> ui(
readUi(dev
));
645 return ui ?
loadUi(ui.get()
, parentWidget
) :
nullptr;
650 QWidget *widget = create(ui, parentWidget);
653 widget->setProperty(
"_q_classname", widget->objectName());
654 else if (d->m_errorString.isEmpty())
655 d->m_errorString = QFormBuilderExtra::msgInvalidUiFile();
673 if (QDesignerExtraInfoExtension *extra = qt_extension<QDesignerExtraInfoExtension*>(core()->extensionManager(), core())) {
674 if (!extra->loadUiExtraInfo(ui)) {
675 const QString errorMessage = QApplication::translate(
"Designer",
"This file cannot be read because the extra info extension failed to load.");
676 core()->dialogGui()->message(parentWidget->window(), QDesignerDialogGuiInterface::FormLoadFailureMessage,
677 QMessageBox::Warning, messageBoxTitle(), errorMessage, QMessageBox::Ok);
682 qdesigner_internal::WidgetFactory *factory = qobject_cast<qdesigner_internal::WidgetFactory*>(core()->widgetFactory());
683 Q_ASSERT(factory !=
nullptr);
685 QDesignerFormWindowInterface *previousFormWindow = factory->currentFormWindow(m_formWindow);
687 m_isMainWidget =
true;
689 QWidget *mainWidget = QAbstractFormBuilder::create(ui, parentWidget);
692 m_formWindow->setUseIdBasedTranslations(ui->attributeIdbasedtr());
693 m_formWindow->setIdBasedTranslationLabel(ui->attributeLabel());
695 const bool connectSlotsByName = !ui->hasAttributeConnectslotsbyname() || ui->attributeConnectslotsbyname();
696 m_formWindow->setConnectSlotsByName(connectSlotsByName);
699 if (mainWidget && m_formWindow) {
700 m_formWindow->setAuthor(ui->elementAuthor());
701 m_formWindow->setComment(ui->elementComment());
702 m_formWindow->setExportMacro(ui->elementExportMacro());
705 QVariantMap designerFormData;
706 if (ui->hasElementDesignerdata()) {
707 const DomPropertyList domPropertyList = ui->elementDesignerdata()->elementProperty();
708 for (
auto *prop : domPropertyList) {
709 const QVariant vprop = domPropertyToVariant(
this, mainWidget->metaObject(), prop);
710 if (vprop.metaType().id() != QMetaType::UnknownType)
711 designerFormData.insert(prop->attributeName(), vprop);
714 m_formWindow->setFormData(designerFormData);
716 m_formWindow->setPixmapFunction(ui->elementPixmapFunction());
718 if (DomLayoutDefault *def = ui->elementLayoutDefault()) {
722 if (DomLayoutFunction *fun = ui->elementLayoutFunction()) {
723 m_formWindow->setLayoutFunction(fun->attributeMargin(), fun->attributeSpacing());
726 if (DomIncludes *includes = ui->elementIncludes()) {
727 const auto global =
"global"_L1;
728 QStringList includeHints;
729 const auto &elementInclude = includes->elementInclude();
730 for (DomInclude *incl : elementInclude) {
731 QString text = incl->text();
736 if (incl->hasAttributeLocation() && incl->attributeLocation() == global ) {
744 includeHints.append(text);
747 m_formWindow->setIncludeHints(includeHints);
752 auto *mdb = core()->metaDataBase();
753 for (
auto *child : mainWidget->children()) {
754 if (QButtonGroup *bg = qobject_cast<QButtonGroup*>(child))
758 for (
int index = 0; index < m_formWindow
->toolCount(); ++index) {
759 QDesignerFormWindowToolInterface *tool = m_formWindow->tool(index);
760 Q_ASSERT(tool !=
nullptr);
761 tool->loadFromDom(ui, mainWidget);
765 factory->currentFormWindow(previousFormWindow);
767 if (
const DomSlots *domSlots = ui->elementSlots()) {
768 if (MetaDataBase *metaDataBase = qobject_cast<MetaDataBase *>(core()->metaDataBase())) {
769 QStringList fakeSlots;
770 QStringList fakeSignals;
771 if (addFakeMethods(domSlots, fakeSlots, fakeSignals)) {
772 MetaDataBaseItem *item = metaDataBase->metaDataBaseItem(mainWidget);
773 item->setFakeSlots(fakeSlots);
774 item->setFakeSignals(fakeSignals);
780 bool hasExplicitGeometry =
false;
781 const auto &properties = ui->elementWidget()->elementProperty();
782 if (!properties.isEmpty()) {
783 for (
const DomProperty *p : properties) {
784 if (p->attributeName() ==
"geometry"_L1) {
785 hasExplicitGeometry =
true;
790 if (hasExplicitGeometry) {
793 const QSize size = mainWidget->size();
794 const QSize minSize = size.expandedTo(qSmartMinSize(mainWidget));
796 mainWidget->resize(minSize);
800 mainWidget->adjustSize();
807 const QDesignerWidgetDataBaseInterface *wdb = core()->widgetDataBase();
808 const int wdbIndex = wdb->indexOfObject(mainWidget);
809 if (wdbIndex != -1) {
810 QDesignerWidgetDataBaseItemInterface *item = wdb->item(wdbIndex);
812 if (item->isPromoted() && !item->isContainer()) {
813 item->setContainer(
true);
814 qWarning(
"** WARNING The form's main container is an unknown custom widget '%s'."
815 " Defaulting to a promoted instance of '%s', assuming container.",
816 item->name().toUtf8().constData(), item->extends().toUtf8().constData());
825 const QString className = ui_widget->attributeClass();
826 if (!m_isMainWidget && className ==
"QWidget"_L1
827 && !ui_widget->elementLayout().isEmpty()
828 && !ui_widget->hasAttributeNative()) {
833 if (container ==
nullptr) {
835 ui_widget->setAttributeClass(u"QLayoutWidget"_s);
840 const auto &actionRefs = ui_widget->elementAddAction();
841 ui_widget->setElementAddAction(QList<DomActionRef *>());
843 QWidget *w = QAbstractFormBuilder::create(ui_widget, parentWidget);
846 ui_widget->setElementAddAction(actionRefs);
852 QDesignerMenu *menu = qobject_cast<QDesignerMenu*>(w);
853 QDesignerMenuBar *menuBar = qobject_cast<QDesignerMenuBar*>(w);
858 for (DomActionRef *ui_action_ref : actionRefs) {
859 const QString name = ui_action_ref->attributeName();
860 if (name ==
"separator"_L1) {
861 QAction *sep =
new QAction(w);
862 sep->setSeparator(
true);
865 }
else if (QAction *a = d->m_actions.value(name)) {
867 }
else if (QActionGroup *g = d->m_actionGroups.value(name)) {
868 w->addActions(g->actions());
869 }
else if (QMenu *menu = w->findChild<QMenu*>(name)) {
870 w->addAction(menu->menuAction());
871 addMenuAction(menu->menuAction());
876 menu->adjustSpecialActions();
878 menuBar->adjustSpecialActions();
880 ui_widget->setAttributeClass(className);
881 applyExtensionDataFromDOM(
this, core(), ui_widget, w);
888 QLayout *l = QAbstractFormBuilder::create(ui_layout, layout, parentWidget);
890 if (QGridLayout *gridLayout = qobject_cast<QGridLayout*>(l)) {
891 QLayoutSupport::createEmptyCells(gridLayout);
893 if (QFormLayout *formLayout = qobject_cast<QFormLayout*>(l))
894 QLayoutSupport::createEmptyCells(formLayout);
904 if (ui_layoutItem->kind() == DomLayoutItem::Spacer) {
905 const DomSpacer *domSpacer = ui_layoutItem->elementSpacer();
906 Spacer *spacer =
static_cast<Spacer*>(core()->widgetFactory()->createWidget(u"Spacer"_s, parentWidget));
907 if (domSpacer->hasAttributeName())
908 changeObjectName(spacer, domSpacer->attributeName());
909 core()->metaDataBase()->add(spacer);
911 spacer->setInteractiveMode(
false);
912 applyProperties(spacer, ui_layoutItem->elementSpacer()->elementProperty());
913 spacer->setInteractiveMode(
true);
918 sheet->setChanged(sheet->indexOf(u"orientation"_s),
true);
921 return new QWidgetItem(spacer);
923 if (ui_layoutItem->kind() == DomLayoutItem::Layout && parentWidget) {
924 DomLayout *ui_layout = ui_layoutItem->elementLayout();
925 QLayoutWidget *layoutWidget =
new QLayoutWidget(m_formWindow, parentWidget);
926 core()->metaDataBase()->add(layoutWidget);
929 (
void) create(ui_layout,
nullptr, layoutWidget);
930 return new QWidgetItem(layoutWidget);
932 return QAbstractFormBuilder::create(ui_layoutItem, layout, parentWidget);
937 m_formWindow->unify(o, objName,
true);
938 o->setObjectName(objName);
943
950 case DomProperty::Set: {
951 const QVariant sheetValue = sheet->property(index);
952 if (sheetValue.canConvert<PropertySheetFlagValue>()) {
955 v = f.metaFlags.parseFlags(p->elementSet(), &ok);
957 designerWarning(f.metaFlags.messageParseFailed(p->elementSet()));
962 case DomProperty::Enum: {
963 const QVariant sheetValue = sheet->property(index);
964 if (sheetValue.canConvert<PropertySheetEnumValue>()) {
967 v = e.metaEnum.parseEnum(p->elementEnum(), &ok);
969 designerWarning(e.metaEnum.messageParseFailed(p->elementEnum()));
983 const QString &propertyName = p->attributeName();
985 case DomProperty::Set:
986 if (propertyName == u"features" && o->inherits(
"QDockWidget")
987 && p->elementSet() == u"QDockWidget::AllDockWidgetFeatures") {
991 case DomProperty::Enum:
992 if (propertyName == u"sizeAdjustPolicy" && o->inherits(
"QComboBox")
993 && p->elementEnum() == u"QComboBox::AdjustToMinimumContentsLength") {
1005 if (properties.isEmpty())
1013 if (dynamicSheet !=
nullptr && !dynamicSheet->dynamicPropertiesAllowed())
1014 dynamicSheet =
nullptr;
1016 for (DomProperty *p : properties) {
1017 if (isDeprecatedQt5Property(o, p))
1019 const QString &propertyName = p->attributeName();
1020 if (propertyName ==
"numDigits"_L1 && o->inherits(
"QLCDNumber")) {
1021 applyProperty(o, p, u"digitCount"_s, sheet, dynamicSheet);
1022#if QT_VERSION < QT_VERSION_CHECK(7
, 0
, 0
)
1023 }
else if (propertyName ==
"horizontalSizeConstraint"_L1 && o->inherits(
"QLayout")) {
1024 applyProperty(o, p, u"sizeConstraint"_s, sheet, dynamicSheet);
1026 }
else if (propertyName ==
"sizeConstraint"_L1 && o->inherits(
"QLayout")) {
1027 applyProperty(o, p, u"horizontalSizeConstraint"_s, sheet, dynamicSheet);
1028 applyProperty(o, p, u"verticalSizeConstraint"_s, sheet, dynamicSheet);
1031 applyProperty(o, p, propertyName, sheet, dynamicSheet);
1036void QDesignerResource::applyProperty(QObject *o, DomProperty* p,
const QString &propertyName,
1040 const int index = sheet->indexOf(propertyName);
1042 if (!readDomEnumerationValue(p, sheet, index, v))
1043 v = toVariant(o->metaObject(), p);
1044 switch (p->kind()) {
1045 case DomProperty::String:
1047 const DomString *key = p->elementString();
1049 translationParametersFromDom(key, &keyVal);
1050 v = QVariant::fromValue(keyVal);
1052 const DomString *str = p->elementString();
1054 translationParametersFromDom(str, &strVal);
1055 v = QVariant::fromValue(strVal);
1058 case DomProperty::StringList: {
1059 const DomStringList *list = p->elementStringList();
1061 translationParametersFromDom(list, &listValue);
1062 v = QVariant::fromValue(listValue);
1068 d->applyPropertyInternally(o, propertyName, v);
1070 sheet->setProperty(index, v);
1071 sheet->setChanged(index,
true);
1072 }
else if (dynamicSheet !=
nullptr) {
1073 QVariant defaultValue = QVariant(v.metaType());
1074 bool isDefault = (v == defaultValue);
1075 if (v.canConvert<PropertySheetIconValue>()) {
1076 defaultValue = QVariant(QMetaType(QMetaType::QIcon));
1078 }
else if (v.canConvert<PropertySheetPixmapValue>()) {
1079 defaultValue = QVariant(QMetaType(QMetaType::QPixmap));
1081 }
else if (v.canConvert<PropertySheetStringValue>()) {
1082 defaultValue = QVariant(QMetaType(QMetaType::QString));
1084 }
else if (v.canConvert<PropertySheetStringListValue>()) {
1085 defaultValue = QVariant(QMetaType(QMetaType::QStringList));
1087 }
else if (v.canConvert<PropertySheetKeySequenceValue>()) {
1088 defaultValue = QVariant(QMetaType(QMetaType::QKeySequence));
1091 if (defaultValue.metaType().id() != QMetaType::User) {
1092 const int idx = dynamicSheet->addDynamicProperty(p->attributeName(), defaultValue);
1094 sheet->setProperty(idx, v);
1095 sheet->setChanged(idx, !isDefault);
1100 if (propertyName ==
"objectName"_L1)
1101 changeObjectName(o, o->objectName());
1106 QString name = _name;
1108 m_isMainWidget =
false;
1110 QWidget *w = core()->widgetFactory()->createWidget(widgetName, parentWidget);
1114 if (name.isEmpty()) {
1115 QDesignerWidgetDataBaseInterface *db = core()->widgetDataBase();
1116 if (QDesignerWidgetDataBaseItemInterface *item = db->item(db->indexOfObject(w)))
1117 name = qtify(item->name());
1120 changeObjectName(w, name);
1123 if (!qobject_cast<QMenu*>(w) && (!parentWidget || !container)) {
1126 QWidgetList list = qvariant_cast<QWidgetList>(parentWidget->property(
"_q_widgetOrder"));
1128 parentWidget->setProperty(
"_q_widgetOrder", QVariant::fromValue(list));
1129 QWidgetList zOrder = qvariant_cast<QWidgetList>(parentWidget->property(
"_q_zOrder"));
1131 parentWidget->setProperty(
"_q_zOrder", QVariant::fromValue(zOrder));
1134 core()->metaDataBase()->add(w);
1137 w->setWindowFlags(w->windowFlags() & ~Qt::Window);
1139 w->setWindowModality(Qt::NonModal);
1144QLayout *
QDesignerResource::createLayout(
const QString &layoutName, QObject *parent,
const QString &name)
1146 QWidget *layoutBase =
nullptr;
1147 QLayout *layout = qobject_cast<QLayout*>(parent);
1149 if (parent->isWidgetType())
1150 layoutBase =
static_cast<QWidget*>(parent);
1152 Q_ASSERT( layout !=
nullptr );
1153 layoutBase = layout->parentWidget();
1156 LayoutInfo::Type layoutType = LayoutInfo::layoutType(layoutName);
1157 if (layoutType == LayoutInfo::NoLayout) {
1158 designerWarning(QCoreApplication::translate(
"QDesignerResource",
"The layout type '%1' is not supported, defaulting to grid.").arg(layoutName));
1159 layoutType = LayoutInfo::Grid;
1161 QLayout *lay = core()->widgetFactory()->createLayout(layoutBase, layout, layoutType);
1163 changeObjectName(lay, name);
1171 QDesignerMetaDataBaseItemInterface *item = core()->metaDataBase()->item(widget);
1175 if (qobject_cast<Spacer*>(widget) && !m_copyWidget)
1178 const QDesignerWidgetDataBaseInterface *wdb = core()->widgetDataBase();
1179 QDesignerWidgetDataBaseItemInterface *widgetInfo =
nullptr;
1180 const int widgetInfoIndex = wdb->indexOfObject(widget,
false);
1181 if (widgetInfoIndex != -1) {
1182 widgetInfo = wdb->item(widgetInfoIndex);
1184 QDesignerWidgetDataBaseItemInterface *customInfo = widgetInfo;
1185 while (customInfo && customInfo->isCustom()) {
1186 m_usedCustomWidgets.insert(customInfo,
true);
1187 const QString extends = customInfo->extends();
1188 if (extends == customInfo->name())
1190 const int extendsIndex = wdb->indexOfClassName(customInfo->extends());
1191 customInfo = extendsIndex != -1 ? wdb->item(extendsIndex) :
nullptr;
1195 DomWidget *w =
nullptr;
1197 if (QTabWidget *tabWidget = qobject_cast<QTabWidget*>(widget))
1199 else if (QStackedWidget *stackedWidget = qobject_cast<QStackedWidget*>(widget))
1201 else if (QToolBox *toolBox = qobject_cast<QToolBox*>(widget))
1203 else if (QToolBar *toolBar = qobject_cast<QToolBar*>(widget))
1205 else if (QDesignerDockWidget *dockWidget = qobject_cast<QDesignerDockWidget*>(widget))
1209 else if (QWizardPage *wizardPage = qobject_cast<QWizardPage*>(widget))
1212 w = QAbstractFormBuilder::createDom(widget, ui_parentWidget, recursive);
1214 Q_ASSERT( w !=
nullptr );
1216 if (!qobject_cast<QLayoutWidget*>(widget) && w->attributeClass() ==
"QWidget"_L1)
1217 w->setAttributeNative(
true);
1219 const QString className = w->attributeClass();
1220 if (m_internal_to_qt.contains(className))
1221 w->setAttributeClass(m_internal_to_qt.value(className));
1223 if (isPromoted( core(), widget)) {
1224 Q_ASSERT(widgetInfo !=
nullptr);
1226 w->setAttributeClass(widgetInfo->name());
1228 const auto &prop_list = w->elementProperty();
1229 for (DomProperty *prop : prop_list) {
1230 if (prop->attributeName() ==
"geometry"_L1) {
1231 if (DomRect *rect = prop->elementRect()) {
1232 rect->setElementX(widget->x());
1233 rect->setElementY(widget->y());
1238 }
else if (widgetInfo !=
nullptr && m_usedCustomWidgets.contains(widgetInfo)) {
1239 if (widgetInfo->name() != w->attributeClass())
1240 w->setAttributeClass(widgetInfo->name());
1242 addExtensionDataToDOM(
this, core(), w, widget);
1248 QDesignerMetaDataBaseItemInterface *item = core()->metaDataBase()->item(layout);
1250 if (item ==
nullptr) {
1251 layout = layout->findChild<QLayout*>();
1253 item = core()->metaDataBase()->item(layout);
1256 if (item ==
nullptr) {
1261 if (qobject_cast<QSplitter*>(layout->parentWidget()) != 0) {
1266 m_chain.push(layout);
1268 DomLayout *l = QAbstractFormBuilder::createDom(layout, ui_parentLayout, ui_parentWidget);
1269 Q_ASSERT(l !=
nullptr);
1279 DomLayoutItem *ui_item =
nullptr;
1281 if (Spacer *s = qobject_cast<Spacer*>(item->widget())) {
1282 if (!core()->metaDataBase()->item(s))
1285 DomSpacer *spacer =
new DomSpacer();
1286 const QString objectName = s->objectName();
1287 if (!objectName.isEmpty())
1288 spacer->setAttributeName(objectName);
1290 spacer->setElementProperty(computeProperties(item->widget()));
1292 ui_item =
new DomLayoutItem();
1293 ui_item->setElementSpacer(spacer);
1294 d->m_laidout.insert(item->widget(),
true);
1295 }
else if (QLayoutWidget *layoutWidget = qobject_cast<QLayoutWidget*>(item->widget())) {
1297 Q_ASSERT(layoutWidget->layout());
1298 DomLayout *l = createDom(layoutWidget->layout(), ui_layout, ui_parentWidget);
1299 ui_item =
new DomLayoutItem();
1300 ui_item->setElementLayout(l);
1301 d->m_laidout.insert(item->widget(),
true);
1302 }
else if (!item->spacerItem()) {
1303 ui_item = QAbstractFormBuilder::createDom(item, ui_layout, ui_parentWidget);
1312 QSimpleResource::handleDomCustomWidgets(core(), dom_custom_widgets);
1317 QDesignerMetaDataBaseItemInterface *item = core()->metaDataBase()->item(m_formWindow);
1320 QStringList tabStops;
1321 const QWidgetList &tabOrder = item->tabOrder();
1322 for (QWidget *widget : tabOrder) {
1323 if (m_formWindow->mainContainer()->isAncestorOf(widget))
1324 tabStops.append(widget->objectName());
1327 if (!tabStops.isEmpty()) {
1328 DomTabStops *dom =
new DomTabStops;
1329 dom->setElementTabStop(tabStops);
1338 if (tabStops ==
nullptr || widget ==
nullptr)
1341 QWidgetList tabOrder;
1342 const QStringList &elementTabStop = tabStops->elementTabStop();
1343 for (
const QString &widgetName : elementTabStop) {
1344 if (QWidget *w = widget->findChild<QWidget*>(widgetName)) {
1349 QDesignerMetaDataBaseItemInterface *item = core()->metaDataBase()->item(m_formWindow);
1351 item->setTabOrder(tabOrder);
1355
1356
1360 return QCoreApplication::translate(
"QDesignerResource",
1361"The container extension of the widget '%1' (%2) returned a widget not managed by Designer '%3' (%4) when queried for page #%5.\n"
1362"Container pages should only be added by specifying them in XML returned by the domXml() method of the custom widget.").
1363 arg(container->objectName(), WidgetFactory::classNameOf(core, container),
1364 page->objectName(), WidgetFactory::classNameOf(core, page)).
1370 DomWidget *ui_widget = QAbstractFormBuilder::createDom(widget, ui_parentWidget,
false);
1371 QList<DomWidget *> ui_widget_list;
1373 for (
int i=0; i<container->count(); ++i) {
1374 QWidget *page = container->widget(i);
1377 if (DomWidget *ui_page = createDom(page, ui_widget)) {
1378 ui_widget_list.append(ui_page);
1380 designerWarning(msgUnmanagedPage(core(), widget, i, page));
1384 ui_widget->setElementWidget(ui_widget_list);
1391 DomWidget *ui_widget = QAbstractFormBuilder::createDom(widget, ui_parentWidget,
false);
1392 QList<DomWidget *> ui_widget_list;
1394 for (
int i=0; i<container->count(); ++i) {
1395 QWidget *page = container->widget(i);
1397 if (DomWidget *ui_page = createDom(page, ui_widget)) {
1398 ui_widget_list.append(ui_page);
1400 designerWarning(msgUnmanagedPage(core(), widget, i, page));
1405 ui_widget->setElementWidget(ui_widget_list);
1412 DomWidget *ui_widget = QAbstractFormBuilder::createDom(toolBar, ui_parentWidget,
false);
1413 if (
const QMainWindow *mainWindow = qobject_cast<QMainWindow*>(toolBar->parentWidget())) {
1414 const bool toolBarBreak = mainWindow->toolBarBreak(toolBar);
1415 const Qt::ToolBarArea area = mainWindow->toolBarArea(toolBar);
1417 auto attributes = ui_widget->elementAttribute();
1419 DomProperty *attr =
new DomProperty();
1420 attr->setAttributeName(u"toolBarArea"_s);
1421 attr->setElementEnum(QLatin1StringView(toolBarAreaMetaEnum().valueToKey(area)));
1424 attr =
new DomProperty();
1425 attr->setAttributeName(u"toolBarBreak"_s);
1426 attr->setElementBool(toolBarBreak ? u"true"_s : u"false"_s);
1428 ui_widget->setElementAttribute(attributes);
1436 DomWidget *ui_widget = QAbstractFormBuilder::createDom(dockWidget, ui_parentWidget,
true);
1437 if (QMainWindow *mainWindow = qobject_cast<QMainWindow*>(dockWidget->parentWidget())) {
1438 const Qt::DockWidgetArea area = mainWindow->dockWidgetArea(dockWidget);
1439 DomProperty *attr =
new DomProperty();
1440 attr->setAttributeName(u"dockWidgetArea"_s);
1441 attr->setElementNumber(
int(area));
1442 ui_widget->setElementAttribute(ui_widget->elementAttribute() << attr);
1450 DomWidget *ui_widget = QAbstractFormBuilder::createDom(widget, ui_parentWidget,
false);
1451 QList<DomWidget *> ui_widget_list;
1454 const int current = widget->currentIndex();
1455 for (
int i=0; i<container->count(); ++i) {
1456 QWidget *page = container->widget(i);
1459 DomWidget *ui_page = createDom(page, ui_widget);
1461 designerWarning(msgUnmanagedPage(core(), widget, i, page));
1464 QList<DomProperty*> ui_attribute_list;
1467 widget->setCurrentIndex(i);
1469 PropertySheetIconValue icon = qvariant_cast<PropertySheetIconValue>(sheet->property(sheet->indexOf(u"currentTabIcon"_s)));
1470 DomProperty *p = resourceBuilder()->saveResource(workingDirectory(), QVariant::fromValue(icon));
1472 p->setAttributeName(QFormBuilderStrings::iconAttribute);
1473 ui_attribute_list.append(p);
1476 p = textBuilder()->saveText(sheet->property(sheet->indexOf(u"currentTabText"_s)));
1478 p->setAttributeName(QFormBuilderStrings::titleAttribute);
1479 ui_attribute_list.append(p);
1483 QVariant v = sheet->property(sheet->indexOf(u"currentTabToolTip"_s));
1485 p = textBuilder()->saveText(v);
1487 p->setAttributeName(QFormBuilderStrings::toolTipAttribute);
1488 ui_attribute_list.append(p);
1493 v = sheet->property(sheet->indexOf(u"currentTabWhatsThis"_s));
1495 p = textBuilder()->saveText(v);
1497 p->setAttributeName(QFormBuilderStrings::whatsThisAttribute);
1498 ui_attribute_list.append(p);
1502 ui_page->setElementAttribute(ui_attribute_list);
1504 ui_widget_list.append(ui_page);
1506 widget->setCurrentIndex(current);
1509 ui_widget->setElementWidget(ui_widget_list);
1516 DomWidget *ui_widget = QAbstractFormBuilder::createDom(widget, ui_parentWidget,
false);
1517 QList<DomWidget *> ui_widget_list;
1520 const int current = widget->currentIndex();
1521 for (
int i=0; i<container->count(); ++i) {
1522 QWidget *page = container->widget(i);
1525 DomWidget *ui_page = createDom(page, ui_widget);
1527 designerWarning(msgUnmanagedPage(core(), widget, i, page));
1532 QList<DomProperty*> ui_attribute_list;
1535 widget->setCurrentIndex(i);
1537 PropertySheetIconValue icon = qvariant_cast<PropertySheetIconValue>(sheet->property(sheet->indexOf(u"currentItemIcon"_s)));
1538 DomProperty *p = resourceBuilder()->saveResource(workingDirectory(), QVariant::fromValue(icon));
1540 p->setAttributeName(QFormBuilderStrings::iconAttribute);
1541 ui_attribute_list.append(p);
1543 p = textBuilder()->saveText(sheet->property(sheet->indexOf(u"currentItemText"_s)));
1545 p->setAttributeName(QFormBuilderStrings::labelAttribute);
1546 ui_attribute_list.append(p);
1550 QVariant v = sheet->property(sheet->indexOf(u"currentItemToolTip"_s));
1552 p = textBuilder()->saveText(v);
1554 p->setAttributeName(QFormBuilderStrings::toolTipAttribute);
1555 ui_attribute_list.append(p);
1559 ui_page->setElementAttribute(ui_attribute_list);
1561 ui_widget_list.append(ui_page);
1563 widget->setCurrentIndex(current);
1566 ui_widget->setElementWidget(ui_widget_list);
1573 DomWidget *ui_widget = QAbstractFormBuilder::createDom(wizardPage, ui_parentWidget,
true);
1576 const QString pageIdPropertyName = QLatin1StringView(QWizardPagePropertySheet::pageIdProperty);
1577 const int pageIdIndex = sheet->indexOf(pageIdPropertyName);
1578 if (pageIdIndex != -1 && sheet->isChanged(pageIdIndex)) {
1579 DomProperty *property = variantToDomProperty(
this, wizardPage->metaObject(), pageIdPropertyName, sheet->property(pageIdIndex));
1581 property->elementString()->setAttributeNotr(u"true"_s);
1582 DomPropertyList attributes = ui_widget->elementAttribute();
1583 attributes.push_back(property);
1584 ui_widget->setElementAttribute(attributes);
1592 if (qobject_cast<
const QToolBox *>(w))
1593 return QToolBoxWidgetPropertySheet::checkProperty(propertyName);
1594 if (qobject_cast<
const QTabWidget *>(w))
1595 return QTabWidgetPropertySheet::checkProperty(propertyName);
1596 if (qobject_cast<
const QStackedWidget *>(w))
1597 return QStackedWidgetPropertySheet::checkProperty(propertyName);
1598 if (qobject_cast<
const QMdiArea *>(w))
1605 const QDesignerMetaObjectInterface *meta = core()->introspection()->metaObject(obj);
1607 const int pindex = meta->indexOfProperty(prop);
1608 if (pindex != -1 && !meta->property(pindex)->attributes().testFlag(QDesignerMetaPropertyInterface::StoredAttribute))
1611 if (prop ==
"objectName"_L1 || prop ==
"spacerName"_L1)
1614 if (!supportsSeparateSizeConstraints(d->m_saveVersion)
1615 && prop ==
"verticalSizeConstraint"_L1) {
1619 QWidget *check_widget =
nullptr;
1620 if (obj->isWidgetType())
1621 check_widget =
static_cast<QWidget*>(obj);
1623 if (check_widget && prop ==
"geometry"_L1) {
1626 if (m_selected && m_selected == check_widget)
1629 return !LayoutInfo::isWidgetLaidout(core(), check_widget);
1637 const int pindex = sheet->indexOf(prop);
1638 if (sheet->isAttribute(pindex))
1642 return sheet->isChanged(pindex);
1643 if (!sheet->isVisible(pindex))
1653 if (item->widget() ==
nullptr) {
1657 QGridLayout *grid = qobject_cast<QGridLayout*>(layout);
1658 QBoxLayout *box = qobject_cast<QBoxLayout*>(layout);
1660 if (grid !=
nullptr) {
1661 const int rowSpan = ui_item->hasAttributeRowSpan() ? ui_item->attributeRowSpan() : 1;
1662 const int colSpan = ui_item->hasAttributeColSpan() ? ui_item->attributeColSpan() : 1;
1663 grid->addWidget(item->widget(), ui_item->attributeRow(), ui_item->attributeColumn(), rowSpan, colSpan, item->alignment());
1666 if (box !=
nullptr) {
1671 return QAbstractFormBuilder::addItem(ui_item, item, layout);
1676 core()->metaDataBase()->add(widget);
1678 if (! QAbstractFormBuilder::addItem(ui_widget, widget, parentWidget) || qobject_cast<QMainWindow*> (parentWidget)) {
1680 container->addWidget(widget);
1683 if (QTabWidget *tabWidget = qobject_cast<QTabWidget*>(parentWidget)) {
1684 const int tabIndex = tabWidget->count() - 1;
1685 const int current = tabWidget->currentIndex();
1687 tabWidget->setCurrentIndex(tabIndex);
1689 const auto &attributes = ui_widget->elementAttribute();
1691 if (
auto *picon = QFBE::propertyByName(attributes, QFormBuilderStrings::iconAttribute)) {
1692 QVariant v = resourceBuilder()->loadResource(workingDirectory(), picon);
1693 sheet->setProperty(sheet->indexOf(u"currentTabIcon"_s), v);
1695 if (
auto *ptext = QFBE::propertyByName(attributes, QFormBuilderStrings::titleAttribute)) {
1696 QVariant v = textBuilder()->loadText(ptext);
1697 sheet->setProperty(sheet->indexOf(u"currentTabText"_s), v);
1699 if (
auto *ptext = QFBE::propertyByName(attributes, QFormBuilderStrings::toolTipAttribute)) {
1700 QVariant v = textBuilder()->loadText(ptext);
1701 sheet->setProperty(sheet->indexOf(u"currentTabToolTip"_s), v);
1703 if (
auto *ptext = QFBE::propertyByName(attributes, QFormBuilderStrings::whatsThisAttribute)) {
1704 QVariant v = textBuilder()->loadText(ptext);
1705 sheet->setProperty(sheet->indexOf(u"currentTabWhatsThis"_s), v);
1707 tabWidget->setCurrentIndex(current);
1708 }
else if (QToolBox *toolBox = qobject_cast<QToolBox*>(parentWidget)) {
1709 const int itemIndex = toolBox->count() - 1;
1710 const int current = toolBox->currentIndex();
1712 toolBox->setCurrentIndex(itemIndex);
1714 const auto &attributes = ui_widget->elementAttribute();
1716 if (
auto *picon = QFBE::propertyByName(attributes, QFormBuilderStrings::iconAttribute)) {
1717 QVariant v = resourceBuilder()->loadResource(workingDirectory(), picon);
1718 sheet->setProperty(sheet->indexOf(u"currentItemIcon"_s), v);
1720 if (
auto *ptext = QFBE::propertyByName(attributes, QFormBuilderStrings::labelAttribute)) {
1721 QVariant v = textBuilder()->loadText(ptext);
1722 sheet->setProperty(sheet->indexOf(u"currentItemText"_s), v);
1724 if (
auto *ptext = QFBE::propertyByName(attributes, QFormBuilderStrings::toolTipAttribute)) {
1725 QVariant v = textBuilder()->loadText(ptext);
1726 sheet->setProperty(sheet->indexOf(u"currentItemToolTip"_s), v);
1728 toolBox->setCurrentIndex(current);
1736 m_copyWidget =
true;
1738 DomUI *ui = copy(selection);
1740 d->m_laidout.clear();
1741 m_copyWidget =
false;
1746 QXmlStreamWriter writer(dev);
1747 writer.setAutoFormatting(
true);
1748 writer.setAutoFormattingIndent(1);
1749 writer.writeStartDocument();
1751 writer.writeEndDocument();
1758 if (selection.empty())
1761 m_copyWidget =
true;
1763 DomWidget *ui_widget =
new DomWidget();
1764 ui_widget->setAttributeName(clipboardObjectName);
1765 bool hasItems =
false;
1767 if (!selection.m_widgets.isEmpty()) {
1768 QList<DomWidget *> ui_widget_list;
1769 for (
auto *w : selection.m_widgets) {
1771 DomWidget *ui_child = createDom(w, ui_widget);
1772 m_selected =
nullptr;
1774 ui_widget_list.append(ui_child);
1776 if (!ui_widget_list.isEmpty()) {
1777 ui_widget->setElementWidget(ui_widget_list);
1782 if (!selection.m_actions.isEmpty()) {
1783 QList<DomAction *> domActions;
1784 for (QAction* action : std::as_const(selection.m_actions)) {
1785 if (DomAction *domAction = createDom(action))
1786 domActions += domAction;
1788 if (!domActions.isEmpty()) {
1789 ui_widget-> setElementAction(domActions);
1794 d->m_laidout.clear();
1795 m_copyWidget =
false;
1802 DomUI *ui =
new DomUI();
1803 ui->setAttributeVersion(currentUiVersion);
1804 ui->setElementWidget(ui_widget);
1805 ui->setElementResources(
saveResources(m_resourceBuilder->usedQrcFiles()
));
1807 ui->setElementCustomWidgets(cws);
1814 const int saved = m_isMainWidget;
1815 m_isMainWidget =
false;
1820 const DomWidget *topLevel = ui->elementWidget();
1822 const auto &domWidgets = topLevel->elementWidget();
1823 if (!domWidgets.isEmpty()) {
1824 const QPoint offset = m_formWindow->grid();
1825 for (DomWidget* domWidget : domWidgets) {
1826 if (QWidget *w = create(domWidget, widgetParent)) {
1827 w->move(w->pos() + offset);
1829 rc.m_widgets.append(w);
1833 const auto domActions = topLevel->elementAction();
1834 for (DomAction *domAction : domActions) {
1835 if (QAction *a = create(domAction, actionParent))
1836 rc.m_actions .append(a);
1839 m_isMainWidget = saved;
1841 if (QDesignerExtraInfoExtension *extra = qt_extension<QDesignerExtraInfoExtension*>(core()->extensionManager(), core()))
1842 extra->loadUiExtraInfo(ui);
1852 QXmlStreamReader reader(dev);
1853 bool uiInitialized =
false;
1855 while (!reader.atEnd()) {
1856 if (reader.readNext() == QXmlStreamReader::StartElement) {
1857 if (reader.name().compare(
"ui"_L1, Qt::CaseInsensitive)) {
1859 uiInitialized =
true;
1862 reader.raiseError(QCoreApplication::translate(
"QDesignerResource",
"Unexpected element <%1>").arg(reader.name().toString()));
1866 if (reader.hasError()) {
1868 designerWarning(QCoreApplication::translate(
"QDesignerResource",
"Error while pasting clipboard contents at line %1, column %2: %3")
1869 .arg(reader.lineNumber()).arg(reader.columnNumber())
1870 .arg(reader.errorString()));
1871 uiInitialized =
false;
1872 }
else if (!uiInitialized) {
1874 designerWarning(QCoreApplication::translate(
"QDesignerResource",
"Error while pasting clipboard contents: The root element <ui> is missing."));
1878 return FormBuilderClipboard();
1887 QAbstractFormBuilder::layoutInfo(layout, parent, margin, spacing);
1892 if (m_usedCustomWidgets.isEmpty())
1897 QDesignerFormEditorInterface *core = m_formWindow
->core();
1898 QDesignerWidgetDataBaseInterface *db = core->widgetDataBase();
1899 const bool isInternalWidgetDataBase = qobject_cast<
const WidgetDataBase *>(db);
1900 QMap<
int, DomCustomWidget *> orderedMap;
1902 for (
auto it = m_usedCustomWidgets.cbegin(), end = m_usedCustomWidgets.cend(); it != end; ++it) {
1903 QDesignerWidgetDataBaseItemInterface *item = it.key();
1904 const QString name = item->name();
1905 DomCustomWidget *custom_widget =
new DomCustomWidget;
1907 custom_widget->setElementClass(name);
1908 if (item->isContainer())
1909 custom_widget->setElementContainer(item->isContainer());
1911 if (!item->includeFile().isEmpty()) {
1912 DomHeader *header =
new DomHeader;
1913 const IncludeSpecification spec = includeSpecification(item->includeFile());
1914 header->setText(spec.first);
1916 header->setAttributeLocation(u"global"_s);
1918 custom_widget->setElementHeader(header);
1919 custom_widget->setElementExtends(item->extends());
1922 if (isInternalWidgetDataBase) {
1923 WidgetDataBaseItem *internalItem =
static_cast<WidgetDataBaseItem *>(item);
1924 const QStringList fakeSlots = internalItem->fakeSlots();
1925 const QStringList fakeSignals = internalItem->fakeSignals();
1926 if (!fakeSlots.isEmpty() || !fakeSignals.isEmpty()) {
1927 DomSlots *domSlots =
new DomSlots();
1928 domSlots->setElementSlot(fakeSlots);
1929 domSlots->setElementSignal(fakeSignals);
1930 custom_widget->setElementSlots(domSlots);
1932 const QString addPageMethod = internalItem->addPageMethod();
1933 if (!addPageMethod.isEmpty())
1934 custom_widget->setElementAddPageMethod(addPageMethod);
1937 orderedMap.insert(db->indexOfClassName(name), custom_widget);
1940 DomCustomWidgets *customWidgets =
new DomCustomWidgets;
1941 customWidgets->setElementCustomWidget(orderedMap.values().toVector());
1942 return customWidgets;
1948 if (qobject_cast<QGridLayout *>(object)) {
1949 const int h = sheet->property(sheet->indexOf(u"horizontalSpacing"_s)).toInt();
1950 const int v = sheet->property(sheet->indexOf(u"verticalSpacing"_s)).toInt();
1960 QList<DomProperty*> properties;
1963 const int count = sheet->count();
1964 QList<DomProperty *> spacingProperties;
1965 const bool compressSpacings = canCompressSpacings(object);
1966 for (
int index = 0; index < count; ++index) {
1970 const QString propertyName = sheet->propertyName(index);
1972 if (propertyName ==
"windowModality"_L1 && !sheet->isVisible(index))
1975 const QVariant value = sheet->property(index);
1976 if (DomProperty *p = createProperty(object, propertyName, value)) {
1977 if (compressSpacings && (propertyName ==
"horizontalSpacing"_L1
1978 || propertyName ==
"verticalSpacing"_L1)) {
1979 spacingProperties.append(p);
1981 properties.append(p);
1985 if (compressSpacings) {
1986 if (spacingProperties.size() == 2) {
1987 DomProperty *spacingProperty = spacingProperties.at(0);
1988 spacingProperty->setAttributeName(u"spacing"_s);
1989 properties.append(spacingProperty);
1990 delete spacingProperties.at(1);
1992 properties += spacingProperties;
1999DomProperty *
QDesignerResource::applyProperStdSetAttribute(QObject *object,
const QString &propertyName, DomProperty *property)
2004 QExtensionManager *mgr = core()->extensionManager();
2007 const QDesignerPropertySheet *designerSheet = qobject_cast<QDesignerPropertySheet*>(core()->extensionManager()->extension(object, Q_TYPEID(QDesignerPropertySheetExtension)));
2008 const int index = sheet->indexOf(propertyName);
2009 if ((dynamicSheet && dynamicSheet
->isDynamicProperty(index
)) || (designerSheet && designerSheet->isDefaultDynamicProperty(index)))
2010 property->setAttributeStdset(0);
2016static inline bool hasSetter(QDesignerFormEditorInterface *core, QObject *object,
const QString &propertyName)
2018 const QDesignerMetaObjectInterface *meta = core->introspection()->metaObject(object);
2019 const int pindex = meta->indexOfProperty(propertyName);
2022 return meta->property(pindex)->hasSetter();
2025DomProperty *
QDesignerResource::createProperty(QObject *object,
const QString &propertyName,
const QVariant &value)
2027 if (!checkProperty(object, propertyName)) {
2033 const auto mode = d->m_fullyQualifiedEnums
2034 ? DesignerMetaFlags::FullyQualified : DesignerMetaFlags::Qualified;
2035 const QString flagString = f.metaFlags.toString(f.value, mode);
2036 if (flagString.isEmpty())
2039 DomProperty *p =
new DomProperty;
2041 if (!hasSetter(core(), object, propertyName))
2042 p->setAttributeStdset(0);
2043 p->setAttributeName(propertyName);
2044 p->setElementSet(flagString);
2045 return applyProperStdSetAttribute(object, propertyName, p);
2049 const auto mode = d->m_fullyQualifiedEnums
2050 ? DesignerMetaEnum::FullyQualified : DesignerMetaEnum::Qualified;
2052 const QString id = e.metaEnum.toString(e.value, mode, &ok);
2054 designerWarning(e.metaEnum.messageToStringFailed(e.value));
2058 DomProperty *p =
new DomProperty;
2060 if (!hasSetter(core(), object, propertyName))
2061 p->setAttributeStdset(0);
2063 if (!supportsSeparateSizeConstraints(d->m_saveVersion)
2064 && propertyName ==
"horizontalSizeConstraint"_L1
2065 && object->inherits(
"QLayout")) {
2066 p->setAttributeName(
"sizeConstraint"_L1);
2068 p->setAttributeName(propertyName);
2070 p->setElementEnum(id);
2071 return applyProperStdSetAttribute(object, propertyName, p);
2075 DomProperty *p = stringToDomProperty(strVal.value(), strVal);
2076 if (!hasSetter(core(), object, propertyName))
2077 p->setAttributeStdset(0);
2079 p->setAttributeName(propertyName);
2081 return applyProperStdSetAttribute(object, propertyName, p);
2085 DomProperty *p =
new DomProperty;
2086 if (!hasSetter(core(), object, propertyName))
2087 p->setAttributeStdset(0);
2089 p->setAttributeName(propertyName);
2091 DomStringList *domStringList =
new DomStringList();
2092 domStringList->setElementString(listValue.value());
2093 translationParametersToDom(listValue, domStringList);
2094 p->setElementStringList(domStringList);
2095 return applyProperStdSetAttribute(object, propertyName, p);
2099 DomProperty *p = stringToDomProperty(keyVal.value().toString(), keyVal);
2100 if (!hasSetter(core(), object, propertyName))
2101 p->setAttributeStdset(0);
2103 p->setAttributeName(propertyName);
2105 return applyProperStdSetAttribute(object, propertyName, p);
2108 return applyProperStdSetAttribute(object, propertyName, QAbstractFormBuilder::createProperty(object, propertyName, value));
2111QStringList
QDesignerResource::mergeWithLoadedPaths(
const QStringList &paths)
const
2113 QStringList newPaths = paths;
2115 const QStringList loadedPaths = m_resourceBuilder->loadedQrcFiles();
2116 std::remove_copy_if(loadedPaths.cbegin(), loadedPaths.cend(),
2117 std::back_inserter(newPaths),
2118 [&newPaths] (
const QString &path) {
return newPaths.contains(path); });
2127 if (resources !=
nullptr) {
2128 const auto &dom_include = resources->elementInclude();
2129 for (DomResource *res : dom_include) {
2130 QString path = QDir::cleanPath(m_formWindow->absoluteDir().absoluteFilePath(res->attributeLocation()));
2131 while (!QFile::exists(path)) {
2132 QWidget *dialogParent = m_formWindow->core()->topLevel();
2133 const QString promptTitle = QCoreApplication::translate(
"qdesigner_internal::QDesignerResource",
"Loading qrc file");
2134 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);
2136 const QMessageBox::StandardButton answer = core()->dialogGui()->message(dialogParent, QDesignerDialogGuiInterface::ResourceLoadFailureMessage,
2137 QMessageBox::Warning, promptTitle, prompt, QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes);
2138 if (answer == QMessageBox::Yes) {
2139 const QFileInfo fi(path);
2140 const QString fileDialogTitle = QCoreApplication::translate(
"qdesigner_internal::QDesignerResource",
"New location for %1").arg(fi.fileName());
2141 const QString fileDialogPattern = QCoreApplication::translate(
"qdesigner_internal::QDesignerResource",
"Resource files (*.qrc)");
2142 path = core()->dialogGui()->getOpenFileName(dialogParent, fileDialogTitle, fi.absolutePath(), fileDialogPattern);
2145 m_formWindow->setProperty(
"_q_resourcepathchanged", QVariant(
true));
2150 if (!path.isEmpty()) {
2152 m_formWindow->addResourceFile(path);
2158 paths = mergeWithLoadedPaths(paths);
2161 QtResourceSet *resourceSet = m_formWindow->resourceSet();
2163 QStringList newPaths = resourceSet->activeResourceFilePaths();
2164 std::remove_copy_if(paths.cbegin(), paths.cend(),
2165 std::back_inserter(newPaths),
2166 [&newPaths] (
const QString &path) {
return newPaths.contains(path); });
2167 resourceSet->activateResourceFilePaths(newPaths);
2169 resourceSet = m_formWindow
->core()->resourceModel()->addResourceSet(paths);
2170 m_formWindow->setResourceSet(resourceSet);
2171 QObject::connect(m_formWindow->core()->resourceModel(), &QtResourceModel::resourceSetActivated,
2172 m_formWindow, &FormWindowBase::resourceSetActivated);
2179 switch (m_formWindow->resourceFileSaveMode()) {
2180 case QDesignerFormWindowInterface::SaveAllResourceFiles:
2181 paths = m_formWindow->activeResourceFilePaths();
2183 case QDesignerFormWindowInterface::SaveOnlyUsedResourceFiles:
2184 paths = m_resourceBuilder->usedQrcFiles();
2186 case QDesignerFormWindowInterface::DontSaveResourceFiles:
2194 QtResourceSet *resourceSet = m_formWindow->resourceSet();
2195 QList<DomResource *> dom_include;
2197 const QStringList activePaths = resourceSet->activeResourceFilePaths();
2198 for (
const QString &path : activePaths) {
2199 if (qrcPaths.contains(path)) {
2200 DomResource *dom_res =
new DomResource;
2201 QString conv_path = path;
2202 if (m_resourceBuilder->isSaveRelative())
2203 conv_path = m_formWindow->absoluteDir().relativeFilePath(path);
2204 conv_path.replace(QDir::separator(), u'/');
2205 dom_res->setAttributeLocation(conv_path);
2206 dom_include.append(dom_res);
2211 DomResources *dom_resources =
new DomResources;
2212 dom_resources->setElementInclude(dom_include);
2214 return dom_resources;
2227 if (core()->metaDataBase()->item(actionGroup) !=
nullptr) {
2228 return QAbstractFormBuilder::createDom(actionGroup);
2236 if (QAction *action = QAbstractFormBuilder::create(ui_action, parent)) {
2237 core()->metaDataBase()->add(action);
2246 if (QActionGroup *actionGroup = QAbstractFormBuilder::create(ui_action_group, parent)) {
2247 core()->metaDataBase()->add(actionGroup);
2270 if (QAction *action = QAbstractFormBuilder::createAction(parent, name)) {
2271 core()->metaDataBase()->add(action);
2280 if (QActionGroup *actionGroup = QAbstractFormBuilder::createActionGroup(parent, name)) {
2281 core()->metaDataBase()->add(actionGroup);
2289
2292 const DomPropertyList attributes = ui_widget->elementAttribute();
2293 if (attributes.isEmpty())
2296 for (
auto *prop : attributes) {
2297 const QString name = prop->attributeName();
2298 const int index = sheet->indexOf(name);
2300 const QString msg =
"Unable to apply attributive property '%1' to '%2'. It does not exist."_L1.arg(name, widget->objectName());
2301 designerWarning(msg);
2303 sheet->setProperty(index, domPropertyToVariant(
this, widget->metaObject(), prop));
2304 sheet->setChanged(index,
true);
2311 QAbstractFormBuilder::loadExtraInfo(ui_widget, widget, parentWidget);
2313 if (qobject_cast<
const QWizardPage*>(widget))
2314 applyAttributesToPropertySheet(ui_widget, widget);
virtual bool isDynamicProperty(int index) const =0
virtual bool isLanguageResource(const QString &path) const =0
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)
static bool supportsSeparateSizeConstraints(const QVersionNumber &qtVersion)
#define OLD_RESOURCE_FORMAT
static constexpr auto clipboardObjectName
static constexpr auto currentUiVersion