Warning, file /graphics/glaxnimate/src/gui/item_models/property_model_base.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 * SPDX-FileCopyrightText: 2019-2023 Mattia Basaglia <dev@dragon.best> 0003 * 0004 * SPDX-License-Identifier: GPL-3.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "document_model_base.hpp" 0010 0011 namespace glaxnimate::gui::item_models { 0012 0013 class PropertyModelBase : public DocumentModelBase 0014 { 0015 Q_OBJECT 0016 0017 public: 0018 enum CustomData 0019 { 0020 ReferenceProperty = Qt::UserRole, 0021 MinValue, 0022 MaxValue, 0023 Flags 0024 }; 0025 0026 struct Item 0027 { 0028 constexpr Item() noexcept = default; 0029 constexpr Item(model::Object* object, model::BaseProperty* property = nullptr) noexcept : 0030 object(object), 0031 property(property) 0032 {} 0033 0034 explicit constexpr operator bool() const noexcept 0035 { 0036 return object; 0037 } 0038 0039 model::Object* object = nullptr; 0040 model::BaseProperty* property = nullptr; 0041 }; 0042 0043 PropertyModelBase(); 0044 ~PropertyModelBase(); 0045 0046 QModelIndex index(int row, int column, const QModelIndex & parent) const override; 0047 QModelIndex parent(const QModelIndex & child) const override; 0048 0049 void set_document(model::Document* document); 0050 0051 void clear_document(); 0052 0053 int rowCount(const QModelIndex & parent) const override; 0054 0055 0056 Item item(const QModelIndex& index) const; 0057 0058 QModelIndex property_index(model::BaseProperty* anim) const; 0059 QModelIndex object_index(model::Object* obj) const; 0060 QModelIndex index_by_id(quintptr id, int column = 0) const; 0061 0062 model::VisualNode* visual_node(const QModelIndex& index) const override; 0063 model::DocumentNode* node(const QModelIndex& index) const override; 0064 QModelIndex node_index(model::DocumentNode* node) const override; 0065 model::Document* document() const override; 0066 model::AnimatableBase* animatable(const QModelIndex& index) const; 0067 0068 private Q_SLOTS: 0069 void property_changed(const model::BaseProperty* prop, const QVariant& value); 0070 void on_delete_object(); 0071 0072 protected: 0073 virtual void on_document_reset() = 0; 0074 0075 protected: 0076 class Private; 0077 PropertyModelBase(std::unique_ptr<Private>(d)); 0078 0079 std::unique_ptr<Private> d; 0080 }; 0081 0082 } // namespace glaxnimate::gui::item_models 0083