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