Beispiel #1
0
bool TextLine::readProperties(const QDomElement& e)
      {
      const QString& tag(e.tagName());
      const QString& text(e.text());

      if (tag == "beginHookHeight") {
            _beginHookHeight = Spatium(text.toDouble());
            _beginHook = true;
            }
      else if (tag == "beginHookType")
            _beginHookType = HookType(text.toInt());
      else if (tag == "endHookHeight" || tag == "hookHeight") { // hookHeight is obsolete
            _endHookHeight = Spatium(text.toDouble());
            _endHook = true;
            }
      else if (tag == "endHookType")
            _endHookType = HookType(text.toInt());
      else if (tag == "hookUp")           // obsolete
            _endHookHeight *= qreal(-1.0);
      else if (tag == "beginSymbol" || tag == "symbol")     // "symbol" is obsolete
            _beginSymbol = text[0].isNumber() ? SymId(text.toInt()) : Sym::name2id(text);
      else if (tag == "continueSymbol")
            _continueSymbol = text[0].isNumber() ? SymId(text.toInt()) : Sym::name2id(text);
      else if (tag == "endSymbol")
            _endSymbol = text[0].isNumber() ? SymId(text.toInt()) : Sym::name2id(text);
      else if (tag == "beginSymbolOffset")
            _beginSymbolOffset = readPoint(e);
      else if (tag == "continueSymbolOffset")
            _continueSymbolOffset = readPoint(e);
      else if (tag == "endSymbolOffset")
            _endSymbolOffset = readPoint(e);
      else if (tag == "lineWidth")
            _lineWidth = Spatium(text.toDouble());
      else if (tag == "lineStyle")
            _lineStyle = Qt::PenStyle(text.toInt());
      else if (tag == "beginTextPlace")
            _beginTextPlace = readPlacement(e);
      else if (tag == "continueTextPlace")
            _continueTextPlace = readPlacement(e);
      else if (tag == "lineColor")
            _lineColor = readColor(e);
      else if (tag == "beginText") {
            _beginText = new Text(score());
            _beginText->setParent(this);
            _beginText->read(e);
            }
      else if (tag == "continueText") {
            _continueText = new Text(score());
            _continueText->setParent(this);
            _continueText->read(e);
            }
      else if (!SLine::readProperties(e)) {
            qDebug(" ==readSLineProps: failed");
            return false;
            }
      return true;
      }
Beispiel #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;
      }