Exemplo n.º 1
0
QSharedPointer<QSGDepthStencilBuffer> QSGDepthStencilBufferManager::bufferForFormat(const QSGDepthStencilBuffer::Format &fmt)
{
    Hash::const_iterator it = m_buffers.constFind(fmt);
    if (it != m_buffers.constEnd())
        return it.value().toStrongRef();
    return QSharedPointer<QSGDepthStencilBuffer>();
}
Exemplo n.º 2
0
QSGDepthStencilBufferManager::~QSGDepthStencilBufferManager()
{
    for (Hash::const_iterator it = m_buffers.constBegin(), cend = m_buffers.constEnd(); it != cend; ++it) {
        QSGDepthStencilBuffer *buffer = it.value().data();
        buffer->free();
        buffer->m_manager = 0;
    }
}
Exemplo n.º 3
0
static Mapping hashToBiMap(const Hash &hash)
{
  Mapping biMap;
  Hash::const_iterator it = hash.constBegin();
  const Hash::const_iterator end = hash.constEnd();
  for ( ; it != end; ++it)
    biMap.insert(Mapping::value_type(it.key(), it.value()));
  return biMap;
}
Exemplo n.º 4
0
void KCTimeDict::save(QDataStream &str) const
{
    Hash::const_iterator it = m_hash.constBegin();
    const Hash::const_iterator end = m_hash.constEnd();
    for (; it != end; ++it) {
        str << it.key() << it.value();
    }
    str << QString() << quint32(0);
}
Exemplo n.º 5
0
void ActionSignalMapper::slotMapTriggered(bool status)
{
    QAction *s = qobject_cast<QAction*>(sender());
    if (!s) {
        return;
    }
    Hash::const_iterator it = m_stringHash.constFind(s);
    if (it != m_stringHash.constEnd()) {
        emit mappedTriggered(it.value(), status);
    }
}
Exemplo n.º 6
0
QStringList KCTimeDict::remainingResourceList() const
{
    QSet<QString> resources;
    Hash::const_iterator it = m_hash.constBegin();
    const Hash::const_iterator end = m_hash.constEnd();
    for (; it != end; ++it) {
        const QString key = it.key();
        const QString res = key.left(key.indexOf('|'));
        resources.insert(res);
    }
    return resources.toList();
}
Exemplo n.º 7
0
void AncestorMoveMonitor::dump()
{
#ifndef QT_NO_DEBUG
    TRACE_CONTEXT(AncestorMoveMonitor::dump, EVideoInternal);
    for(Hash::const_iterator it = m_hash.begin();
        it != m_hash.end(); ++it) {
        const QObject *ancestor = it.key();
        TRACE("ancestor 0x%08x", ancestor);
        const TargetList& targetList = it.value();
        VideoOutput* target = 0;
        foreach(target, targetList) {
            TRACE("    target 0x%08x", target);
        }
    }
Exemplo n.º 8
0
/* Brief: TODO description
 * Parameter: index, TODO description
 * Parameter: role, TODO description
 *
 * Note: This function is called
 */
QVariant CDailyWeatherModel::data( const QModelIndex & index, int role ) const
{
    int column = index.column();
    int row = index.row();

    //qDebug("from inside Data(), row:%i, col:%i, role=%i, counter=%i", row, column, role, counter);
    
    if (role == Qt::DisplayRole || role == Qt::EditRole)
    {
        if (mStation == NULL)
            return QVariant("n/a");
        
        if (column == CDailyWeatherModel::YEAR)
            return QVariant(mYear);
        else if (column == CDailyWeatherModel::DOY)
            return QVariant(row+1);
        else {
            // Note: Be sure to use pointer here! Else, the map will be returned by value. This means
            // that a copy of this huge map will be made whenever this function is called (whenever
            // the model needs to be updated or the table needs to be redraen - potentially many times.
            // This will lag the interface.
            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::const_iterator iter = hash->find(pair);
            
            // (Year, Day of Year) not found in weather data map for the current station
            if(iter == hash->end())
                return QVariant("n/a");
            
            return QVariant(iter.value()->at(column-2));
        }
    }

    else if (role == Qt::TextAlignmentRole)
        return QVariant(Qt::AlignCenter);
    else
        return QVariant();
}
Exemplo n.º 9
0
bool AncestorMoveMonitor::eventFilter(QObject *watched, QEvent *event)
{
    TRACE_CONTEXT(AncestorMoveMonitor::eventFilter, EVideoInternal);

    if(event->type() == QEvent::Move || event->type() == QEvent::ParentChange) {

        //TRACE_ENTRY("watched 0x%08x event.type %d", watched, event->type());

        const Hash::const_iterator it = m_hash.find(watched);
        if(it != m_hash.end()) {
            const TargetList& targetList = it.value();
            VideoOutput* target = 0;
            foreach(target, targetList) {
                switch (event->type()) {

                case QEvent::Move:
                    // Notify the target that its ancestor has moved
                    target->ancestorMoved();
                    break;

                case QEvent::ParentChange:
                    // Update ancestor list for the target
                    registerTarget(target);
                    break;

                default:
                    Q_ASSERT(false);
                }
            }
        }

        //TRACE_EXIT_0();
    }

    // The event is never consumed by this filter
    return false;
}