LCOV - code coverage report
Current view: top level - src/engraving/api/v1 - selection.h Coverage Total Hit
Test: filtered_coverage.info Lines: 0.0 % 10 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) 2021 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              : 
      23              : #pragma once
      24              : 
      25              : #include "engraving/dom/select.h"
      26              : 
      27              : // api
      28              : #include "elements.h"
      29              : 
      30              : namespace mu::engraving::apiv1 {
      31              : //---------------------------------------------------------
      32              : //   Selection
      33              : //    Wrapper class for internal mu::engraving::Selection
      34              : ///  \since MuseScore 3.3
      35              : //---------------------------------------------------------
      36              : 
      37              : class Selection : public QObject
      38              : {
      39              :     Q_OBJECT
      40              :     /// Current GUI selections for the score.
      41              :     /// \since MuseScore 3.3
      42              :     Q_PROPERTY(QQmlListProperty<apiv1::EngravingItem> elements READ elements)
      43              : 
      44              :     /// Whether this selection covers a range of a score, as opposed to
      45              :     /// a list of distinct elements.
      46              :     /// \since MuseScore 3.5
      47              :     Q_PROPERTY(bool isRange READ isRange)
      48              :     /// Start segment of selection, included. This property is valid
      49              :     /// only for range selection.
      50              :     /// \since MuseScore 3.5
      51              :     /// \see \ref isRange
      52              :     Q_PROPERTY(apiv1::Segment * startSegment READ startSegment)
      53              :     /// End segment of selection, excluded. This property is valid
      54              :     /// only for range selection.
      55              :     /// \since MuseScore 3.5
      56              :     /// \see \ref isRange
      57              :     Q_PROPERTY(apiv1::Segment * endSegment READ endSegment)
      58              :     /// First staff of selection, included. This property is valid
      59              :     /// only for range selection.
      60              :     /// \since MuseScore 3.5
      61              :     /// \see \ref isRange
      62              :     Q_PROPERTY(int startStaff READ startStaff)
      63              :     /// End staff of selection, included. This property is valid
      64              :     /// only for range selection.
      65              :     /// \since MuseScore 3.5
      66              :     /// \see \ref isRange
      67              :     Q_PROPERTY(int endStaff READ endStaff)
      68              : 
      69              : protected:
      70              :     /// \cond MS_INTERNAL
      71              :     mu::engraving::Selection* m_selection;
      72              : 
      73              :     bool checkSelectionIsNotLocked() const;
      74              :     /// \endcond
      75              : public:
      76              :     /// \cond MS_INTERNAL
      77            0 :     Selection(mu::engraving::Selection* selection)
      78            0 :         : QObject(), m_selection(selection) {}
      79            0 :     virtual ~Selection() { }
      80              : 
      81            0 :     QQmlListProperty<EngravingItem> elements()
      82            0 :     { return wrapContainerProperty<EngravingItem>(this, m_selection->elements()); }
      83              : 
      84            0 :     bool isRange() const { return m_selection->isRange(); }
      85              : 
      86            0 :     Segment* startSegment() const { return wrap<Segment>(m_selection->startSegment()); }
      87            0 :     Segment* endSegment() const { return wrap<Segment>(m_selection->endSegment()); }
      88            0 :     int startStaff() const { return static_cast<int>(m_selection->staffStart()); }
      89            0 :     int endStaff() const { return static_cast<int>(m_selection->staffEnd()); }
      90              :     /// \endcond
      91              : 
      92              :     Q_INVOKABLE bool select(apiv1::EngravingItem* e, bool add = false);
      93              :     Q_INVOKABLE bool selectRange(int startTick, int endTick, int startStaff, int endStaff, apiv1::MeasureBase* startBox = nullptr,
      94              :                                  apiv1::MeasureBase* endBox = nullptr);
      95              :     Q_INVOKABLE bool deselect(apiv1::EngravingItem* e);
      96              :     Q_INVOKABLE bool clear();
      97              : };
      98              : 
      99              : extern Selection* selectionWrap(mu::engraving::Selection* selection);
     100              : }
        

Generated by: LCOV version 2.0-1