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