From ef0d21b8652b72db7920a71f15d140b9094fb6b4 Mon Sep 17 00:00:00 2001
From: SeeLook <945374+SeeLook@users.noreply.github.com>
Date: Sun, 19 Mar 2017 15:31:06 +0100
Subject: [PATCH] Expose wrapper, added debug item (disabled)

---
 src/libs/core/score/tnoteobject.cpp | 20 ++++++++++++++++++++
 src/libs/core/score/tnoteobject.h   |  4 ++++
 2 files changed, 24 insertions(+)

diff --git a/src/libs/core/score/tnoteobject.cpp b/src/libs/core/score/tnoteobject.cpp
index 41cfc4ea4..085a38ecd 100644
--- a/src/libs/core/score/tnoteobject.cpp
+++ b/src/libs/core/score/tnoteobject.cpp
@@ -60,6 +60,19 @@ const qreal rtmGapArray[5][3] = {
 };
 
 
+QString tieDebug(Trhythm::Etie t) {
+  switch (t) {
+    case Trhythm::e_tieEnd:
+      return "TE";
+    case Trhythm::e_tieStart:
+      return "TS";
+    case Trhythm::e_tieCont:
+      return "TC";
+    default:
+      return QString();
+  }
+}
+
 
 TnoteObject::TnoteObject(TstaffObject* staffObj, TnotePair* wrapper) :
   QQuickItem(staffObj->staffItem()),
@@ -98,6 +111,9 @@ TnoteObject::TnoteObject(TstaffObject* staffObj, TnotePair* wrapper) :
   m_flag->setParentItem(m_stem);
   m_flag->setX(0.1);
 
+//   m_staff->score()->component()->setData("import QtQuick 2.7; Text { font { pixelSize: 1 }}", QUrl());
+//   m_debug = qobject_cast<QQuickItem*>(m_staff->score()->component()->create());
+//   m_debug->setParentItem(this);
 
   setColor(qApp->palette().text().color());
   setHeight(staffObj->staffItem()->height());
@@ -214,6 +230,8 @@ void TnoteObject::setNote(const Tnote& n) {
   if (updateStem || oldNotePos != static_cast<int>(m_notePosY))
       updateNamePos();
 
+//   m_debug->setProperty("text", QString("%1 %2").arg(index()).arg(tieDebug(m_note->rtm.tie())));
+//   m_debug->setY(height() - (2 + index() % 2) * m_debug->height());
 //   qDebug() << debug() << "set note" << m_note->toText() << m_note->rtm.string() << "note pos" << m_notePosY << "width:" << width();
 }
 
@@ -261,6 +279,8 @@ void TnoteObject::checkTie() {
       updateTieScale();
       m_tie->setX(m_head->width());
   }
+//   m_debug->setProperty("text", QString("%1 %2").arg(index()).arg(tieDebug(m_note->rtm.tie())));
+//   m_debug->setY(height() - (2 + index() % 2) * m_debug->height());
 }
 
 
diff --git a/src/libs/core/score/tnoteobject.h b/src/libs/core/score/tnoteobject.h
index 1e989132f..0afb9bdeb 100644
--- a/src/libs/core/score/tnoteobject.h
+++ b/src/libs/core/score/tnoteobject.h
@@ -48,6 +48,7 @@ class NOOTKACORE_EXPORT TnoteObject : public QQuickItem
   friend class TstaffObject;
   friend class TmeasureObject;
   friend class TbeamObject;
+  friend class TnotePair;
 
 public:
   explicit TnoteObject(TstaffObject* staffObj = nullptr, TnotePair* wrapper = nullptr);
@@ -123,6 +124,7 @@ protected:
   QQuickItem* tie() { return m_tie; }
   QQuickItem* head() { return m_head; }
   QQuickItem* nameItem() { return m_name; }
+  TnotePair* wrapper() { return m_wrapper; }
 
       /**
        * @p TnoteObject manages tie itself whenever tie state changes, by calling exactly this method.
@@ -155,6 +157,8 @@ private:
   QQuickItem                  *m_tie = nullptr;
   QQuickItem                  *m_name = nullptr;
 
+  QQuickItem                  *m_debug;
+
 private:
   QQuickItem* createAddLine();
   void updateAlter();
-- 
GitLab