353 const QDesignerCustomWidgetData &data)
355 WidgetDataBaseItem *item =
new WidgetDataBaseItem(c->name(), c->group());
356 item->setContainer(c->isContainer());
357 item->setCustom(
true);
358 item->setIcon(c->icon());
359 item->setIncludeFile(c->includeFile());
360 item->setToolTip(c->toolTip());
361 item->setWhatsThis(c->whatsThis());
362 item->setPluginPath(data.pluginPath());
363 item->setAddPageMethod(data.xmlAddPageMethod());
364 item->setExtends(data.xmlExtends());
553 QDesignerWidgetBoxInterface::Widget widget;
554 const bool found = QDesignerWidgetBox::findWidget(core->widgetBox(), className, QString(), &widget);
557 std::unique_ptr<DomUI> domUI(QDesignerWidgetBox::xmlToUi(className, widget.domXml(),
false));
560 domUI->setAttributeVersion(u"4.0"_s);
561 DomWidget *domWidget = domUI->elementWidget();
565 domWidget->setAttributeName(objectName);
566 QList<DomProperty *> properties = domWidget->elementProperty();
567 for (
auto it = properties.begin(); it != properties.end(); ) {
568 DomProperty *property = *it;
569 if (property->attributeName() ==
"objectName"_L1) {
570 it = properties.erase(it);
573 if (property->attributeName() ==
"geometry"_L1) {
574 if (DomRect *geom = property->elementRect()) {
575 if (geom->elementWidth() < NewFormWidth)
576 geom->setElementWidth(NewFormWidth);
577 if (geom->elementHeight() < NewFormHeight)
578 geom->setElementHeight(NewFormHeight);
585 DomString *windowTitleString =
new DomString;
586 windowTitleString->setText(objectName);
587 DomProperty *windowTitleProperty =
new DomProperty;
588 windowTitleProperty->setAttributeName(u"windowTitle"_s);
589 windowTitleProperty->setElementString(windowTitleString);
590 properties.push_back(windowTitleProperty);
592 domWidget->setElementProperty(properties);
594 domUI->setElementClass(objectName);
598 QXmlStreamWriter writer(&rc);
599 writer.setAutoFormatting(
true);
600 writer.setAutoFormattingIndent(1);
601 writer.writeStartDocument();
602 domUI->write(writer);
603 writer.writeEndDocument();
612 QTextStream str(&rc);
613 str << R"(<ui version="4.0"><class>)" << name <<
"</class>"
614 << R"(<widget class=")" << className << R"(" name=")" << name << R"(">)"
615 << R"(<property name="geometry" ><rect><x>0</x><y>0</y><width>)"
617 << R"(<property name="windowTitle"><string>)" << name <<
"</string></property>\n";
619 if (similarClassName ==
"QMainWindow"_L1) {
620 str << R"(<widget class="QWidget" name="centralwidget"/>)";
621 }
else if (similarClassName ==
"QWizard"_L1) {
622 str << R"(<widget class="QWizardPage" name="wizardPage1"/><widget class="QWizardPage" name="wizardPage2"/>)";
623 }
else if (similarClassName ==
"QDockWidget"_L1) {
624 str << R"(<widget class="QWidget" name="dockWidgetContents"/>)";
626 str <<
"</widget></ui>\n";