예제 #1
0
const QVariant ShotgunField::buildPathValue(int index, const QVariantMap context)
{
    Q_UNUSED(context);

    if (!source()) {
        debug() << "no source for path specified, returning null";
        return QVariant(QVariant::String);
    }

    trace() << ".buildPathValue(" << index << "," << context << ")";
    Q_ASSERT(m_type == ShotgunField::Path || m_type == ShotgunField::Url);

    const QScopedPointer<const ElementsView> elementsView(new ElementsView(source()));
    const ElementView *element = elementsView->elementAt(index);

    QVariant result;
    if (element) {
        result = element->pattern();
    } else {
        error() << "Can't get detail" << index << "from" << source();
    }

    return result;
}