10#include <QtDesigner/abstractformeditor.h>
11#include <QtDesigner/abstractformwindow.h>
12#include <QtDesigner/abstractformwindowmanager.h>
13#include <QtDesigner/abstractobjectinspector.h>
14#include <QtDesigner/abstractwidgetbox.h>
15#include <QtDesigner/abstractwidgetdatabase.h>
17#include <QtCore/qmap.h>
18#include <QtCore/qcoreapplication.h>
23using namespace Qt::StringLiterals;
27 const QSet<QString> &nonPromotableClasses() {
28 static const QSet<QString> rc = {
41 int promotedWidgetDataBaseIndex(
const QDesignerWidgetDataBaseInterface *widgetDataBase,
42 const QString &className,
43 QString *errorMessage) {
44 const int index = widgetDataBase->indexOfClassName(className);
45 if (index == -1 || !widgetDataBase->item(index)->isPromoted()) {
46 *errorMessage = QCoreApplication::tr(
"%1 is not a promoted class.").arg(className);
53 QDesignerWidgetDataBaseItemInterface *promotedWidgetDataBaseItem(
const QDesignerWidgetDataBaseInterface *widgetDataBase,
54 const QString &className,
55 QString *errorMessage) {
57 const int index = promotedWidgetDataBaseIndex(widgetDataBase, className, errorMessage);
60 return widgetDataBase->item(index);
64 QString classNameFromXml(QString xml)
66 constexpr auto tag =
"class=\""_L1;
67 const int pos = xml.indexOf(tag);
70 xml.remove(0, pos + tag.size());
71 const auto closingPos = xml.indexOf(u'"');
74 xml.remove(closingPos, xml.size() - closingPos);
79 QStringList getScratchPadClasses(
const QDesignerWidgetBoxInterface *wb) {
81 const int catCount = wb->categoryCount();
82 for (
int c = 0; c < catCount; c++) {
83 const QDesignerWidgetBoxInterface::Category category = wb->category(c);
84 if (category.type() == QDesignerWidgetBoxInterface::Category::Scratchpad) {
85 const int widgetCount = category.widgetCount();
86 for (
int w = 0; w < widgetCount; w++) {
87 const QString className = classNameFromXml( category.widget(w).domXml());
88 if (!className.isEmpty())
99 const QDesignerFormWindowManagerInterface *fwm = core->formWindowManager();
100 for (
int f = 0, count = fwm->formWindowCount(); f < count; ++f)
101 fwm->formWindow(f)->setDirty(
true);
153 for (
int i = 0;
i <
cnt;
i++) {
189 for (
int i = 0;
i <
cnt;
i++) {
280 <<
" extends " <<
className <<
", changing its base class to " <<
extends <<
'.';
Combined button and popup list for selecting options.
Auxiliary methods to store/retrieve settings.