Exemplo n.º 1
0
void AncestorMoveMonitor::registerTarget(VideoOutput *target)
{
    TRACE_CONTEXT(AncestorMoveMonitor::registerTarget, EVideoInternal);
    TRACE_ENTRY("target 0x%08x", target);

    // First un-register the target, in case this is being called as a result
    // of re-parenting.  This is not the most efficient way to update the
    // target hash, but since this is not likely to be a frequent operation,
    // simplicity is preferred over outright speed.  In any case, re-parenting
    // of the video widget leads to re-creation of native windows, which is
    // likely to take far more processing than any implementation of this
    // function.
    unRegisterTarget(target);

    QWidget *ancestor = target->parentWidget();
    while(ancestor) {
        const Hash::iterator it = m_hash.find(ancestor);
        if(m_hash.end() == it) {
            TargetList targetList;
            targetList.append(target);
            m_hash.insert(ancestor, targetList);
        } else {
            TargetList& targetList = it.value();
            Q_ASSERT(targetList.indexOf(target) == -1);
            targetList.append(target);
        }
        ancestor = ancestor->parentWidget();
    }

    dump();

    TRACE_EXIT_0();
}
Exemplo n.º 2
0
void AncestorMoveMonitor::unRegisterTarget(VideoOutput *target)
{
    TRACE_CONTEXT(AncestorMoveMonitor::unRegisterTarget, EVideoInternal);
    TRACE_ENTRY("target 0x%08x", target);

    Hash::iterator it = m_hash.begin();
    while(it != m_hash.end()) {
        TargetList& targetList = it.value();
        const int index = targetList.indexOf(target);
        if(index != -1)
            targetList.removeAt(index);
        if(targetList.count())
            ++it;
        else
            it = m_hash.erase(it);
    }

    dump();

    TRACE_EXIT_0();
}
Exemplo n.º 3
0
/* Brief: TODO description
 * Parameter: index, TODO description
 * Parameter: value, TODO description
 * Parameter: role, TODO description
 */
bool CDailyWeatherModel::setData( const QModelIndex & index, const QVariant & value, int role )
{
    int column = index.column();
    int row = index.row();
    
    Hash* hash = mStation->getWeather();

    QString yr = QString::number(mYear);
    QString doy = QString::number(row+1);
    Pair pair(yr, doy);
    
    // Find item in weather map with key
    Hash::iterator iter = hash->find(pair);
    QVector<QString>* values = iter.value();
    
    if (index.isValid() && role == Qt::EditRole)
    {
        (*values)[column-2] = value.toString();
        emit dataChanged(index, index);
        return true;
    }
    
    return false;
}