Skip to content

Commit e55ff70

Browse files
committed
Fixed internals of abstract popups - uses enum not int
1 parent 48beed8 commit e55ff70

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

src/notation/qml/MuseScore/NotationScene/NotationView.qml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ FocusScope {
137137
contextMenuLoader.close()
138138
}
139139

140-
onShowElementPopupRequested: function (elementType, viewPos, elemSize) {
141-
popUpLoader.show(elementType, viewPos, elemSize)
140+
onShowElementPopupRequested: function (popupType, viewPos, elemSize) {
141+
popUpLoader.show(popupType, viewPos, elemSize)
142142
}
143143

144144
onHideElementPopupRequested: {

src/notation/qml/MuseScore/NotationScene/internal/ElementPopupLoader.qml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ Item {
3535

3636
anchors.fill: parent
3737

38-
property int type: -1
3938
property var openedPopup: null
4039
property bool isPopupOpened: Boolean(openedPopup) && openedPopup.isOpened
4140

@@ -45,13 +44,9 @@ Item {
4544
QtObject {
4645
id: prv
4746

48-
function setPopupType(elementType) {
49-
type = elementType
50-
}
51-
5247
function componentByType(type) {
5348
switch (type) {
54-
case 52: return harpPedalComp
49+
case Notation.TYPE_HARP_DIAGRAM: return harpPedalComp
5550
}
5651

5752
return null
@@ -84,8 +79,7 @@ Item {
8479
return
8580
}
8681

87-
prv.setPopupType(elementType)
88-
var popup = loader.createPopup(prv.componentByType(type), viewPos, size)
82+
var popup = loader.createPopup(prv.componentByType(elementType), viewPos, size)
8983
prv.openPopup(popup)
9084
}
9185

src/notation/view/abstractnotationpaintview.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,8 +489,9 @@ void AbstractNotationPaintView::showElementPopup(const ElementType& elementType,
489489

490490
RectF elemRect = fromLogical(size);
491491
QPointF elemSize = QPointF(elemRect.width(), elemRect.height());
492+
PopupModelType modelType = AbstractElementPopupModel::modelTypeFromElement(elementType);
492493

493-
emit showElementPopupRequested(static_cast<int>(elementType), pos, elemSize);
494+
emit showElementPopupRequested(modelType, pos, elemSize);
494495

495496
if (activateFocus) {
496497
dispatcher()->dispatch("nav-first-control");

src/notation/view/abstractnotationpaintview.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include "playbackcursor.h"
4646
#include "loopmarker.h"
4747
#include "continuouspanel.h"
48+
#include "internal/abstractelementpopupmodel.h"
4849

4950
namespace mu::notation {
5051
class AbstractNotationPaintView : public uicomponents::QuickPaintedView, public IControlledView, public async::Asyncable,
@@ -140,7 +141,7 @@ class AbstractNotationPaintView : public uicomponents::QuickPaintedView, public
140141
void showContextMenuRequested(int elementType, const QPointF& viewPos);
141142
void hideContextMenuRequested();
142143

143-
void showElementPopupRequested(int elementType, const QPointF& viewPos, const QPointF& elemSize);
144+
void showElementPopupRequested(mu::notation::PopupModelType modelType, const QPointF& viewPos, const QPointF& elemSize);
144145
void hideElementPopupRequested();
145146

146147
void horizontalScrollChanged();

src/notation/view/internal/abstractelementpopupmodel.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class AbstractElementPopupModel : public QObject, public async::Asyncable
3636

3737
public slots:
3838
void setTitle(QString title);
39-
void setModelType(mu::notation::AbstractElementPopupModel::PopupModelType modelType);
39+
void setModelType(PopupModelType modelType);
4040

4141
signals:
4242
void titleChanged();
@@ -66,4 +66,8 @@ public slots:
6666
using PopupModelType = AbstractElementPopupModel::PopupModelType;
6767
} //namespace mu::notation
6868

69+
#ifndef NO_QT_SUPPORT
70+
Q_DECLARE_METATYPE(mu::notation::PopupModelType)
71+
#endif
72+
6973
#endif // MU_NOTATION_ABSTRACTELEMENTPOPUPMODEL_H

0 commit comments

Comments
 (0)