void DFlatAssignmentVisitor::visitDAnnotation(const DAnnotation *annotation)
{
    visitDElement(annotation);
    auto target = dynamic_cast<DAnnotation *>(m_target);
    target->setText(annotation->text());
    target->setPos(annotation->pos());
    target->setRect(annotation->rect());
    target->setAutoSized(annotation->isAutoSized());
    target->setVisualRole(annotation->visualRole());
}
void DFlatAssignmentVisitor::visitDObject(const DObject *object)
{
    visitDElement(object);
    auto target = dynamic_cast<DObject *>(m_target);
    QMT_CHECK(target);
    target->setStereotypes(object->stereotypes());
    target->setName(object->name());
    target->setPos(object->pos());
    target->setRect(object->rect());
    target->setAutoSized(object->isAutoSized());
    target->setDepth(object->depth());
    target->setVisualPrimaryRole(object->visualPrimaryRole());
    target->setVisualSecondaryRole(object->visualSecondaryRole());
    target->setVisualEmphasized(object->isVisualEmphasized());
    target->setStereotypeDisplay(object->stereotypeDisplay());
}
void LiveViewWindow::doAutoResize()
{
    if (!m_autoSized)
        return;

    m_liveView->updateGeometry();
    if (m_liveView->sizeHint().isEmpty())
        return;

    if (!isFullScreen())
    {
        QSize hint = sizeHint();
        const QRect rect = QApplication::desktop()->availableGeometry(this);

        hint.rwidth() = qRound(qMin(rect.width()*.9, double(hint.rwidth())));
        hint.rheight() = qRound(qMin(rect.height()*.9, double(hint.rheight())));

        resize(hint);
    }

    setAutoSized(false);
}