KTextAddons

types.h
1/*
2SPDX-FileCopyrightText: 2024 Joshua Goins <josh@redstrate.com>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#pragma once
8
9#include <QQmlEngine>
10
11#include <TextEmoticonsCore/EmojiModelManager>
12#include <TextEmoticonsCore/EmojiProxyModel>
13#include <TextEmoticonsCore/UnicodeEmoticonManager>
14
15struct UnicodeEmoticonManagerForeign {
16 Q_GADGET
17 QML_ELEMENT
18 QML_SINGLETON
19 QML_NAMED_ELEMENT(UnicodeEmoticonManager)
20 QML_FOREIGN(TextEmoticonsCore::UnicodeEmoticonManager)
21
22public:
23 static TextEmoticonsCore::UnicodeEmoticonManager *create(QQmlEngine *, QJSEngine *)
24 {
25 auto inst = TextEmoticonsCore::UnicodeEmoticonManager::self();
26 QJSEngine::setObjectOwnership(inst, QJSEngine::ObjectOwnership::CppOwnership);
27 return inst;
28 }
29};
30
31struct EmojiProxyModelForeign {
32 Q_GADGET
33 QML_ELEMENT
34 QML_NAMED_ELEMENT(EmojiProxyModel)
35 QML_FOREIGN(TextEmoticonsCore::EmojiProxyModel)
36};
37
38struct EmojiModelManagerForeign {
39 Q_GADGET
40 QML_ELEMENT
41 QML_SINGLETON
42 QML_NAMED_ELEMENT(EmojiModelManager)
43 QML_FOREIGN(TextEmoticonsCore::EmojiModelManager)
44
45public:
46 static TextEmoticonsCore::EmojiModelManager *create(QQmlEngine *, QJSEngine *)
47 {
48 auto inst = TextEmoticonsCore::EmojiModelManager::self();
49 QJSEngine::setObjectOwnership(inst, QJSEngine::ObjectOwnership::CppOwnership);
50 return inst;
51 }
52};
void setObjectOwnership(QObject *object, ObjectOwnership ownership)
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 31 2025 11:53:03 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.