Example #1
0
void TextProp::setStyle(TextStyleType st, const TextStyle& ts)
      {
      st = TextStyleType(styles->findData(int(st))); // find a combo item with that style idx
      if (int(st) < 0)                    // if none found...
            st = TextStyleType::DEFAULT;  // ...=> first combo item
      styles->setCurrentIndex(int(st));   // set current combo item
      setTextStyle(ts);
      }
Example #2
0
void TextStyleDialog::apply()
      {
      saveStyle(current);                 // update local copy of style list

      int n = cs->style()->textStyles().size();
      for (int i = 0; i < n; ++i) {
            const TextStyle& os = cs->textStyle(TextStyleType(i));
            const TextStyle& ns = styles[i];
            if (os != ns)
                  cs->undo()->push(new ChangeTextStyle(cs, ns));
            }
      for (int i = n; i < styles.size(); ++i)
            cs->undo()->push(new AddTextStyle(cs, styles[i]));
      cs->end();
      }
Example #3
0
void TextStyleDialog::applyToScore(Score* s)
      {
      int count = textNames->count();
      int numOfStyles = s->style()->textStyles().size();
      for (int i = 0; i < count; ++i) {
            int listIdx = textNames->item(i)->data(Qt::UserRole).toInt();
            if (listIdx < numOfStyles) {         // style already exists in score text styles
                  const TextStyle& os = s->textStyle(TextStyleType(listIdx));
                  const TextStyle& ns = styles[listIdx];
                  if (os != ns)
                        cs->undo(new ChangeTextStyle(s, ns));
                  }
            else  // style does not exist in score text styles yet
                  s->undo(new AddTextStyle(s, styles[listIdx]));
            }
      s->update();
      }
Example #4
0
void TextProp::styleIndexChanged(int i)
      {
      int idx = styles->itemData(i).toInt();
      setTextStyle(_score->textStyle(TextStyleType(idx)));
      }
Example #5
0
TextStyleType TextProp::textStyleType() const
      {
      return TextStyleType(styles->itemData(styles->currentIndex()).toInt());
      }
Example #6
0
static TextStyleType intToTextStyleType(int i) { return TextStyleType(i); }
Example #7
0
TextStyleType TextProp::textStyleType() const
      {
      return TextStyleType(styles->currentIndex());
      }