LCOV - code coverage report
Current view: top level - src/notationscene/qml/MuseScore/NotationScene - abstractelementpopupmodel.h Coverage Total Hit
Test: filtered_coverage.info Lines: 0.0 % 2 0
Test Date: 2026-11-05 04:07:02

            Line data    Source code
       1              : /*
       2              :  * SPDX-License-Identifier: GPL-3.0-only
       3              :  * MuseScore-Studio-CLA-applies
       4              :  *
       5              :  * MuseScore Studio
       6              :  * Music Composition & Notation
       7              :  *
       8              :  * Copyright (C) 2022 MuseScore Limited and others
       9              :  *
      10              :  * This program is free software: you can redistribute it and/or modify
      11              :  * it under the terms of the GNU General Public License version 3 as
      12              :  * published by the Free Software Foundation.
      13              :  *
      14              :  * This program is distributed in the hope that it will be useful,
      15              :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      16              :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      17              :  * GNU General Public License for more details.
      18              :  *
      19              :  * You should have received a copy of the GNU General Public License
      20              :  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
      21              :  */
      22              : #pragma once
      23              : 
      24              : #include <QObject>
      25              : #include <qqmlintegration.h>
      26              : 
      27              : #include "async/asyncable.h"
      28              : 
      29              : #include "modularity/ioc.h"
      30              : #include "project/iprojectsession.h"
      31              : 
      32              : #include "engraving/dom/engravingitem.h"
      33              : 
      34              : namespace mu::notation {
      35              : class AbstractElementPopupModel : public QObject, public muse::Contextable, public muse::async::Asyncable
      36              : {
      37              :     Q_OBJECT
      38              :     QML_ELEMENT;
      39              :     QML_UNCREATABLE("Not creatable as it is an abstract base class")
      40              : 
      41              :     Q_PROPERTY(PopupModelType modelType READ modelType CONSTANT)
      42              :     Q_PROPERTY(QRect itemRect READ itemRect NOTIFY itemRectChanged)
      43              : 
      44              : public:
      45              :     muse::ContextInject<project::IProjectSession> projectSession = { this };
      46              : 
      47              : public:
      48              :     enum class PopupModelType {
      49              :         TYPE_UNDEFINED = -1,
      50              :         TYPE_HARP_DIAGRAM,
      51              :         TYPE_CAPO,
      52              :         TYPE_STRING_TUNINGS,
      53              :         TYPE_SOUND_FLAG,
      54              :         TYPE_STAFF_VISIBILITY,
      55              :         TYPE_DYNAMIC,
      56              :         TYPE_TEXT,
      57              :         TYPE_PARTIAL_TIE,
      58              :         TYPE_SHADOW_NOTE
      59              :     };
      60            0 :     Q_ENUM(PopupModelType)
      61              : 
      62              :     AbstractElementPopupModel(PopupModelType modelType, QObject* parent = nullptr);
      63              : 
      64              :     PopupModelType modelType() const;
      65              :     QRect itemRect() const;
      66              : 
      67              :     static bool hasElementEditPopup(const engraving::EngravingItem* element);
      68              :     static bool hasTextStylePopup(const engraving::EngravingItem* element);
      69              :     static PopupModelType modelTypeFromElement(const engraving::ElementType& elementType);
      70              : 
      71              :     Q_INVOKABLE virtual void init();
      72              : 
      73              : signals:
      74              :     void dataChanged();
      75              :     void itemRectChanged(QRect rect);
      76              : 
      77              : protected:
      78              :     virtual void updateItemRect();
      79            0 :     virtual bool ignoreTextEditingChanges() const { return true; }
      80              : 
      81              :     muse::PointF fromLogical(muse::PointF point) const;
      82              :     muse::RectF fromLogical(muse::RectF rect) const;
      83              : 
      84              :     notation::INotationUndoStackPtr undoStack() const;
      85              :     void beginCommand(const muse::TranslatableString& actionName);
      86              :     void beginMultiCommands(const muse::TranslatableString& actionName);
      87              :     void endCommand();
      88              :     void endMultiCommands();
      89              :     void updateNotation();
      90              :     notation::INotationPtr currentNotation() const;
      91              :     INotationInteractionPtr interaction() const;
      92              : 
      93              :     void changeItemProperty(engraving::Pid id, const engraving::PropertyValue& value);
      94              :     void changeItemProperty(engraving::Pid id, const engraving::PropertyValue& value, engraving::PropertyFlags flags);
      95              : 
      96              :     engraving::EngravingItem* m_item = nullptr;
      97              :     QRect m_itemRect;
      98              : 
      99              : private:
     100              :     INotationSelectionPtr selection() const;
     101              : 
     102              :     engraving::ElementType elementType() const;
     103              :     const engraving::ElementTypeSet& dependentElementTypes() const;
     104              : 
     105              :     PopupModelType m_modelType = PopupModelType::TYPE_UNDEFINED;
     106              : };
     107              : 
     108              : using PopupModelType = AbstractElementPopupModel::PopupModelType;
     109              : 
     110              : inline size_t qHash(mu::notation::PopupModelType key)
     111              : {
     112              :     return ::qHash(int(key));
     113              : }
     114              : }
        

Generated by: LCOV version 2.0-1