Beispiel #1
0
void AnnotationDialog::ListSelect::setSelection( const StringSet& on, const StringSet& partiallyOn )
{
    for ( QTreeWidgetItemIterator itemIt( m_treeWidget ); *itemIt; ++itemIt ) {
        if ( partiallyOn.contains( (*itemIt)->text(0) ) )
            (*itemIt)->setCheckState( 0, Qt::PartiallyChecked );
        else
            (*itemIt)->setCheckState( 0, on.contains( (*itemIt)->text(0) ) ? Qt::Checked : Qt::Unchecked );
    }

    m_lineEdit->clear();
    updateSelectionCount();
}
void Exif::TreeView::setSelectedExif( const StringSet& selected )
{
    for ( QTreeWidgetItemIterator it( this ); *it; ++it ) {
        bool on = selected.contains( (*it)->text(1) );
        (*it)->setCheckState(0,on ? Qt::Checked : Qt::Unchecked );
    }
}
Beispiel #3
0
static bool checkArgumentsForAvoidedTypes (const StringSet &avoid, const Variables &args) {
	for (const VariableDef &cur : args) {
		if (avoid.contains (cur.type)) {
			return true;
		}
		
	}
	
	return false;
}
Beispiel #4
0
static void filterFields (const StringSet &avoid, Variables &fields) {
	for (int i = 0; i < fields.length (); i++) {
		const VariableDef &cur = fields.at (i);
		
		if (avoid.contains (cur.type)) {
			fields.remove (i);
			i--;
		}
		
	}
	
}
/**
 * categories is the selected categories for one image, members may be Las Vegas, Chicago, and Los Angeles if the
 * category in question is Places.
 * This function then increases _groupCount with 1 for each of the groups the relavant items belongs to
 * Las Vegas might increase the _groupCount[Nevada] by one.
 * The tricky part is to avoid increasing it by more than 1 per image, that is what the countedGroupDict is
 * used for.
 */
void GroupCounter::count( const StringSet& categories )
{
    static StringSet countedGroupDict;

    countedGroupDict.clear();
    for( StringSet::const_iterator categoryIt = categories.begin(); categoryIt != categories.end(); ++categoryIt ) {
        if ( _memberToGroup.contains(*categoryIt)) {
            const QStringList groups = _memberToGroup[*categoryIt];
            for ( const QString& group : groups ) {
                if ( !countedGroupDict.contains( group ) ) {
                    countedGroupDict.insert( group );
                    (_groupCount[group])++;
                }
            }
        }
        // The item Nevada should itself go into the group Nevada.
        if ( !countedGroupDict.contains( *categoryIt ) && _groupCount.contains( *categoryIt ) ) {
             countedGroupDict.insert( *categoryIt);
             (_groupCount[*categoryIt])++;
        }
    }
}
Beispiel #6
0
static void filterMethods (const StringSet &avoid, Methods &methods) {
	for (int i = 0; i < methods.length (); i++) {
		const MethodDef &cur = methods.at (i);
		
		if ((!cur.name.isEmpty () && avoid.contains (cur.returnType.type)) ||
		    checkArgumentsForAvoidedTypes (avoid, cur.arguments)) {
			methods.remove (i);
			i--;
		}
		
	}
	
}
Utilities::StringSet MainWindow::ExternalPopup::mimeTypes( const DB::FileNameList& files )
{
    StringSet res;
    StringSet extensions;
    for( DB::FileNameList::ConstIterator fileIt = files.begin(); fileIt != files.end(); ++fileIt ) {
       const DB::FileName baseFileName = *fileIt;
       const int extStart = baseFileName.relative().lastIndexOf(QChar::fromLatin1('.'));
       const QString ext = baseFileName.relative().mid(extStart);
       if (! extensions.contains(ext)) {
           res.insert( mimeType( *fileIt ) );
           extensions.insert( ext );
       }
    }
    return res;
}
Beispiel #8
0
void  WidgetBoxTreeWidget::restoreExpandedState()
{
    typedef QSet<QString> StringSet;
    QDesignerSettingsInterface *settings = m_core->settingsManager();
    m_iconMode = settings->value(QLatin1String("WidgetBox/View mode")).toBool();
    updateViewMode();
    const StringSet closedCategories = settings->value(QLatin1String("WidgetBox/Closed categories"), QStringList()).toStringList().toSet();
    expandAll();
    if (closedCategories.empty())
        return;

    if (const int numCategories = categoryCount()) {
        for (int i = 0; i < numCategories; ++i) {
            QTreeWidgetItem *item = topLevelItem(i);
            if (closedCategories.contains(item->text(0)))
                item->setExpanded(false);
            }
    }
}