当前位置: 首页>>代码示例>>C++>>正文


C++ Selection::clear方法代码示例

本文整理汇总了C++中Selection::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ Selection::clear方法的具体用法?C++ Selection::clear怎么用?C++ Selection::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Selection的用法示例。


在下文中一共展示了Selection::clear方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: foreach

void ObjectInspector::ObjectInspectorPrivate::getSelection(Selection &s) const
{
    s.clear();

    if (!m_formWindow)
        return;

    const QModelIndexList currentSelectedIndexes = m_treeView->selectionModel()->selectedRows(0);
    if (currentSelectedIndexes.empty())
        return;

    // sort objects
    foreach (const QModelIndex &index, currentSelectedIndexes)
        if (QObject *object = m_model->objectAt(index))
            switch (selectionType(m_formWindow, object)) {
            case NoSelection:
                break;
            case QObjectSelection:
                // It is actually possible to select an action twice if it is in a menu bar
                // and in a tool bar.
                if (!s.objects.contains(object))
                    s.objects.push_back(object);
                break;
            case UnmanagedWidgetSelection:
                s.unmanaged.push_back(qobject_cast<QWidget *>(object));
                break;
            case ManagedWidgetSelection:
                s.managed.push_back(qobject_cast<QWidget *>(object));
                break;
            }
}
开发者ID:Fale,项目名称:qtmoko,代码行数:31,代码来源:objectinspector.cpp

示例2: getSelection

void QDesignerIntegrationPrivate::getSelection(Selection &s)
{
    QDesignerFormEditorInterface *core = q->core();
    // Get multiselection from object inspector
    if (QDesignerObjectInspector *designerObjectInspector = qobject_cast<QDesignerObjectInspector *>(core->objectInspector())) {
        designerObjectInspector->getSelection(s);
        // Action editor puts actions that are not on the form yet
        // into the property editor only.
        if (s.empty())
            if (QObject *object = core->propertyEditor()->object())
                s.objects.push_back(object);

    } else {
        // Just in case someone plugs in an old-style object inspector: Emulate selection
        s.clear();
        QDesignerFormWindowInterface *formWindow = core->formWindowManager()->activeFormWindow();
        if (!formWindow)
            return;

        QObject *object = core->propertyEditor()->object();
        if (object->isWidgetType()) {
            QWidget *widget = static_cast<QWidget*>(object);
            QDesignerFormWindowCursorInterface *cursor = formWindow->cursor();
            if (cursor->isWidgetSelected(widget)) {
                s.managed.push_back(widget);
            } else {
                s.unmanaged.push_back(widget);
            }
        } else {
            s.objects.push_back(object);
        }
    }
}
开发者ID:2gis,项目名称:2gisqt5android,代码行数:33,代码来源:abstractintegration.cpp

示例3: filterSelections

Selection filterSelections(
        T* pressedModel,
        Selection sel,
        bool cumulation)
{
    if(!cumulation)
    {
        sel.clear();
    }

    // If the pressed element is selected
    if(pressedModel->selection.get())
    {
        if(cumulation)
        {
            sel.erase(pressedModel);
        }
        else
        {
            sel.insert(pressedModel);
        }
    }
    else
    {
        sel.insert(pressedModel);
    }

    return sel;
}
开发者ID:gitter-badger,项目名称:i-score,代码行数:29,代码来源:Selection.hpp

示例4: copy

void Selection::copy(Selection& other, bool emptyOther)
{
	if (&other==this)
		return;
	if (m_isGUISelection)
	{
		SelectionList::Iterator itend = m_SelList.end();
		for (SelectionList::Iterator it = m_SelList.begin(); it != itend; ++it)
			(*it)->setSelected(false);
	}
	m_SelList=other.m_SelList;
	if (m_isGUISelection && !m_SelList.isEmpty())
		m_sigSelectionIsMultiple = true;
	if (emptyOther)
		other.clear();
	sendSignals();
}
开发者ID:piksels-and-lines-orchestra,项目名称:scribus,代码行数:17,代码来源:selection.cpp

示例5: AnnounceSelectedSetChanged

void BaseGrid::AnnounceSelectedSetChanged(const Selection &lines_added, const Selection &lines_removed) {
	if (batch_level > 0) {
		// Remove all previously added lines that are now removed
		Selection temp;
		set_difference(batch_selection_added, lines_removed, temp);
		std::swap(temp, batch_selection_added);
		temp.clear();

		// Remove all previously removed lines that are now added
		set_difference(batch_selection_removed, lines_added, temp);
		std::swap(temp, batch_selection_removed);

		// Add new stuff to batch sets
		batch_selection_added.insert(lines_added.begin(), lines_added.end());
		batch_selection_removed.insert(lines_removed.begin(), lines_removed.end());
	}
	else {
		SubtitleSelectionController::AnnounceSelectedSetChanged(lines_added, lines_removed);
	}
}
开发者ID:sthenc,项目名称:Aegisub,代码行数:20,代码来源:base_grid.cpp

示例6: xmlStream


//.........这里部分代码省略.........
		
		//copy the page to the clipboard
		//right side
		//make selections
		for (int j = 0; j < srcDoc->Items->count(); j++)
		{
			if (srcDoc->OnPage(srcDoc->Items->at(j)) == (pages->at(i)-1))
			{
				s->addItem(srcDoc->Items->at(j),false);
			}
			
		}
		
		if (s->count() > 0)
		{
			std::ostringstream xmlString;
			SaxXML xmlStream(xmlString);
			Serializer::serializeObjects(*s, xmlStream);
			std::string xml(xmlString.str());
			QByteArray ba(QByteArray(xml.c_str(), xml.length()));
			
			//paste page from clipboard
			
			Selection pastedObjects = Serializer(*targetDoc).deserializeObjects(ba);
			
			targetDoc->moveGroup(
					targetDoc->Pages->at(i)->guides.vertical(1, targetDoc->Pages->at(i)->guides.Standard),
					targetDoc->Pages->at(i)->guides.horizontal(0, targetDoc->Pages->at(i)->guides.Standard),
					false,
					&pastedObjects
				);
			
			
			s->clear();
			
			for (int j = 0; j < targetDoc->layerCount(); j++)
			{
				//create group out of all the items in the layer
				Selection* gs = new Selection(scMW);
				
				for (int k = 0; k < pastedObjects.count(); k++)
				{
					if (pastedObjects.itemAt(k)->LayerNr == j) gs->addItem(pastedObjects.itemAt(k));
				}
				
				if (gs->count() > 0)
				{
					//create group
					targetDoc->itemSelection_GroupObjects(false, false, gs);
					
					//get group control
					signed int groupid = gs->itemAt(0)->Groups.at(0);
					
					PageItem* groupcontrol = NULL;
					for (int k = 0; k < targetDoc->Items->count(); k++)
					{
						if (
							targetDoc->Items->at(k)->Groups.count() > 0 &&
							targetDoc->Items->at(k)->Groups.at(0) == groupid &&
							targetDoc->Items->at(k)->isGroupControl
						   )
						{
							groupcontrol = targetDoc->Items->at(k);
							break;
						}
					}
开发者ID:AlterScribus,项目名称:ece15,代码行数:67,代码来源:imposition.cpp

示例7: changeDocFold

void Imposition::changeDocFold()
{
	if (isOK == true)
	{
		//create page
		if (foldIsBackSide->checkState() == Qt::Checked)
			targetDoc->createNewDocPages(2);
		else
			targetDoc->createNewDocPages(1);
		
		//copy layers
		for (int i = 1; i < srcDoc->layerCount(); i++)
		{
			targetDoc->addLayer(srcDoc->layerName(i));
		}
		
		targetDoc->setCurrentPage(targetDoc->Pages->at(0));
		Page* p = targetDoc->currentPage();
		
		int firstPage = foldFrontPage->currentText().toInt() - 1;
		int lastPage = 0;
		if (foldFrontPage->currentIndex() < (foldFrontPage->count()-1))
		{
			lastPage = foldFrontPage->itemText(foldFrontPage->currentIndex()+1).toInt() - 2;
		}
		else
		{
			lastPage = firstPage + srcDoc->currentPageLayout;
		}
		
		//make guides
		double allWidth = srcDoc->pageWidth * (srcDoc->currentPageLayout+1);
		double allHeight = srcDoc->pageHeight;
		
		double guide_x = (p->width() - allWidth)/2; //initial (left) guide
		p->guides.addVertical(guide_x, p->guides.Standard);
		
		for (int i = firstPage; i <= lastPage; i++)
		{
			guide_x += srcDoc->Pages->at(i)->width();
			p->guides.addVertical(guide_x,p->guides.Standard);
		}
		
		double guide_y = (p->height() - allHeight)/2;
		p->guides.addHorizontal(guide_y, p->guides.Standard);
		guide_y += allHeight;
		p->guides.addHorizontal(guide_y, p->guides.Standard);
		
		//do the copying
		ScribusMainWindow* scMW = ScCore->primaryMainWindow();
		scMW->view->requestMode(modeNormal);
		Selection* s = new Selection(scMW);
		
		//select items to copy for the first page
		for (int i = 0; i < srcDoc->Items->count(); i++)
		{
			if (	(srcDoc->OnPage(srcDoc->Items->at(i)) >= firstPage) &&
				(srcDoc->OnPage(srcDoc->Items->at(i)) <= lastPage)
			   )
				s->addItem(srcDoc->Items->at(i),false);
		}
		
		if (s->count() > 0)
		{
			//move the selection to the clipboard
			std::ostringstream xmlString;
			SaxXML xmlStream(xmlString);
			Serializer::serializeObjects(*s, xmlStream);
			std::string xml(xmlString.str());
			QByteArray ba(QByteArray(xml.c_str(), xml.length()));
			
			//paste
			Selection pastedObjects = Serializer(*targetDoc).deserializeObjects(ba);
			targetDoc->moveGroup(
					p->guides.vertical(0, p->guides.Standard),
					p->guides.horizontal(0, p->guides.Standard),
					true,
					&pastedObjects
				);
		}
		
		if (foldIsBackSide->checkState() != Qt::Checked) return;
		
		//do the second page
		s->clear();
		firstPage = foldBackPage->currentText().toInt() - 1;
		if (foldBackPage->currentIndex() < (foldBackPage->count()-1))
		{
			lastPage = foldBackPage->itemText(foldBackPage->currentIndex()+1).toInt() - 2;
		}
		else
		{
			lastPage = firstPage + srcDoc->currentPageLayout;
		}
		
		targetDoc->setCurrentPage(targetDoc->Pages->at(1));
		p = targetDoc->currentPage();
		guide_x = (p->width() - allWidth)/2; //initial (left) guide
		p->guides.addVertical(guide_x, p->guides.Standard);
		
//.........这里部分代码省略.........
开发者ID:AlterScribus,项目名称:ece15,代码行数:101,代码来源:imposition.cpp

示例8: removeAllFromSelection

/** Deselects all the nodes in the scene. */
inline void Scene::removeAllFromSelection() {selection.clear();}
开发者ID:adbrown85,项目名称:glxml-old,代码行数:2,代码来源:Scene.hpp


注:本文中的Selection::clear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。