本文整理汇总了C++中TextStyle::offsetType方法的典型用法代码示例。如果您正苦于以下问题:C++ TextStyle::offsetType方法的具体用法?C++ TextStyle::offsetType怎么用?C++ TextStyle::offsetType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextStyle
的用法示例。
在下文中一共展示了TextStyle::offsetType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setTextStyle
void TextProp::setTextStyle(const TextStyle& s)
{
fontBold->setChecked(s.bold());
fontItalic->setChecked(s.italic());
fontUnderline->setChecked(s.underline());
fontSize->setValue(s.size());
color->setColor(s.foregroundColor());
systemFlag->setChecked(s.systemFlag());
int a = s.align();
if (a & ALIGN_HCENTER)
alignHCenter->setChecked(true);
else if (a & ALIGN_RIGHT)
alignRight->setChecked(true);
else
alignLeft->setChecked(true);
if (a & ALIGN_VCENTER)
alignVCenter->setChecked(true);
else if (a & ALIGN_BOTTOM)
alignBottom->setChecked(true);
else if (a & ALIGN_BASELINE)
alignBaseline->setChecked(true);
else
alignTop->setChecked(true);
QString str;
if (s.offsetType() == OFFSET_ABS) {
xOffset->setValue(s.offset().x() * INCH);
yOffset->setValue(s.offset().y() * INCH);
mmUnit->setChecked(true);
curUnit = 0;
}
else if (s.offsetType() == OFFSET_SPATIUM) {
xOffset->setValue(s.offset().x());
yOffset->setValue(s.offset().y());
spatiumUnit->setChecked(true);
curUnit = 1;
}
rxOffset->setValue(s.reloff().x());
ryOffset->setValue(s.reloff().y());
QFont f(s.family());
f.setPixelSize(lrint(s.size()));
f.setItalic(s.italic());
f.setUnderline(s.underline());
f.setBold(s.bold());
fontSelect->setCurrentFont(f);
sizeIsSpatiumDependent->setChecked(s.sizeIsSpatiumDependent());
frameColor->setColor(s.frameColor());
bgColor->setColor(s.backgroundColor());
frameWidth->setValue(s.frameWidth());
frame->setChecked(s.hasFrame());
paddingWidth->setValue(s.paddingWidth());
frameRound->setValue(s.frameRound());
circleButton->setChecked(s.circle());
boxButton->setChecked(!s.circle());
}
示例2: textStyle
TextStyle TextProp::textStyle() const
{
TextStyle s;
if (curUnit == 0)
s.setOffsetType(OFFSET_ABS);
else if (curUnit == 1)
s.setOffsetType(OFFSET_SPATIUM);
s.setBold(fontBold->isChecked());
s.setItalic(fontItalic->isChecked());
s.setUnderline(fontUnderline->isChecked());
s.setSize(fontSize->value());
QFont f = fontSelect->currentFont();
s.setFamily(f.family());
s.setXoff(xOffset->value() / ((s.offsetType() == OFFSET_ABS) ? INCH : 1.0));
s.setYoff(yOffset->value() / ((s.offsetType() == OFFSET_ABS) ? INCH : 1.0));
s.setRxoff(rxOffset->value());
s.setRyoff(ryOffset->value());
s.setFrameColor(frameColor->color());
s.setBackgroundColor(bgColor->color());
s.setFrameWidth(frameWidth->value());
s.setPaddingWidth(paddingWidth->value());
s.setCircle(circleButton->isChecked());
s.setFrameRound(frameRound->value());
s.setHasFrame(frame->isChecked());
s.setSystemFlag(systemFlag->isChecked());
s.setForegroundColor(color->color());
s.setSizeIsSpatiumDependent(sizeIsSpatiumDependent->isChecked());
Align a = 0;
if (alignHCenter->isChecked())
a |= ALIGN_HCENTER;
else if (alignRight->isChecked())
a |= ALIGN_RIGHT;
if (alignVCenter->isChecked())
a |= ALIGN_VCENTER;
else if (alignBottom->isChecked())
a |= ALIGN_BOTTOM;
else if (alignBaseline->isChecked())
a |= ALIGN_BASELINE;
s.setAlign(a);
return s;
}
示例3: getValues
//.........这里部分代码省略.........
lstyle.set(ST_MusicalSymbolFont, musicalSymbolFont->currentText());
lstyle.set(ST_showHeader, showHeader->isChecked());
lstyle.set(ST_headerStyled, headerStyled->isChecked());
lstyle.set(ST_headerFirstPage, showHeaderFirstPage->isChecked());
lstyle.set(ST_headerOddEven, headerOddEven->isChecked());
if (headerStyled->isChecked()) {
lstyle.set(ST_evenHeaderL, evenHeaderL->toPlainText());
lstyle.set(ST_evenHeaderC, evenHeaderC->toPlainText());
lstyle.set(ST_evenHeaderR, evenHeaderR->toPlainText());
lstyle.set(ST_oddHeaderL, oddHeaderL->toPlainText());
lstyle.set(ST_oddHeaderC, oddHeaderC->toPlainText());
lstyle.set(ST_oddHeaderR, oddHeaderR->toPlainText());
}
else {
lstyle.set(ST_evenHeaderL, evenHeaderL->toHtml());
lstyle.set(ST_evenHeaderC, evenHeaderC->toHtml());
lstyle.set(ST_evenHeaderR, evenHeaderR->toHtml());
lstyle.set(ST_oddHeaderL, oddHeaderL->toHtml());
lstyle.set(ST_oddHeaderC, oddHeaderC->toHtml());
lstyle.set(ST_oddHeaderR, oddHeaderR->toHtml());
}
lstyle.set(ST_showFooter, showFooter->isChecked());
lstyle.set(ST_footerStyled, footerStyled->isChecked());
lstyle.set(ST_footerFirstPage, showFooterFirstPage->isChecked());
lstyle.set(ST_footerOddEven, footerOddEven->isChecked());
if (footerStyled->isChecked()) {
lstyle.set(ST_evenFooterL, evenFooterL->toPlainText());
lstyle.set(ST_evenFooterC, evenFooterC->toPlainText());
lstyle.set(ST_evenFooterR, evenFooterR->toPlainText());
lstyle.set(ST_oddFooterL, oddFooterL->toPlainText());
lstyle.set(ST_oddFooterC, oddFooterC->toPlainText());
lstyle.set(ST_oddFooterR, oddFooterR->toPlainText());
}
else {
lstyle.set(ST_evenFooterL, evenFooterL->toHtml());
lstyle.set(ST_evenFooterC, evenFooterC->toHtml());
lstyle.set(ST_evenFooterR, evenFooterR->toHtml());
lstyle.set(ST_oddFooterL, oddFooterL->toHtml());
lstyle.set(ST_oddFooterC, oddFooterC->toHtml());
lstyle.set(ST_oddFooterR, oddFooterR->toHtml());
}
// figured bass
int idx = comboFBFont->currentIndex();
QString family;
if(FiguredBass::fontData(idx, &family, 0, 0, 0))
lstyle.set(ST_figuredBassFontFamily, family);
qreal size = doubleSpinFBSize->value();
qreal vPos = doubleSpinFBVertPos->value();
lstyle.set(ST_figuredBassFontSize, size);
lstyle.set(ST_figuredBassYOffset, vPos);
lstyle.set(ST_figuredBassLineHeight, ((double)spinFBLineHeight->value()) / 100.0);
lstyle.set(ST_figuredBassAlignment, radioFBTop->isChecked() ? 0 : 1);
lstyle.set(ST_figuredBassStyle, radioFBModern->isChecked() ? 0 : 1);
// copy to text style data relevant to it (LineHeight and Style are not in text style);
// offsetType is necessarily OFFSET_SPATIUM
const TextStyle fbOld = lstyle.textStyle(TEXT_STYLE_FIGURED_BASS);
if (family != fbOld.family() || size != fbOld.size()
|| vPos != fbOld.offset().y() || fbOld.offsetType() != OFFSET_SPATIUM)
{
TextStyle fbNew(fbOld);
fbNew.setFamily(family);
fbNew.setSize(size);
fbNew.setYoff(vPos);
fbNew.setOffsetType(OFFSET_SPATIUM);
lstyle.setTextStyle(fbNew);
}
for (int i = 0; i < ARTICULATIONS; ++i) {
QComboBox* cb = static_cast<QComboBox*>(articulationTable->cellWidget(i, 1));
lstyle.setArticulationAnchor(i, ArticulationAnchor(cb->itemData(cb->currentIndex()).toInt()));
}
lstyle.set(ST_voltaY, Spatium(voltaY->value()));
lstyle.set(ST_voltaHook, Spatium(voltaHook->value()));
lstyle.set(ST_voltaLineWidth, Spatium(voltaLineWidth->value()));
lstyle.set(ST_voltaLineStyle, voltaLineStyle->currentIndex() + 1);
lstyle.set(ST_ottavaY, Spatium(ottavaY->value()));
lstyle.set(ST_ottavaHook, Spatium(ottavaHook->value()));
lstyle.set(ST_ottavaLineWidth, Spatium(ottavaLineWidth->value()));
lstyle.set(ST_ottavaLineStyle, ottavaLineStyle->currentIndex() + 1);
lstyle.set(ST_ottavaNumbersOnly, ottavaNumbersOnly->isChecked());
lstyle.set(ST_pedalY, Spatium(pedalY->value()));
lstyle.set(ST_pedalLineWidth, Spatium(pedalLineWidth->value()));
lstyle.set(ST_pedalLineStyle, pedalLineStyle->currentIndex() + 1);
lstyle.set(ST_trillY, Spatium(trillY->value()));
lstyle.set(ST_harmonyY, Spatium(harmonyY->value()));
lstyle.set(ST_harmonyFretDist, Spatium(harmonyFretDist->value()));
lstyle.set(ST_minHarmonyDistance, Spatium(minHarmonyDistance->value()));
lstyle.set(ST_tabClef, clefTab1->isChecked() ? CLEF_TAB : CLEF_TAB2);
lstyle.set(ST_crossMeasureValues, crossMeasureValues->isChecked());
lstyle.set(ST_keySigNaturals, radioKeySigNatNone->isChecked() ? NAT_NONE :
(radioKeySigNatBefore->isChecked() ? NAT_BEFORE : NAT_AFTER) );
}
示例4: getValues
//.........这里部分代码省略.........
lstyle.set(StyleIdx::MusicalTextFont, tf);
lstyle.set(StyleIdx::showHeader, showHeader->isChecked());
lstyle.set(StyleIdx::headerFirstPage, showHeaderFirstPage->isChecked());
lstyle.set(StyleIdx::headerOddEven, headerOddEven->isChecked());
Text t(cs);
t.setTextStyleType(TextStyleType::HEADER);
lstyle.set(StyleIdx::evenHeaderL, t.convertFromHtml(evenHeaderL->toHtml()));
lstyle.set(StyleIdx::evenHeaderC, t.convertFromHtml(evenHeaderC->toHtml()));
lstyle.set(StyleIdx::evenHeaderR, t.convertFromHtml(evenHeaderR->toHtml()));
lstyle.set(StyleIdx::oddHeaderL, t.convertFromHtml(oddHeaderL->toHtml()));
lstyle.set(StyleIdx::oddHeaderC, t.convertFromHtml(oddHeaderC->toHtml()));
lstyle.set(StyleIdx::oddHeaderR, t.convertFromHtml(oddHeaderR->toHtml()));
lstyle.set(StyleIdx::showFooter, showFooter->isChecked());
lstyle.set(StyleIdx::footerFirstPage, showFooterFirstPage->isChecked());
lstyle.set(StyleIdx::footerOddEven, footerOddEven->isChecked());
t.setTextStyleType(TextStyleType::FOOTER);
lstyle.set(StyleIdx::evenFooterL, t.convertFromHtml(evenFooterL->toHtml()));
lstyle.set(StyleIdx::evenFooterC, t.convertFromHtml(evenFooterC->toHtml()));
lstyle.set(StyleIdx::evenFooterR, t.convertFromHtml(evenFooterR->toHtml()));
lstyle.set(StyleIdx::oddFooterL, t.convertFromHtml(oddFooterL->toHtml()));
lstyle.set(StyleIdx::oddFooterC, t.convertFromHtml(oddFooterC->toHtml()));
lstyle.set(StyleIdx::oddFooterR, t.convertFromHtml(oddFooterR->toHtml()));
// figured bass
int idx = comboFBFont->currentIndex();
QString family;
if(FiguredBass::fontData(idx, &family, 0, 0, 0))
lstyle.set(StyleIdx::figuredBassFontFamily, family);
qreal size = doubleSpinFBSize->value();
qreal vPos = doubleSpinFBVertPos->value();
lstyle.set(StyleIdx::figuredBassFontSize, size);
lstyle.set(StyleIdx::figuredBassYOffset, vPos);
lstyle.set(StyleIdx::figuredBassLineHeight, ((double)spinFBLineHeight->value()) / 100.0);
lstyle.set(StyleIdx::figuredBassAlignment, radioFBTop->isChecked() ? 0 : 1);
lstyle.set(StyleIdx::figuredBassStyle, radioFBModern->isChecked() ? 0 : 1);
// copy to text style data relevant to it (LineHeight and Style are not in text style);
// offsetType is necessarily OFFSET_SPATIUM
const TextStyle fbOld = lstyle.textStyle(TextStyleType::FIGURED_BASS);
if (family != fbOld.family() || size != fbOld.size()
|| vPos != fbOld.offset().y() || fbOld.offsetType() != OffsetType::SPATIUM)
{
TextStyle fbNew(fbOld);
fbNew.setFamily(family);
fbNew.setSize(size);
fbNew.setYoff(vPos);
fbNew.setOffsetType(OffsetType::SPATIUM);
lstyle.setTextStyle(fbNew);
}
for (int i = 0; i < int(ArticulationType::ARTICULATIONS); ++i) {
QComboBox* cb = static_cast<QComboBox*>(articulationTable->cellWidget(i, 1));
lstyle.setArticulationAnchor(i, ArticulationAnchor(cb->itemData(cb->currentIndex()).toInt()));
}
lstyle.set(StyleIdx::voltaY, Spatium(voltaY->value()));
lstyle.set(StyleIdx::voltaHook, Spatium(voltaHook->value()));
lstyle.set(StyleIdx::voltaLineWidth, Spatium(voltaLineWidth->value()));
lstyle.set(StyleIdx::voltaLineStyle, voltaLineStyle->currentIndex() + 1);
lstyle.set(StyleIdx::ottavaY, Spatium(ottavaY->value()));
lstyle.set(StyleIdx::ottavaHook, Spatium(ottavaHook->value()));
lstyle.set(StyleIdx::ottavaLineWidth, Spatium(ottavaLineWidth->value()));
lstyle.set(StyleIdx::ottavaLineStyle, ottavaLineStyle->currentIndex() + 1);
lstyle.set(StyleIdx::ottavaNumbersOnly, ottavaNumbersOnly->isChecked());
lstyle.set(StyleIdx::pedalY, Spatium(pedalY->value()));
lstyle.set(StyleIdx::pedalLineWidth, Spatium(pedalLineWidth->value()));
lstyle.set(StyleIdx::pedalLineStyle, pedalLineStyle->currentIndex() + 1);
lstyle.set(StyleIdx::trillY, Spatium(trillY->value()));
lstyle.set(StyleIdx::harmonyY, Spatium(harmonyY->value()));
lstyle.set(StyleIdx::harmonyFretDist, Spatium(harmonyFretDist->value()));
lstyle.set(StyleIdx::minHarmonyDistance, Spatium(minHarmonyDistance->value()));
lstyle.set(StyleIdx::maxHarmonyBarDistance, Spatium(maxHarmonyBarDistance->value()));
lstyle.set(StyleIdx::capoPosition, capoPosition->value());
lstyle.set(StyleIdx::fretNumMag, fretNumMag->value()*0.01);
lstyle.set(StyleIdx::fretNumPos, radioFretNumLeft->isChecked() ? 0 : 1);
lstyle.set(StyleIdx::fretY, fretY->value());
lstyle.set(StyleIdx::tabClef, int(clefTab1->isChecked() ? ClefType::TAB : ClefType::TAB2));
lstyle.set(StyleIdx::crossMeasureValues, crossMeasureValues->isChecked());
lstyle.set(StyleIdx::keySigNaturals, radioKeySigNatNone->isChecked() ? int(KeySigNatural::NONE) :
(radioKeySigNatBefore->isChecked() ? int(KeySigNatural::BEFORE) : int(KeySigNatural::AFTER)) );
lstyle.set(StyleIdx::tupletMaxSlope, tupletMaxSlope->value());
lstyle.set(StyleIdx::tupletOufOfStaff, tupletOutOfStaff->isChecked());
lstyle.set(StyleIdx::tupletVHeadDistance, Spatium(tupletVHeadDistance->value()));
lstyle.set(StyleIdx::tupletVStemDistance, Spatium(tupletVStemDistance->value()));
lstyle.set(StyleIdx::tupletStemLeftDistance, Spatium(tupletStemLeftDistance->value()));
lstyle.set(StyleIdx::tupletStemRightDistance, Spatium(tupletStemRightDistance->value()));
lstyle.set(StyleIdx::tupletNoteLeftDistance, Spatium(tupletNoteLeftDistance->value()));
lstyle.set(StyleIdx::tupletNoteRightDistance, Spatium(tupletNoteRightDistance->value()));
}