Esempio n. 1
0
void Slice::fillTriLayer(QHash<QString, Face*> faces){
    QHash<QString, Face*>::iterator i;
    double zMax=0;
    for(i = faces.begin(); i != faces.end(); ++i){
        if(zMax<i.value()->getMaxZ()->z())
            zMax=i.value()->getMaxZ()->z();
    }
    int layersNum=(int)ceil(zMax/layerHeight);
    qDebug() << "Max z: "<< zMax << "Number of layers: "<<layersNum;
    //create list
    for(int j=0; j<layersNum+1; j++){
        this->triLayer.append(new QList<Face*>);
        this->edgeLayer.append(new QList< QList<HalfEdge*> *>);
        this->pointLayer.append(new QList< QList<QVector3D> *>);
    }
    double tempZ;
    for(i = faces.begin(); i != faces.end(); ++i){
        tempZ=(int)((i.value()->getMinZ()->z()/layerHeight)+1)*layerHeight;
        while(tempZ<=i.value()->getMaxZ()->z()){
            this->triLayer.at((int)ceil(tempZ/layerHeight))->append(i.value());
            tempZ+=this->layerHeight;
        }
    }
    fillEdgeLayer();
    fillPointLayer();
    fillPolygonLayer();
}
Esempio n. 2
0
    void commit() {
        // update all documents

        // remove previous instances
        if ( indexPresent() ) {
            for ( QHash<Node, lucene::document::Document*>::iterator it = documentCache.begin();
                  it != documentCache.end(); ++it ) {
                lucene::document::Document* doc = it.value();
                if ( const TCHAR* id = doc->get( idFieldName().data() ) ) { // this check is only for testing, it should NEVER fail
                    lucene::index::Term* idTerm = _CLNEW lucene::index::Term( idFieldName().data(), id );
                    getIndexReader()->deleteDocuments( idTerm );
                    _CLDECDELETE( idTerm );
                }
            }
        }

        // add the updated ones
        for ( QHash<Node, lucene::document::Document*>::iterator it = documentCache.begin();
              it != documentCache.end(); ++it ) {
            lucene::document::Document* doc = it.value();
            // never add empty docs
            if ( !docEmpty( doc ) ) {
                getIndexWriter()->addDocument( doc );
            }
            _CLDELETE( doc );
        }

        documentCache.clear();
    }
static void fill(Counter &counter, const typename Counter::Container &container, bool fragmented)
{
    qint64 allocated = 0;
    QHash<void *, int> allocations;
    for (int i = 0; i < 100; ++i) {
        for (int j = 0; j < 100; ++j) {
            int amount = fragmented ? j : i;
            allocated += amount;
            counter.request(amount);
            void *alloc = malloc(amount);
            allocations.insertMulti(alloc, amount);
            counter.obtain(reinterpret_cast<quintptr>(alloc));
            QCOMPARE(counter.currentTotal(), allocated);
        }
    }

    QCOMPARE(allocated, 99 * 50 * 100);
    QCOMPARE(counter.currentTotal(), allocated);
    QCOMPARE(sum(container), allocated);

    for (auto it = allocations.begin(), end = allocations.end(); it != end; ++it) {
        free(it.key());
        counter.release(reinterpret_cast<quintptr>(it.key()));
        allocated -= it.value();
        QCOMPARE(counter.currentTotal(), allocated);
    }

    allocations.clear();

    QCOMPARE(allocated, 0);
    QCOMPARE(counter.currentTotal(), 0);
    QCOMPARE(sum(container), 0);
}
Esempio n. 4
0
void Locator::buildDocTermMat(const QHash<SymbolPath, SymbolData>& symbolWordList,
									SparseMatrix& docTermMat,
									Eigen::VectorXd& radiusVec)
{
	int nSymbols = symbolWordList.size();
	int nWords   = SymbolWordAttr::totalWords();
	QVector<float> wordCountPerDoc(nSymbols,0.f);	// total number of words for each doc
	QVector<float> docCountPerWord(nWords  ,0.f);	// total number of doc   for each word

	docTermMat = SparseMatrix(nSymbols, nWords);
	radiusVec.resize(nSymbols);
	QHash<SymbolPath, SymbolData>::ConstIterator pSymbol;
	int ithSymbol = 0;
	for (pSymbol =  symbolWordList.begin(); 
		 pSymbol != symbolWordList.end(); ++pSymbol, ++ithSymbol)
	{
		const SymbolData& item = pSymbol.value();
		wordCountPerDoc[ithSymbol] = item.getTotalWordCount();

		QMap<int,float>::ConstIterator pWord;
		for (pWord = item.m_wordWeightMap.begin(); 
			 pWord != item.m_wordWeightMap.end(); ++pWord)
		{
			int wordId = pWord.key();
			float wordCount = pWord.value();
 			docCountPerWord[wordId]    += 1;
			docTermMat.insert(ithSymbol, wordId) = wordCount;
		}
		radiusVec(ithSymbol) = item.getRadius();
	}
	docTermMat.makeCompressed();
}
Esempio n. 5
0
void TwitchApi::putRequest( const QString &urlString, QHash<QString, QString> urlParams)
{
    QUrl url ( urlString );
    QUrlQuery query(url);




    for (QHash<QString, QString>::iterator iter = urlParams.begin(); iter != urlParams.end(); ++iter) {

        query.addQueryItem(iter.key(),iter.value());
    }


    url.setQuery(query);

    QNetworkRequest req ( url );

    req.setRawHeader("Accept", "application/vnd.twitchtv.v3+json");
    req.setRawHeader("Authorization", "OAuth "+this->oAuthAccessToken.toLatin1());
    req.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded" );



    m_nam.put( req, url.toEncoded() );


}
Esempio n. 6
0
void VDirectoryTree::updateItemDirectChildren(QTreeWidgetItem *p_item)
{
    QPointer<VDirectory> parentDir;
    if (p_item) {
        parentDir = getVDirectory(p_item);
    } else {
        parentDir = m_notebook->getRootDir();
    }

    const QVector<VDirectory *> &dirs = parentDir->getSubDirs();

    QHash<VDirectory *, QTreeWidgetItem *> itemDirMap;
    int nrChild = p_item ? p_item->childCount() : topLevelItemCount();
    for (int i = 0; i < nrChild; ++i) {
        QTreeWidgetItem *item = p_item ? p_item->child(i) : topLevelItem(i);
        itemDirMap.insert(getVDirectory(item), item);
    }

    for (int i = 0; i < dirs.size(); ++i) {
        VDirectory *dir = dirs[i];
        QTreeWidgetItem *item = itemDirMap.value(dir, NULL);
        if (item) {
            if (p_item) {
                p_item->removeChild(item);
                p_item->insertChild(i, item);
            } else {
                int topIdx = indexOfTopLevelItem(item);
                takeTopLevelItem(topIdx);
                insertTopLevelItem(i, item);
            }

            itemDirMap.remove(dir);
        } else {
            // Insert a new item
            if (p_item) {
                item = new QTreeWidgetItem(p_item);
            } else {
                item = new QTreeWidgetItem(this);
            }

            fillTreeItem(item, dir);
            buildSubTree(item, 1);
        }

        expandSubTree(item);
    }

    // Delete items without corresponding VDirectory
    for (auto iter = itemDirMap.begin(); iter != itemDirMap.end(); ++iter) {
        QTreeWidgetItem *item = iter.value();
        if (p_item) {
            p_item->removeChild(item);
        } else {
            int topIdx = indexOfTopLevelItem(item);
            takeTopLevelItem(topIdx);
        }

        delete item;
    }
}
Esempio n. 7
0
void ExtendedDialog::saveConfig()
{
    assert( currentTab() == AUDIO_TAB || currentTab() == VIDEO_TAB );
    QHash<QString, QVariant> *hashConfig = &m_hashConfigs[currentTab()];

    for( QHash<QString, QVariant>::iterator i = hashConfig->begin();
         i != hashConfig->end(); ++i )
    {
        QVariant &value = i.value();
        switch( static_cast<QMetaType::Type>(value.type()) )
        {
            case QMetaType::QString:
                config_PutPsz( p_intf, qtu(i.key()), qtu(value.toString()) );
                break;
            case QMetaType::Int:
                config_PutInt( p_intf, qtu(i.key()), value.toInt() ) ;
                break;
            case QMetaType::Double:
            case QMetaType::Float:
                config_PutFloat( p_intf, qtu(i.key()), value.toFloat() ) ;
                break;
            default:
                vlc_assert_unreachable();
        }
    }
    config_SaveConfigFile( p_intf );
    hashConfig->clear();
    m_applyButton->setEnabled( false );
}
Esempio n. 8
0
SmartPointer<IElementReference> CommandService::RegisterElementForCommand(
    const SmartPointer<ParameterizedCommand>& command,
    const SmartPointer<UIElement>& element)
{
  if (!command->GetCommand()->IsDefined())
  {
    throw NotDefinedException(
        "Cannot define a callback for undefined command "
            + command->GetCommand()->GetId());
  }
  if (element.IsNull())
  {
    throw NotDefinedException("No callback defined for command "
        + command->GetCommand()->GetId());
  }

  QHash<QString, QString> paramMap = command->GetParameterMap();
  QHash<QString, Object::Pointer> parms;
  for (QHash<QString, QString>::const_iterator i = paramMap.begin();
       i != paramMap.end(); ++i)
  {
    Object::Pointer value(new ObjectString(i.value()));
    parms.insert(i.key(), value);
  }
  IElementReference::Pointer ref(new ElementReference(command->GetId(),
                                                      element, parms));
  RegisterElement(ref);
  return ref;
}
Esempio n. 9
0
    inline void serialize_vc6(Archive &ar, QHash<K,T> &t, const unsigned int)
    {
        typedef typename QHash<K,T>::iterator Iterator;
        typedef typename QHash<K,T>::key_type Key;
        typedef typename QHash<K,T>::mapped_type Value;

        if (ar.isRead())
        {
          t.clear();
          boost::uint32_t count = 0;
          ar & count;

          for (boost::uint32_t i=0; i<count; i++)
          {
            Key key;
            ar & key;
            Value value;
            ar & value;
            t.insert(key, value);
          }
        }
        else if (ar.isWrite())
        {
          boost::uint32_t count = static_cast<boost::uint32_t>(t.size());
          ar & count;
          Iterator it = t.begin();
          for (boost::uint32_t i=0; i<count; i++)
          {
            ar & it.key();
            ar & it.value();
            it++;
          }
        }
    }
Esempio n. 10
0
//------------------------------------------------------------------------------
// Name: showEvent
// Desc:
//------------------------------------------------------------------------------
void DialogPlugins::showEvent(QShowEvent *) {

	QHash<QString, QObject *> plugins = edb::v1::plugin_list();

	plugin_model_->clear();

	for(auto it = plugins.begin(); it != plugins.end(); ++it) {

		const QString filename = it.key();
		QString plugin_name;
		QString author;
		QString url;

		// get a QObject from the plugin
		if(QObject *const p = it.value()) {
			const QMetaObject *const meta = p->metaObject();
			plugin_name = meta->className();
			const int author_index = meta->indexOfClassInfo("author");
			if(author_index != -1) {
				author = meta->classInfo(author_index).value();
			}

			const int url_index = meta->indexOfClassInfo("url");
			if(url_index != -1) {
				url = meta->classInfo(url_index).value();
			}
		}
		
		plugin_model_->addPlugin(filename, plugin_name, author, url);
	}

	ui->plugins_table->resizeColumnsToContents();
}
Esempio n. 11
0
    foreach(currentLayer, layers)
    {
        QJsonObject layerObject;
        layerObject["properties"] = ResourcePropertiesToJSON(currentLayer);

        QHash<TileCoord, Tile> tiles = currentLayer->GetAllTiles();
        QHash<TileCoord, Tile>::iterator i = tiles.begin();

        QJsonArray tileArray;

        while(i != tiles.end())
        {
            QJsonObject tileObject;
            tileObject["oX"] = i.value().origin.first;
            tileObject["oY"] = i.value().origin.second;
            tileObject["x"] = i.value().pos.first;
            tileObject["y"] = i.value().pos.second;

            tileArray.append(tileObject);

            ++i;
        }

        layerObject["tiles"] = tileArray;

        layerArray.append(layerObject);
    }
Esempio n. 12
0
void VConfigManager::readShortcutsFromSettings()
{
    const QString group("shortcuts");

    m_shortcuts.clear();
    m_shortcuts = readShortcutsFromSettings(defaultSettings, group);

    // Update default settings according to user settings.
    QHash<QString, QString> userShortcuts = readShortcutsFromSettings(userSettings,
                                                                      group);
    QSet<QString> matched;
    matched.reserve(m_shortcuts.size());
    for (auto it = userShortcuts.begin(); it != userShortcuts.end(); ++it) {
        auto defaultIt = m_shortcuts.find(it.key());
        if (defaultIt != m_shortcuts.end()) {
            QString sequence = it.value().trimmed();
            if (sequence != defaultIt.value()) {
                if (isValidKeySequence(sequence)) {
                    matched.insert(it.key());
                    *defaultIt = sequence;
                }
            } else {
                matched.insert(it.key());
            }
        }
    }

    if (matched.size() < m_shortcuts.size()) {
        qDebug() << "override user shortcuts settings using default settings";
        writeShortcutsToSettings(userSettings, group, m_shortcuts);
    }
}
bool LocalTextRecordingEditor::save(const Media::Recording* recording)
{
   Q_UNUSED(recording)
   QHash<QByteArray,QByteArray> ret = static_cast<const Media::TextRecording*>(recording)->d_ptr->toJsons();

   QDir dir(QStandardPaths::writableLocation(QStandardPaths::DataLocation));

   //Make sure the directory exist
   dir.mkdir("text/");

   //Save each file
   for (QHash<QByteArray,QByteArray>::const_iterator i = ret.begin(); i != ret.end(); ++i) {
      QFile file(QString("%1/text/%2.json").arg(dir.path()).arg(QString(i.key())));

      if ( file.open(QIODevice::WriteOnly | QIODevice::Text) ) {
         QTextStream streamFileOut(&file);
         streamFileOut.setCodec("UTF-8");
         streamFileOut << i.value();
         streamFileOut.flush();
         file.close();
      }
   }

   return true;
}
Esempio n. 14
0
int main ()
{
    QHash<int, int> myQHash;
    QHash<int, int> :: iterator it;

    myQHash[1] = 500;
    myQHash[2] = 300;
    myQHash[3] = 100;

    it = myQHash.begin();

    it = myQHash.find(1);
    if (it.value() == 500) {
        it = myQHash.erase(it);
    }
    
    it = myQHash.find(2);
    if (it.value() == 300) {
        it = myQHash.erase(it);
    }

    assert(!(myQHash.empty()));

    return 0;
}
void TimeZoneWidget::mousePressEvent(QMouseEvent *event) {
    if (event->button() != Qt::LeftButton)
        return;

    // Set nearest location
    int nX = 999999, mX = event->pos().x();
    int nY = 999999, mY = event->pos().y();
    QHash<QString, QList<Global::Location> > hash = Global::getLocations();
    QHash<QString, QList<Global::Location> >::iterator iter = hash.begin();

    while (iter != hash.end()) {
        QList<Global::Location> locations = iter.value();

        for (int i = 0; i < locations.size(); ++i) {
            Global::Location loc = locations[i];
            QPoint locPos = getLocationPosition(loc.longitude, loc.latitude);

            if ((abs(mX - locPos.x()) + abs(mY - locPos.y())  <  abs(mX - nX) + abs(mY - nY))) {
                currentLocation = loc;
                nX = locPos.x();
                nY = locPos.y();
            }
        }

        ++iter;
    }

    // Set zone image and repaint widget
    setCurrentLocation(currentLocation);

    // Emit signal
    emit locationChanged(currentLocation);
}
Esempio n. 16
0
void BookInfo::setCachesFromInfo(QHash<QString, BookLocation*> locations)
{
    qDebug() << Q_FUNC_INFO;
    QHash<QString, BookLocation*>::iterator it = m_locations.begin();
    QHash<QString, BookLocation*>::iterator itEnd = m_locations.end();
    while( it != itEnd )
    {
        if(locationsPosCache.contains(it.value()->bookmark) && it.value()->pos > 0)
            locationsPosCache.insert(it.value()->bookmark, it.value()->pos);

        if(locationsPageCache.contains(it.value()->bookmark) && it.value()->pos > 0)
            locationsPageCache.insert(it.value()->bookmark, it.value()->page);

        ++it;
    }

    QHash<QString, BookLocation*>::iterator itLoc = locations.begin();
    QHash<QString, BookLocation*>::iterator itLocEnd = locations.end();
    while( itLoc != itLocEnd )
    {
        if(locationsPosCache.contains(itLoc.value()->bookmark) && itLoc.value()->pos > 0)
            locationsPosCache.insert(itLoc.value()->bookmark, itLoc.value()->pos);

        if(locationsPageCache.contains(itLoc.value()->bookmark) && itLoc.value()->pos > 0)
            locationsPageCache.insert(itLoc.value()->bookmark, itLoc.value()->page);

        ++itLoc;
    }

}
Esempio n. 17
0
void Grid::unfixArcConsistency(QHash<Cell*, QSet<char> > diff)
{
	for( auto i=diff.begin(); i!=diff.end(); ++i ){
		Cell* cell = i.key();
		cell->appendToDomain(i.value());
	}
}
Esempio n. 18
0
/**
 *  Returns a 255 by 100 QImage containing a Histogram for the given channel.
 *  The background is transparent (Alpha 0, RGB=255) */
QImage Histogram::getImage(Channel channel = LChannel, QBrush pen = Qt::gray)
{
    // Create blank QImage and fill it with transparent background:
    QImage histImage(255, 100, QImage::Format_ARGB32);
    histImage.fill(0);
    QPainter painter(&histImage);
    painter.setBrush(Qt::transparent); 
    painter.setPen(Qt::transparent);
    painter.drawRect(0,0,255,100);

    // Calculate the aspect ratio using the maximal value of the color histograms
    int maximum = (channel == LChannel ? maximumValue(LChannel) :  maximumValue(RGB));
    float ratio = 100.0/float(maximum);

    // Preparing the painter:
    painter.setBrush(pen);
    painter.setPen(pen.color());

    int h;
    // Draw histogram
    QHash<int, int>* hist = get(channel);
    QHash<int, int>::const_iterator cit = hist->begin();

    while (cit != hist->end())
    {
        h = 100 - floor(ratio*cit.value());
        painter.drawLine(cit.key(), h, cit.key(), 100);
        ++cit;
    }

    return histImage;
}
Esempio n. 19
0
            bool init() {
                if( m_script->action()->hadError() )
                    m_script->action()->clearError();

                delete m_engine;
                m_engine = new QScriptEngine();

                // load the Qross QScriptExtensionPlugin plugin that provides
                // us a bridge between Qross and QtScript. See here plugin.h
                m_engine->importExtension("qross");
                if( m_engine->hasUncaughtException() ) {
                    handleException();
                    delete m_engine;
                    m_engine = 0;
                    return false;
                }

                // the Qross QScriptExtensionPlugin exports the "Qross" property.
                QScriptValue global = m_engine->globalObject();
                m_qross = global.property("Qross");
                Q_ASSERT( m_qross.isQObject() );
                Q_ASSERT( ! m_engine->hasUncaughtException() );

                // Attach our Qross::Action instance to be able to access it in
                // scripts. Just like at the Kjs-backend we publish our own
                // action as "self".
                m_self = m_engine->newQObject( m_script->action() );
                global.setProperty("self", m_self, QScriptValue::ReadOnly|QScriptValue::Undeletable);

                { // publish the global objects.
                    QHash< QString, QObject* > objects = Manager::self().objects();
                    QHash< QString, QObject* >::Iterator it(objects.begin()), end(objects.end());
                    for(; it != end; ++it)
                        global.setProperty(it.key(), m_engine->newQObject( it.value() ) );
                }

                { // publish the local objects.
                    QHash< QString, QObject* > objects = m_script->action()->objects();
                    QHash< QString, QObject* >::Iterator it(objects.begin()), end(objects.end());
                    for(; it != end; ++it) {
                        copyEnumsToProperties( it.value() );
                        global.setProperty(it.key(), m_engine->newQObject( it.value() ) );
                    }
                }

                return ! m_engine->hasUncaughtException();
            }
Esempio n. 20
0
void EditorWidgetKate::loadSettings(KTextEditor::ConfigInterface *iface, cfg_variant cfg)
{
    if(!iface)
        return;

    QHash<QString, QVariant> values = sConfig.get(cfg).toHash();
    for(QHash<QString, QVariant>::iterator itr = values.begin(); itr != values.end(); ++itr)
        iface->setConfigValue(itr.key(), *itr);
}
Esempio n. 21
0
File: shader.cpp Progetto: KDE/gluon
void Shader::setUniforms(const QHash< QString, QVariant >& uniforms)
{
    QHash< QString, QVariant >::const_iterator itr;
    for( itr = uniforms.begin(); itr != uniforms.end(); ++itr )
    {
        if( d->uniforms.contains( itr.key() ) )
            d->uniforms[ itr.key() ] = itr.value();
    }
}
Esempio n. 22
0
void VUtils::decodeUrl(QString &p_url)
{
    QHash<QString, QString> maps;
    maps.insert("%20", " ");

    for (auto it = maps.begin(); it != maps.end(); ++it) {
        p_url.replace(it.key(), it.value());
    }
}
Esempio n. 23
0
KDevelop::VcsEvent BazaarUtils::parseBzrLogPart(const QString& output)
{
    const QStringList outputLines = output.split('\n');
    KDevelop::VcsEvent commitInfo;
    bool atMessage = false;
    QString message;
    bool afterMessage = false;
    QHash<QString, KDevelop::VcsItemEvent::Actions> fileToActionsMapping;
    KDevelop::VcsItemEvent::Action currentAction;
    for (const QString &line : outputLines) {
        if (!atMessage) {
            if (line.startsWith(QStringLiteral("revno"))) {
                QString revno = line.mid(QStringLiteral("revno: ").length());
                revno = revno.left(revno.indexOf(' '));
                KDevelop::VcsRevision revision;
                revision.setRevisionValue(revno.toLongLong(), KDevelop::VcsRevision::GlobalNumber);
                commitInfo.setRevision(revision);
            } else if (line.startsWith(QStringLiteral("committer: "))) {
                QString commiter = line.mid(QStringLiteral("committer: ").length());
                commitInfo.setAuthor(commiter);     // Author goes after commiter, but only if is different
            } else if (line.startsWith(QStringLiteral("author"))) {
                QString author = line.mid(QStringLiteral("author: ").length());
                commitInfo.setAuthor(author);       // It may override commiter (In fact commiter is not supported by VcsEvent)
            } else if (line.startsWith(QStringLiteral("timestamp"))) {
                const QString formatString = QStringLiteral("yyyy-MM-dd hh:mm:ss");
                QString timestamp = line.mid(QStringLiteral("timestamp: ddd ").length(), formatString.length());
                commitInfo.setDate(QDateTime::fromString(timestamp, formatString));
            } else if (line.startsWith(QStringLiteral("message"))) {
                atMessage = true;
            }
        } else if (atMessage && !afterMessage) {
            if (!line.isEmpty() && line[0].isSpace()) {
                message += line.trimmed() + "\n";
            } else if (!line.isEmpty()) {
                afterMessage = true;
                // leave atMessage = true
                currentAction = BazaarUtils::parseActionDescription(line);
            } // if line is empty - ignore and get next
        } else if (afterMessage) {
            if (!line.isEmpty() && !line[0].isSpace()) {
                currentAction = BazaarUtils::parseActionDescription(line);
            } else if (!line.isEmpty()) {
                fileToActionsMapping[line.trimmed()] |= currentAction;
            } // if line is empty - ignore and get next
        }
    }
    if (atMessage)
        commitInfo.setMessage(message.trimmed());
    for (auto i = fileToActionsMapping.begin(); i != fileToActionsMapping.end(); ++i) {
        KDevelop::VcsItemEvent itemEvent;
        itemEvent.setRepositoryLocation(i.key());
        itemEvent.setActions(i.value());
        commitInfo.addItem(itemEvent);
    }
    return commitInfo;
}
Esempio n. 24
0
void qsKillTimers( QSEnv *env )
{
    QuickInterpreter *ip = QuickInterpreter::fromEnv(env);

    QHash<int, QSObject> *timers = ip->timers();
    for (QHash<int, QSObject>::ConstIterator it = timers->begin(); it != timers->end(); ++it) {
        ip->killTimer(it.key());
    }
    timers->clear();
}
Esempio n. 25
0
void ResourceManager::clearImageCache()
{
    QHash<QString, QImage*>::Iterator iter = sSourceImageHash.begin();
    while(iter != sSourceImageHash.end())
    {
        delete iter.value();
        iter++;
    }
    sSourceImageHash.clear();
}
Esempio n. 26
0
Expression::Expression(QString expression, QHash<QString, QVariant> params,
                       bool onlyColumn) {
    for(auto i = params.begin(); i != params.end(); ++i) {
        QString ikey = i.key();
        expression.replace(":" + ikey.replace('.','_'),":" + this->generateParam());
        this->appendParam(i.key(),i.value());
    }
    this->expression = expression;
    this->onlyColumn = onlyColumn;
}
Esempio n. 27
0
// Call this function when you want to clean up all animation data allocated to
// the memory.
void ResourceManager::clearAnimationCache()
{
    QHash<QString, AnimationModel*>::Iterator iter = sAnimationHash.begin();
    while(iter != sAnimationHash.end())
    {
        delete iter.value();
        iter++;
    }
    sAnimationHash.clear();
}
Esempio n. 28
0
void ToolManager::createActions(const QHash<QString, ToolInfo> &infoHash)
{
	for (auto iter = infoHash.begin(); iter != infoHash.end(); ++iter)
	{
		auto action = new QAction(iter->icon, iter->text, this);
		action->setCheckable(true);
		action->setObjectName(iter.key());
		_actionGroup->addAction(action);
		_actionHash[action] = iter.key();
	}
}
QVariantMap
UnitySortFilterProxyModelQML::get(int row)
{
    QVariantMap res;
    const QHash<int, QByteArray> roles = roleNames();
    auto it = roles.begin();
    for ( ; it != roles.end(); ++it) {
        res[*it] = data(row, it.key());
    }
    return res;
}
Esempio n. 30
0
void CSMesEmma::emmaStatisticMethods( const QHash<CSMesFunctionInfo::functionskey_t,int> &nb_tested_function_list,int &nb_tested,int &nb_untested)
{
  nb_tested=0;
  nb_untested=0;
  for (QHash<CSMesFunctionInfo::functionskey_t,int>::const_iterator itNbTested=nb_tested_function_list.begin();itNbTested!=nb_tested_function_list.end();++itNbTested)
  {
    if (itNbTested.value()==0)
      nb_untested++;
    else
      nb_tested++;
  }
}