356 const QDesignerCustomWidgetData &data)
358 WidgetDataBaseItem *item =
new WidgetDataBaseItem(c->name(), c->group());
359 item->setContainer(c->isContainer());
360 item->setCustom(
true);
361 item->setIcon(c->icon());
362 item->setIncludeFile(c->includeFile());
363 item->setToolTip(c->toolTip());
364 item->setWhatsThis(c->whatsThis());
365 item->setPluginPath(data.pluginPath());
366 item->setAddPageMethod(data.xmlAddPageMethod());
367 item->setExtends(data.xmlExtends());
556 QDesignerWidgetBoxInterface::Widget widget;
557 const bool found = QDesignerWidgetBox::findWidget(core->widgetBox(), className, QString(), &widget);
560 std::unique_ptr<DomUI> domUI(QDesignerWidgetBox::xmlToUi(className, widget.domXml(),
false));
563 domUI->setAttributeVersion(u"4.0"_s);
564 DomWidget *domWidget = domUI->elementWidget();
568 domWidget->setAttributeName(objectName);
569 QList<DomProperty *> properties = domWidget->elementProperty();
570 for (
auto it = properties.begin(); it != properties.end(); ) {
571 DomProperty *property = *it;
572 if (property->attributeName() ==
"objectName"_L1) {
573 it = properties.erase(it);
576 if (property->attributeName() ==
"geometry"_L1) {
577 if (DomRect *geom = property->elementRect()) {
578 if (geom->elementWidth() < NewFormWidth)
579 geom->setElementWidth(NewFormWidth);
580 if (geom->elementHeight() < NewFormHeight)
581 geom->setElementHeight(NewFormHeight);
588 DomString *windowTitleString =
new DomString;
589 windowTitleString->setText(objectName);
590 DomProperty *windowTitleProperty =
new DomProperty;
591 windowTitleProperty->setAttributeName(u"windowTitle"_s);
592 windowTitleProperty->setElementString(windowTitleString);
593 properties.push_back(windowTitleProperty);
595 domWidget->setElementProperty(properties);
597 domUI->setElementClass(objectName);
601 QXmlStreamWriter writer(&rc);
602 writer.setAutoFormatting(
true);
603 writer.setAutoFormattingIndent(1);
604 writer.writeStartDocument();
605 domUI->write(writer);
606 writer.writeEndDocument();
615 QTextStream str(&rc);
616 str << R"(<ui version="4.0"><class>)" << name <<
"</class>"
617 << R"(<widget class=")" << className << R"(" name=")" << name << R"(">)"
618 << R"(<property name="geometry" ><rect><x>0</x><y>0</y><width>)"
620 << R"(<property name="windowTitle"><string>)" << name <<
"</string></property>\n";
622 if (similarClassName ==
"QMainWindow"_L1) {
623 str << R"(<widget class="QWidget" name="centralwidget"/>)";
624 }
else if (similarClassName ==
"QWizard"_L1) {
625 str << R"(<widget class="QWizardPage" name="wizardPage1"/><widget class="QWizardPage" name="wizardPage2"/>)";
626 }
else if (similarClassName ==
"QDockWidget"_L1) {
627 str << R"(<widget class="QWidget" name="dockWidgetContents"/>)";
629 str <<
"</widget></ui>\n";