| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 |
| 3 | |
| 4 | #ifndef CUSTOMWIDGETSINFO_H |
| 5 | #define CUSTOMWIDGETSINFO_H |
| 6 | |
| 7 | #include "treewalker.h" |
| 8 | #include <qstringlist.h> |
| 9 | #include <qmap.h> |
| 10 | #include <QtCore/qmetaobject.h> |
| 11 | |
| 12 | QT_BEGIN_NAMESPACE |
| 13 | |
| 14 | class Driver; |
| 15 | class DomScript; |
| 16 | |
| 17 | class CustomWidgetsInfo : public TreeWalker |
| 18 | { |
| 19 | public: |
| 20 | CustomWidgetsInfo(); |
| 21 | |
| 22 | void acceptUI(DomUI *node) override; |
| 23 | |
| 24 | void acceptCustomWidgets(DomCustomWidgets *node) override; |
| 25 | void acceptCustomWidget(DomCustomWidget *node) override; |
| 26 | |
| 27 | inline DomCustomWidget *customWidget(const QString &name) const |
| 28 | { return m_customWidgets.value(key: name); } |
| 29 | |
| 30 | QString customWidgetAddPageMethod(const QString &name) const; |
| 31 | QString simpleContainerAddPageMethod(const QString &name) const; |
| 32 | |
| 33 | static QString realClassName(const QString &className); |
| 34 | |
| 35 | bool extends(const QString &className, QAnyStringView baseClassName) const; |
| 36 | bool extendsOneOf(const QString &className, const QStringList &baseClassNames) const; |
| 37 | |
| 38 | bool isCustomWidgetContainer(const QString &className) const; |
| 39 | |
| 40 | bool isAmbiguousSignal(const QString &className, |
| 41 | const QString &signalSignature) const; |
| 42 | bool isAmbiguousSlot(const QString &className, |
| 43 | const QString &slotSignature) const; |
| 44 | |
| 45 | private: |
| 46 | using NameCustomWidgetMap = QMap<QString, DomCustomWidget*>; |
| 47 | NameCustomWidgetMap m_customWidgets; |
| 48 | bool isAmbiguous(const QString &className, const QString &signature, |
| 49 | QMetaMethod::MethodType type) const; |
| 50 | }; |
| 51 | |
| 52 | QT_END_NAMESPACE |
| 53 | |
| 54 | #endif // CUSTOMWIDGETSINFO_H |
| 55 |
