Esempio n. 1
0
void TreeWidget::filterString(const QString& string) {
  QList<QTreeWidgetItem*> _allItems = allItems();
  QList<QTreeWidgetItem*> parents;
  bool stringIsEmpty = string.isEmpty();

  foreach (QTreeWidgetItem* item, _allItems) {
    bool containsString = stringIsEmpty || item->text(0).contains(string, Qt::CaseInsensitive);

    if (containsString) {
      item->setHidden(false);

      if (item->parent()) {
        if (!parents.contains(item->parent())) {
          parents << item->parent();
        }
      }
    }
    else {
      item->setHidden(true);

      if (item->parent()) {
        item->parent()->setHidden(true);
      }
    }
  }
Esempio n. 2
0
ModCanvas::~ModCanvas(void)
{
    QCanvasItemList list=allItems();
    QCanvasItemList::Iterator it = list.begin();
    for (; it != list.end(); ++it) {
            if ( *it )
                delete *it;
    }
}
Esempio n. 3
0
	Inventory::ItemList Inventory::getAllItems() const
	{
		ItemList allItems(0);

        for (SlotMap::const_iterator iter = mSlots.begin(); iter != mSlots.end(); ++iter)
        {
            Item* item = (*iter).second->getItem();
            if (item != NULL)
            {
                allItems.push_back(item);
            }
        }

		return allItems;
	}
Esempio n. 4
0
bool UmlCanvas::already_drawn(BrowserNode * bn) {
  Q3CanvasItemList all = allItems();
  Q3CanvasItemList::Iterator cit;
  UmlCode k = bn->get_type();

  for (cit = all.begin(); cit != all.end(); ++cit) {
    if ((*cit)->visible()) {
      DiagramItem * di = QCanvasItemToDiagramItem(*cit);
    
      if ((di != 0) && (di->type() == k) && (di->get_bn() == bn))
	return TRUE;
    }
  }

  return FALSE;
}
Esempio n. 5
0
void TreeWidget::filterString(QString string)
{
    expandAll();
    QList<QTreeWidgetItem*> _allItems = allItems();

    if (string.isEmpty()) {
        foreach(QTreeWidgetItem * item, _allItems)
        item->setHidden(false);
        for (int i = 0; i < topLevelItemCount(); i++) {
            topLevelItem(i)->setHidden(false);
        }
        if (m_showMode == ItemsCollapsed) {
            collapseAll();
        }
    }
    else {
        foreach(QTreeWidgetItem * item, _allItems) {
            item->setHidden(!item->text(0).contains(string, Qt::CaseInsensitive));
            item->setExpanded(true);
        }
        for (int i = 0; i < topLevelItemCount(); i++) {
            topLevelItem(i)->setHidden(false);
        }

        QTreeWidgetItem* firstItem = topLevelItem(0);
        QTreeWidgetItem* belowItem = itemBelow(firstItem);

        int topLvlIndex = 0;
        while (firstItem) {
            if (firstItem->text(0).contains(string, Qt::CaseInsensitive)) {
                firstItem->setHidden(false);
            }
            else if (!firstItem->parent() && !belowItem) {
                firstItem->setHidden(true);
            }
            else if (!belowItem) {
                break;
            }
            else if (!firstItem->parent() && !belowItem->parent()) {
                firstItem->setHidden(true);
            }

            topLvlIndex++;
            firstItem = topLevelItem(topLvlIndex);
            belowItem = itemBelow(firstItem);
        }
    }
Esempio n. 6
0
QStringList KCompletion::substringCompletion( const QString& string ) const
{
    // get all items in the tree, possibly in sorted order
    bool sorted = (myOrder == Weighted);
    KCompletionMatchesWrapper allItems( sorted );
    extractStringsFromNode( myTreeRoot, QString::null, &allItems, false );

    QStringList list = allItems.list();

    // subStringMatches is invoked manually, via a shortcut, so we should
    // beep here, if necessary.
    if ( list.isEmpty() ) {
        doBeep( NoMatch );
        return list;
    }

    if ( string.isEmpty() ) { // shortcut
        postProcessMatches( &list );
        return list;
    }

    QStringList matches;
    QStringList::ConstIterator it = list.begin();

    for( ; it != list.end(); ++it ) {
        QString item = *it;
        if ( item.find( string, 0, false ) != -1 ) { // always case insensitive
            matches.append( item );
        }
    }

    postProcessMatches( &matches );

    if ( matches.isEmpty() )
        doBeep( NoMatch );

    return matches;
}
void Qt5NodeInstanceServer::resetAllItems()
{
    foreach (QSGItem *item, allItems())
        DesignerSupport::resetDirty(item);
}
Esempio n. 8
0
void Qt5InformationNodeInstanceServer::collectItemChangesAndSendChangeCommands()
{
    static bool inFunction = false;
    if (!inFunction) {
        inFunction = true;

        QSet<ServerNodeInstance> informationChangedInstanceSet;
        QVector<InstancePropertyPair> propertyChangedList;
        bool adjustSceneRect = false;

        if (sgView()) {
            foreach (QSGItem *item, allItems()) {
                if (item && hasInstanceForObject(item)) {
                    ServerNodeInstance instance = instanceForObject(item);

                    DesignerSupport::DirtyType informationsDirty = DesignerSupport::DirtyType(DesignerSupport::TransformUpdateMask
                                                                                              | DesignerSupport::Visible
                                                                                              | DesignerSupport::ZValue
                                                                                              | DesignerSupport::OpacityValue);
                    if (DesignerSupport::dirty(item, informationsDirty))
                        informationChangedInstanceSet.insert(instance);


                    if (DesignerSupport::dirty(item, DesignerSupport::ParentChanged)) {
                        m_parentChangedSet.insert(instance);
                        informationChangedInstanceSet.insert(instance);
                    }
//                    if (d->geometryChanged) {
//                        if (instance.isRootNodeInstance())
//                            declarativeView()->scene()->setSceneRect(item->boundingRect());
//                    }

                }
            }

            foreach (const InstancePropertyPair& property, changedPropertyList()) {
                const ServerNodeInstance instance = property.first;
                const QString propertyName = property.second;

                if (instance.isValid()) {
                    if (instance.isRootNodeInstance() && (propertyName == "width" || propertyName == "height"))
                        adjustSceneRect = true;

                    if (propertyName.contains("anchors"))
                        informationChangedInstanceSet.insert(instance);

                    propertyChangedList.append(property);
                }
            }

            resetAllItems();
            clearChangedPropertyList();

            sendTokenBack();

            if (!informationChangedInstanceSet.isEmpty())
                nodeInstanceClient()->informationChanged(createAllInformationChangedCommand(informationChangedInstanceSet.toList()));

            if (!propertyChangedList.isEmpty())
                nodeInstanceClient()->valuesChanged(createValuesChangedCommand(propertyChangedList));

            if (!m_parentChangedSet.isEmpty()) {
                sendChildrenChangedCommand(m_parentChangedSet.toList());
                m_parentChangedSet.clear();
            }

//            if (adjustSceneRect) {
//                QRectF boundingRect = rootNodeInstance().boundingRect();
//                if (boundingRect.isValid()) {
//                    declarativeView()->setSceneRect(boundingRect);
//                }
//            }

            if (!m_completedComponentList.isEmpty()) {
                nodeInstanceClient()->componentCompleted(createComponentCompletedCommand(m_completedComponentList));
                m_completedComponentList.clear();
            }

            slowDownRenderTimer();
            nodeInstanceClient()->flush();
            nodeInstanceClient()->synchronizeWithClientProcess();
        }

        inFunction = false;
    }
Esempio n. 9
0
void CFileListView::invertSelection()
{
	QItemSelection allItems(model()->index(0, 0), model()->index(model()->rowCount() - 1, 0));
	selectionModel()->select(allItems, QItemSelectionModel::Toggle | QItemSelectionModel::Rows);
}