Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Loading...
Searching...
No Matches
mapdbentrysign.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2020 Twilight
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15*/
16
21
22#include <QQmlEngine>
23#include <pse-common/utility.h>
24#include "mapdbentrysign.h"
25
29
31{
32 return parent;
33}
34
35void MapDBEntrySign::qmlProtect(const QQmlEngine* const engine) const
36{
37 Utility::qmlProtectUtil(this, engine);
38}
39
41{
42 return textID;
43}
44
46{
47 return y;
48}
49
51{
52 return x;
53}
54MapDBEntrySign::MapDBEntrySign(const QJsonValue& data, MapDBEntry* const parent) :
56{
58 x = data["x"].toDouble();
59 y = data["y"].toDouble();
60 textID = data["text"].toDouble();
61}
62
64{
65 static bool once = false;
66 if(once)
67 return;
68
69 qmlRegisterUncreatableType<MapDBEntrySign>(
70 "PSE.DB.MapDBEntrySign", 1, 0, "MapDBEntrySign", "Can't instantiate in QML");
71 once = true;
72}
static void qmlProtectUtil(const QObject *const obj, const QQmlEngine *const engine)
Pin obj to C++ ownership so the QML engine never garbage-collects it.
Definition utility.cpp:63
int getTextID() const
friend class MapDBEntry
int y
Sign tile Y.
void qmlProtect(const QQmlEngine *const engine) const
Pin to C++ ownership.
int textID
Text id shown when read.
int x
Sign tile X.
MapDBEntry * parent
Owning map.
MapDBEntry * getParent() const
void qmlRegister() const
Register with QML.
int getX() const
< Sign tile X.
MapDBEntrySign()
Empty entry.