Beispiel #1
0
void ArchiveList::updateArchives(QList<Archive *> archivesOrig)
{
    QSet<QString> expandedLanguages;
    QSet<QString> knownLanguages;
    QSet<ArchiveID> expandedItems;

    for (int i = 0; i < topLevelItemCount(); i ++) {
        QTreeWidgetItem *langItem = topLevelItem(i);
        const QString &lang = langItem->text(0);
        if (langItem->isExpanded())
            expandedLanguages += lang;
        knownLanguages += lang;
        for (int j = 0; j < langItem->childCount(); j ++) {
            QTreeWidgetItem *dateItem = langItem->child(j);
            if (dateItem->isExpanded())
                expandedItems += ArchiveID(lang, dateItem->text(0));
        }
    }

    clear();

    QList<Archive *> archives(archivesOrig);
    qSort(archives.begin(), archives.end(), Archive::comparePointers);

    QTreeWidgetItem *topItem(0);
    QString lastLanguage;

    foreach (Archive *a, archives) {
        if (lastLanguage != a->getLanguage() || a->getLanguage().isEmpty()) {
            lastLanguage = a->getLanguage();
            topItem = new QTreeWidgetItem(this, QStringList() << lastLanguage);
            addTopLevelItem(topItem);
            if (expandedLanguages.contains(lastLanguage))
                topItem->setExpanded(true);
        }
        QTreeWidgetItem *item = new QTreeWidgetItem(topItem);
        item->setText(0, a->getDate());

        if (expandedItems.contains(a->getID()))
            item->setExpanded(true);

        if (qobject_cast<DownloadableArchive *>(a)) {
            fillDownloadableArchiveItem(static_cast<DownloadableArchive *>(a), item);
        } else if (qobject_cast<PartialArchive *>(a)) {
            if (!knownLanguages.contains(a->getLanguage()))
                topItem->setExpanded(true);
            fillPartialArchiveItem(static_cast<PartialArchive *>(a), item);
        } else if (qobject_cast<LocalArchive *>(a)) {
            if (!knownLanguages.contains(a->getLanguage()))
                topItem->setExpanded(true);
            fillLocalArchiveItem(static_cast<LocalArchive *>(a), item);
        }
    }
    resizeColumnToContents(0);
    resizeColumnToContents(1);
    resizeColumnToContents(2);
    resizeColumnToContents(3);
}
Beispiel #2
0
void MIPSmemview::updateList(void)
{
    unsigned int i;
    int top=topItem();

    for(i=0;i<mem.size();i+=4) {
        changeItem(MemItem(i),i/4);
    }
    setCurrentItem(current());
    setTopItem(top);
}
Beispiel #3
0
void DragListBox::dropEvent( QDropEvent *evt ) {
	QString text;

	int i = int( float(evt->pos().y())/float(itemHeight()) + 0.5 ) + topItem();
	if ( i > count() + 1 ) i = count() + 1;

	if ( QTextDrag::decode( evt, text ) ) {
		//If we dragged an "Ignore item from the FieldList to the FieldPool, then we don't
		//need to insert the item, because FieldPool already has a persistent Ignore item.
		if ( !( text == i18n("Ignore" ) && QString(evt->source()->name()) == "FieldList" && 
				evt->source() != this )) {
			insertItem( text, i );
		}

		//If we dragged the "Ignore" item from FieldPool to FieldList, then we don't
		//want to remove the item from the FieldPool
		if ( !( text == i18n("Ignore" ) && QString(evt->source()->name()) == "FieldPool" && 
				evt->source() != this ) ) {
			DragListBox *fp = (DragListBox*)evt->source();
			fp->removeItem( fp->currentItem() );
		}
	}
}
int Q3ListBox::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = Q3ScrollView::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: highlighted((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 1: selected((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 2: highlighted((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 3: selected((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 4: highlighted((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1]))); break;
        case 5: selected((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1]))); break;
        case 6: selectionChanged(); break;
        case 7: selectionChanged((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1]))); break;
        case 8: currentChanged((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1]))); break;
        case 9: clicked((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1]))); break;
        case 10: clicked((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1])),(*reinterpret_cast< const QPoint(*)>(_a[2]))); break;
        case 11: pressed((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1]))); break;
        case 12: pressed((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1])),(*reinterpret_cast< const QPoint(*)>(_a[2]))); break;
        case 13: doubleClicked((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1]))); break;
        case 14: returnPressed((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1]))); break;
        case 15: rightButtonClicked((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1])),(*reinterpret_cast< const QPoint(*)>(_a[2]))); break;
        case 16: rightButtonPressed((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1])),(*reinterpret_cast< const QPoint(*)>(_a[2]))); break;
        case 17: mouseButtonPressed((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< Q3ListBoxItem*(*)>(_a[2])),(*reinterpret_cast< const QPoint(*)>(_a[3]))); break;
        case 18: mouseButtonClicked((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< Q3ListBoxItem*(*)>(_a[2])),(*reinterpret_cast< const QPoint(*)>(_a[3]))); break;
        case 19: contextMenuRequested((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1])),(*reinterpret_cast< const QPoint(*)>(_a[2]))); break;
        case 20: onItem((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1]))); break;
        case 21: onViewport(); break;
        case 22: clear(); break;
        case 23: ensureCurrentVisible(); break;
        case 24: clearSelection(); break;
        case 25: selectAll((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 26: invertSelection(); break;
        case 27: clearInputString(); break;
        case 28: refreshSlot(); break;
        case 29: doAutoScroll(); break;
        case 30: adjustItems(); break;
        }
        _id -= 31;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< uint*>(_v) = count(); break;
        case 1: *reinterpret_cast< int*>(_v) = numItemsVisible(); break;
        case 2: *reinterpret_cast< int*>(_v) = currentItem(); break;
        case 3: *reinterpret_cast< QString*>(_v) = currentText(); break;
        case 4: *reinterpret_cast< int*>(_v) = topItem(); break;
        case 5: *reinterpret_cast< SelectionMode*>(_v) = selectionMode(); break;
        case 6: *reinterpret_cast< bool*>(_v) = isMultiSelection(); break;
        case 7: *reinterpret_cast< LayoutMode*>(_v) = columnMode(); break;
        case 8: *reinterpret_cast< LayoutMode*>(_v) = rowMode(); break;
        case 9: *reinterpret_cast< int*>(_v) = numColumns(); break;
        case 10: *reinterpret_cast< int*>(_v) = numRows(); break;
        case 11: *reinterpret_cast< bool*>(_v) = variableWidth(); break;
        case 12: *reinterpret_cast< bool*>(_v) = variableHeight(); break;
        }
        _id -= 13;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 2: setCurrentItem(*reinterpret_cast< int*>(_v)); break;
        case 4: setTopItem(*reinterpret_cast< int*>(_v)); break;
        case 5: setSelectionMode(*reinterpret_cast< SelectionMode*>(_v)); break;
        case 6: setMultiSelection(*reinterpret_cast< bool*>(_v)); break;
        case 7: setColumnMode(*reinterpret_cast< LayoutMode*>(_v)); break;
        case 8: setRowMode(*reinterpret_cast< LayoutMode*>(_v)); break;
        case 11: setVariableWidth(*reinterpret_cast< bool*>(_v)); break;
        case 12: setVariableHeight(*reinterpret_cast< bool*>(_v)); break;
        }
        _id -= 13;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 13;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 13;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 13;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 13;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 13;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 13;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}