Example #1
0
TextLine::TextLine(Score* s)
   : TextLineBase(s)
      {
      initElementStyle(&textLineStyle);

      setPlacement(Placement::ABOVE);
      setBeginText("");
      setContinueText("");
      setEndText("");
      setBeginTextOffset(QPointF(0,0));
      setContinueTextOffset(QPointF(0,0));
      setEndTextOffset(QPointF(0,0));
      setLineVisible(true);

      setBeginHookType(HookType::NONE);
      setEndHookType(HookType::NONE);
      setBeginHookHeight(Spatium(1.5));
      setEndHookHeight(Spatium(1.5));

      resetProperty(Pid::BEGIN_TEXT_PLACE);
      resetProperty(Pid::CONTINUE_TEXT_PLACE);
      resetProperty(Pid::END_TEXT_PLACE);
      }
Example #2
0
bool TextLineBase::setProperty(P_ID id, const QVariant& v)
      {
      switch (id) {
            case P_ID::BEGIN_TEXT_PLACE:
                  _beginTextPlace = PlaceText(v.toInt());
                  break;
            case P_ID::BEGIN_TEXT_ALIGN:
                  _beginTextAlign = Align(v.toInt());
                  break;
            case P_ID::CONTINUE_TEXT_ALIGN:
                  _continueTextAlign = Align(v.toInt());
                  break;
            case P_ID::END_TEXT_ALIGN:
                  _endTextAlign = Align(v.toInt());
                  break;
            case P_ID::CONTINUE_TEXT_PLACE:
                  _continueTextPlace = PlaceText(v.toInt());
                  break;
            case P_ID::END_TEXT_PLACE:
                  _endTextPlace = PlaceText(v.toInt());
                  break;
            case P_ID::BEGIN_HOOK_HEIGHT:
                  _beginHookHeight = v.value<Spatium>();
                  break;
            case P_ID::END_HOOK_HEIGHT:
                  _endHookHeight = v.value<Spatium>();
                  break;
            case P_ID::BEGIN_HOOK_TYPE:
                  _beginHookType = HookType(v.toInt());
                  break;
            case P_ID::END_HOOK_TYPE:
                  _endHookType = HookType(v.toInt());
                  break;
            case P_ID::BEGIN_TEXT:
                  setBeginText(v.toString());
                  break;
            case P_ID::BEGIN_TEXT_OFFSET:
                  setBeginTextOffset(v.toPointF());
                  break;
            case P_ID::CONTINUE_TEXT_OFFSET:
                  setContinueTextOffset(v.toPointF());
                  break;
            case P_ID::END_TEXT_OFFSET:
                  setEndTextOffset(v.toPointF());
                  break;
            case P_ID::CONTINUE_TEXT:
                  setContinueText(v.toString());
                  break;
            case P_ID::END_TEXT:
                  setEndText(v.toString());
                  break;
            case P_ID::LINE_VISIBLE:
                  setLineVisible(v.toBool());
                  break;
            case P_ID::BEGIN_FONT_FACE:
                  setBeginFontFamily(v.toString());
                  break;
            case P_ID::BEGIN_FONT_SIZE:
                  if (v.toReal() <= 0)
                        qDebug("font size is %f", v.toReal());
                  setBeginFontSize(v.toReal());
                  break;
            case P_ID::BEGIN_FONT_BOLD:
                  setBeginFontBold(v.toBool());
                  break;
            case P_ID::BEGIN_FONT_ITALIC:
                  setBeginFontItalic(v.toBool());
                  break;
            case P_ID::BEGIN_FONT_UNDERLINE:
                  setBeginFontUnderline(v.toBool());
                  break;
            case P_ID::CONTINUE_FONT_FACE:
                  setContinueFontFamily(v.toString());
                  break;
            case P_ID::CONTINUE_FONT_SIZE:
                  setContinueFontSize(v.toReal());
                  break;
            case P_ID::CONTINUE_FONT_BOLD:
                  setContinueFontBold(v.toBool());
                  break;
            case P_ID::CONTINUE_FONT_ITALIC:
                  setContinueFontItalic(v.toBool());
                  break;
            case P_ID::CONTINUE_FONT_UNDERLINE:
                  setContinueFontUnderline(v.toBool());
                  break;
            case P_ID::END_FONT_FACE:
                  setEndFontFamily(v.toString());
                  break;
            case P_ID::END_FONT_SIZE:
                  setEndFontSize(v.toReal());
                  break;
            case P_ID::END_FONT_BOLD:
                  setEndFontBold(v.toBool());
                  break;
            case P_ID::END_FONT_ITALIC:
                  setEndFontItalic(v.toBool());
                  break;
            case P_ID::END_FONT_UNDERLINE:
                  setEndFontUnderline(v.toBool());
                  break;

            default:
                  return SLine::setProperty(id, v);
            }
      triggerLayout();
      return true;
      }