Aeon Engine c550894
AeonGames Open Source Game Engine
Loading...
Searching...
No Matches
PropertyModel.cpp
1/*
2Copyright (C) 2018,2021,2025 Rodrigo Jose Hernandez Cordoba
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16
17#include <QIcon>
18#include <QFile>
19#include <QMimeData>
20#include <QDataStream>
21#include <QByteArray>
22#include <QXmlStreamWriter>
23#include <QTextStream>
24#include <QAction>
25#include <typeinfo>
26#include <cassert>
27
29#include "aeongames/ResourceId.hpp"
30#include "aeongames/Model.hpp"
31#include "PropertyModel.h"
32
33namespace AeonGames
34{
36 QAbstractItemModel ( parent ) {}
37
39
40 QVariant PropertyModel::headerData ( int section, Qt::Orientation orientation, int role ) const
41 {
42 if ( ( orientation == Qt::Horizontal ) && ( role == Qt::DisplayRole ) )
43 {
44 switch ( section )
45 {
46 case 0:
47 return QString ( "Property" );
48 case 1:
49 return QString ( "Value" );
50 default:
51 return QVariant();
52 }
53 }
54 return QVariant();
55 }
56
57 QModelIndex PropertyModel::parent ( const QModelIndex & index ) const
58 {
59 return QModelIndex();
60 }
61
62 int PropertyModel::columnCount ( const QModelIndex & index ) const
63 {
64 return 2;
65 }
66
67 bool PropertyModel::hasChildren ( const QModelIndex & index ) const
68 {
69 return rowCount() > 0;
70 }
71
72
73 Qt::ItemFlags PropertyModel::flags ( const QModelIndex & index ) const
74 {
75 if ( index.isValid() && ( index.column() == 1 ) )
76 {
77 return QAbstractItemModel::flags ( index ) | Qt::ItemIsEditable;
78 }
79 return QAbstractItemModel::flags ( index );
80 }
81}
Provides the DLL_PROTOBUF export/import macro for protobuf wrapper classes.
QModelIndex parent(const QModelIndex &index) const override
Return the parent of the given model index.
int rowCount(const QModelIndex &index=QModelIndex()) const override=0
Return the number of rows under the given parent.
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
Return the header data for the given section, orientation, and role.
virtual ~PropertyModel()
Destructor.
int columnCount(const QModelIndex &index=QModelIndex()) const override
Return the number of columns for children of the given parent.
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override=0
Return the index of the item at the given row and column under parent.
Qt::ItemFlags flags(const QModelIndex &index) const override
Return the item flags for the given model index.
bool hasChildren(const QModelIndex &index=QModelIndex()) const override
Return whether the given parent index has any children.
PropertyModel(QObject *parent=nullptr)
Construct the property model.
<- This is here just for the literals
Definition AABB.hpp:31