359 const QDesignerCustomWidgetData &data)
361 WidgetDataBaseItem *item =
new WidgetDataBaseItem(c->name(), c->group());
362 item->setContainer(c->isContainer());
363 item->setCustom(
true);
364 item->setIcon(c->icon());
365 item->setIncludeFile(c->includeFile());
366 item->setToolTip(c->toolTip());
367 item->setWhatsThis(c->whatsThis());
368 item->setPluginPath(data.pluginPath());
369 item->setAddPageMethod(data.xmlAddPageMethod());
370 item->setExtends(data.xmlExtends());
559 QDesignerWidgetBoxInterface::Widget widget;
560 const bool found = QDesignerWidgetBox::findWidget(core->widgetBox(), className, QString(), &widget);
563 std::unique_ptr<DomUI> domUI(QDesignerWidgetBox::xmlToUi(className, widget.domXml(),
false));
566 domUI->setAttributeVersion(u"4.0"_s);
567 DomWidget *domWidget = domUI->elementWidget();
571 domWidget->setAttributeName(objectName);
572 QList<DomProperty *> properties = domWidget->elementProperty();
573 for (
auto it = properties.begin(); it != properties.end(); ) {
574 DomProperty *property = *it;
575 if (property->attributeName() ==
"objectName"_L1) {
576 it = properties.erase(it);
579 if (property->attributeName() ==
"geometry"_L1) {
580 if (DomRect *geom = property->elementRect()) {
581 if (geom->elementWidth() < NewFormWidth)
582 geom->setElementWidth(NewFormWidth);
583 if (geom->elementHeight() < NewFormHeight)
584 geom->setElementHeight(NewFormHeight);
591 DomString *windowTitleString =
new DomString;
592 windowTitleString->setText(objectName);
593 DomProperty *windowTitleProperty =
new DomProperty;
594 windowTitleProperty->setAttributeName(u"windowTitle"_s);
595 windowTitleProperty->setElementString(windowTitleString);
596 properties.push_back(windowTitleProperty);
598 domWidget->setElementProperty(properties);
600 domUI->setElementClass(objectName);
604 QXmlStreamWriter writer(&rc);
605 writer.setAutoFormatting(
true);
606 writer.setAutoFormattingIndent(1);
607 writer.writeStartDocument();
608 domUI->write(writer);
609 writer.writeEndDocument();
618 QTextStream str(&rc);
619 str << R"(<ui version="4.0"><class>)" << name <<
"</class>"
620 << R"(<widget class=")" << className << R"(" name=")" << name << R"(">)"
621 << R"(<property name="geometry" ><rect><x>0</x><y>0</y><width>)"
623 << R"(<property name="windowTitle"><string>)" << name <<
"</string></property>\n";
625 if (similarClassName ==
"QMainWindow"_L1) {
626 str << R"(<widget class="QWidget" name="centralwidget"/>)";
627 }
else if (similarClassName ==
"QWizard"_L1) {
628 str << R"(<widget class="QWizardPage" name="wizardPage1"/><widget class="QWizardPage" name="wizardPage2"/>)";
629 }
else if (similarClassName ==
"QDockWidget"_L1) {
630 str << R"(<widget class="QWidget" name="dockWidgetContents"/>)";
632 str <<
"</widget></ui>\n";