void InspectorHBox::setElement(Element* e) { HBox* box = static_cast<HBox*>(e); qreal _spatium = e->score()->spatium(); hb.elementName->setText(e->name()); hb.leftGap->blockSignals(true); hb.rightGap->blockSignals(true); hb.width->blockSignals(true); hb.leftGap->setValue(box->topGap() / _spatium); hb.rightGap->setValue(box->bottomGap() / _spatium); hb.width->setValue(box->boxHeight().val()); hb.leftGap->blockSignals(false); hb.rightGap->blockSignals(false); hb.width->blockSignals(false); }
void InspectorHBox::apply() { HBox* box = static_cast<HBox*>(inspector->element()); Score* score = box->score(); qreal _spatium = score->spatium(); qreal leftGap = hb.leftGap->value() * _spatium; qreal rightGap = hb.rightGap->value() * _spatium; Spatium width(hb.width->value()); if (leftGap != box->topGap() || rightGap != box->bottomGap() || width != box->boxWidth()) { score->startCmd(); score->undo(new ChangeBoxProperties(box, box->leftMargin(), box->topMargin(), box->rightMargin(), box->bottomMargin(), box->boxHeight(), width, leftGap, rightGap )); score->setLayoutAll(true); score->endCmd(); mscore->endCmd(); } }