예제 #1
0
void AbstractGroupItem::resizeEnd(int diff)
{
    bool info = false;
    if (m_resizeInfos.isEmpty())
        info = true;
    int maximum = diff;
    QList <QGraphicsItem *> children = childItems();
    QList <AbstractClipItem *> items;
    int itemcount = 0;
    for (int i = 0; i < children.count(); ++i) {
        AbstractClipItem *item = static_cast <AbstractClipItem *>(children.at(i));
        if (item && item->type() == AVWidget) {
            items << item;
            if (info)
                m_resizeInfos << item->info();
            item->resizeEnd((int)(m_resizeInfos.at(itemcount).endPos.frames(item->fps())) + diff);
            int itemdiff = (int)(item->endPos() - m_resizeInfos.at(itemcount).endPos).frames(item->fps());
            if (qAbs(itemdiff) < qAbs(maximum))
                maximum = itemdiff;
            ++itemcount;
        }
    }

    for (int i = 0; i < items.count(); ++i)
        items.at(i)->resizeEnd((int)(m_resizeInfos.at(i).endPos.frames(items.at(i)->fps())) + maximum);
}
예제 #2
0
GenTime AbstractGroupItem::duration()
{
    QList <QGraphicsItem *> children = childItems();
    GenTime start = GenTime(-1.0);
    GenTime end = GenTime();
    for (int i = 0; i < children.count(); ++i) {
        if (children.at(i)->type() != GroupWidget) {
            AbstractClipItem *item = static_cast <AbstractClipItem *>(children.at(i));
            if (item) {
                if (start < GenTime() || item->startPos() < start)
                    start = item->startPos();
                if (item->endPos() > end)
                    end = item->endPos();
            }
        } else {
            children << children.at(i)->childItems();
        }
    }
    return end - start;
}