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