Fluid
1.3.0
Material Design for QtQuick and Qml
Loading...
Searching...
No Matches
enumregistration.cpp
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: 2026 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
2
// SPDX-License-Identifier: MPL-2.0
3
4
#include <QtCore/qcoreapplication.h>
5
#include <QtCore/qstring.h>
6
#include <QtCore/qurl.h>
7
#include <QtQml/qqml.h>
8
9
namespace
Fluid
{
10
namespace
{
11
12
void
registerEnumOwners()
13
{
14
// Qualified lookups through qmldir reject the current QML file as recursive.
15
// Register enum owners in the module's type table so self-enums resolve there
16
// before Qt falls back to looking up the source file through qmldir.
17
const
struct
18
{
19
const
char
*name;
20
const
char
*directory;
21
} owners[] = {
22
{
"AppBar"
,
"components"
},
23
{
"AppBarAction"
,
"components"
},
24
{
"BaseAppBar"
,
"internal"
},
25
{
"Badge"
,
"components"
},
26
{
"FAB"
,
"components"
},
27
{
"ExposedDropdownMenu"
,
"components"
},
28
{
"FabMenu"
,
"components"
},
29
{
"FabMenuButton"
,
"components"
},
30
{
"IconButton"
,
"components"
},
31
{
"IconLabel"
,
"components"
},
32
{
"Menu"
,
"components"
},
33
{
"MenuItem"
,
"components"
},
34
{
"RangeSlider"
,
"components"
},
35
{
"SearchAppBar"
,
"components"
},
36
{
"Slider"
,
"components"
},
37
{
"Switch"
,
"components"
},
38
{
"Symbol"
,
"components"
},
39
{
"TextField"
,
"components"
},
40
};
41
42
for
(
const
auto
&owner : owners) {
43
const
auto
url = QUrl(
44
QStringLiteral(
"qrc:/qt/qml/Fluid/qml/%1/%2.qml"
)
45
.arg(QLatin1StringView(owner.directory), QLatin1StringView(owner.name)));
46
qmlRegisterType(url,
"Fluid"
, 2, 0, owner.name);
47
}
48
}
49
50
Q_COREAPP_STARTUP_FUNCTION(registerEnumOwners)
51
52
}
// namespace
53
}
// namespace Fluid
Fluid
Definition
enumregistration.cpp:9
src
controls
cpp
core
enumregistration.cpp
Generated by
1.9.8