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


C++ QList::back方法代码示例

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


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

示例1: IngestSubtitle

void MythCCExtractorPlayer::IngestSubtitle(
    QList<OneSubtitle> &list, const QStringList &content)
{
    bool update_last =
        !list.isEmpty() &&
        (int64_t)m_curTime == list.back().start_time &&
        !content.isEmpty();

    if (update_last)
    {
        //update text only (need for cc608)
        list.back().text = content;
        return;
    }

    OneSubtitle last_one = list.isEmpty() ? OneSubtitle() : list.back();
    if (content != last_one.text || last_one.length >= 0)
    {
        // Finish previous subtitle.
        if (!last_one.text.isEmpty() && last_one.length < 0)
        {
            list.back().length = (int64_t)m_curTime - last_one.start_time;
        }

        // Put new one if it isn't empty.
        if (!content.isEmpty())
        {
            OneSubtitle new_one;
            new_one.start_time = (int64_t)m_curTime;
            new_one.text = content;

            list.push_back(new_one);
        }
    }
}
开发者ID:DragonStalker,项目名称:mythtv,代码行数:35,代码来源:mythccextractorplayer.cpp

示例2: accept

 void accept(const FullySpecifiedType &ty)
 {
     TypeVisitor::accept(ty.type());
     unsigned flags = ty.flags();
     flags |= temps.back().flags();
     temps.back().setFlags(flags);
 }
开发者ID:FlavioFalcao,项目名称:qt-creator,代码行数:7,代码来源:CppRewriter.cpp

示例3: UpdateHierarchy

void MainWindow::UpdateHierarchy()
{
    sceneTree->clear();
    sceneTree->setHeaderLabel( "Hierarchy" );

    QList< QTreeWidgetItem* > nodes;
    const int count = sceneWidget->GetGameObjectCount();

    std::cout << "cleared scene tree" << std::endl;
    for (int i = 0; i < count; ++i)
    {
        nodes.append(new QTreeWidgetItem( (QTreeWidget*)0, QStringList( QString( sceneWidget->GetGameObject( i )->GetName().c_str() ) ) ) );
        nodes.back()->setFlags( nodes.back()->flags() | Qt::ItemIsEditable );
        std::cout << "added to list: " <<  sceneWidget->GetGameObject( i )->GetName()<< std::endl;
    }

    sceneTree->insertTopLevelItems( 0, nodes );

    // Highlights selected game objects.
    for (int i = 0; i < count; ++i)
    {
        for (auto goIndex : sceneWidget->selectedGameObjects)
        {
            if (i == goIndex)
            {
                sceneTree->setCurrentItem( nodes.at(i) );
            }
        }
    }
}
开发者ID:souxiaosou,项目名称:aether3d,代码行数:30,代码来源:MainWindow.cpp

示例4: endElement

	bool endElement( const QString& /*namespaceURI*/, const QString& /*localName*/, const QString& /*qName*/ )
	{
		cElement* element = elements.pop();
		if ( --( levels.back() ) == 0 )
		{
			// Ignore root
			return true;
		}

		if ( element == elements.top() )
		{
			// Ignore include
			return true;
		}

		// Did we complete a parent node?
		if ( elements.top() == NULL )
		{
			// Find a category node
			unsigned int i = 0;

			// Sort it into a category.
			while ( categories[i].name != 0 )
			{
				if ( element->name() == categories[i].name )
				{
					QString tagId = element->getAttribute( "id" );

					// If the element has an id,
					if ( !tagId.isEmpty() )
					{
						if ( impl->unique[categories[i].key].contains( tagId ) && !Config::instance()->overwriteDefinitions() )
						{
							Console::instance()->log( LOG_WARNING, tr( "Duplicate %1: %2\n[File: %3, Line: %4]\n" )
								.arg( QString( element->name() ) ).arg( tagId ).arg( filenames.back() ).arg( locators.top()->lineNumber() ) );
							delete element;
						}
						else
						{
							impl->unique[categories[i].key].insert( tagId, element );
						}
					}
					else
					{
						impl->nonunique[categories[i].key].push_back( element );
					}

					return true;
				}
				++i;
			}

			Console::instance()->log( LOG_WARNING, tr( "Unknown element: %1\n[File: %2, Line: %3]\n" )
				.arg( QString( element->name() ) ).arg( filenames.back() ).arg( locators.top()->lineNumber() ) );
			delete element;
		}

		return true;
	}
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:59,代码来源:definitions.cpp

示例5: startElement

	bool startElement( const QString& /*namespaceURI*/, const QString& localName, const QString& qName, const QXmlAttributes& atts )
	{
		levels.back()++;

		// Ignore document root
		if ( levels.back() == 1 )
		{
			if ( levels.isEmpty() )
			{
				// Top level
				elements.push( NULL );
			}
			else
			{
				// Within an include
				if ( elements.isEmpty() )
					elements.push( 0 );
				else
					elements.push( elements.top() );
			}
			return true;
		}

		// Include another file
		if ( qName == "include" )
		{
			QString value = atts.value( "file" );
			load( value );

			elements.push( elements.top() );
			return true;
		}

		cElement* element = new cElement;
		element->setName( localName.toLatin1() );
		element->copyAttributes( atts );

		// Child Element?
		if ( elements.top() != NULL )
		{
			cElement* parent = elements.top(); // Pop the potential parent
			parent->addChild( element ); // Add the child to it's parent
			element->setParent( parent );
		} else {
			Definitions::instance()->addElement(element);
		}

		elements.push( element ); // Push our element (there may be children)

		return true;
	}
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:51,代码来源:definitions.cpp

示例6: clearAllItems

void SchematicScene::clearAllItems()
{
	clearSelection();
	m_highlightedLinks.clear();
	QList<SchematicWindowEditor *> editors;
	QList<SchematicNode *> nodes;
	QList<SchematicLink *> links;
	int i;
	QList<QGraphicsItem *> sceneItems = items();
	int size = sceneItems.size();
	//create nodes and links list
	for (i = 0; i < size; i++) {
		QGraphicsItem *item = sceneItems.at(i);
		SchematicWindowEditor *editor = dynamic_cast<SchematicWindowEditor *>(item);
		SchematicNode *node = dynamic_cast<SchematicNode *>(item);
		SchematicLink *link = dynamic_cast<SchematicLink *>(item);
		if (editor)
			editors.append(editor);
		if (node)
			nodes.append(node);
		if (link)
			links.append(link);
	}
	while (links.size() > 0) {
		SchematicLink *link = links.back();
		removeItem(link);
		links.removeLast();
		SchematicPort *startPort = link->getStartPort();
		SchematicPort *endPort = link->getEndPort();
		if (startPort)
			startPort->removeLink(link);
		if (endPort)
			endPort->removeLink(link);
		delete link;
	}
	while (editors.size() > 0) {
		SchematicWindowEditor *editor = editors.back();
		removeItem(editor);
		editors.removeLast();
		delete editor;
	}
	while (nodes.size() > 0) {
		SchematicNode *node = nodes.back();
		removeItem(node);
		nodes.removeLast();
		delete node;
	}
	assert(items().size() == 0);
}
开发者ID:Lisy09Personal,项目名称:opentoonz,代码行数:49,代码来源:schematicviewer.cpp

示例7: sizes

int
Splitter::getRightChildrenSize() const
{
    QList<int> list = sizes();
    assert(list.size() == 2);
    return list.back();
}
开发者ID:kcotugno,项目名称:Natron,代码行数:7,代码来源:Splitter.cpp

示例8: paint

void nodeWidget::paint( QPainter *painter, const QStyleOptionGraphicsItem *, QWidget * )
    {
    QString title( "Hello" );
    QList <QString> properties;

    properties << "Thing" << "lalala" << "bouind" << "hahaha";

    QRectF originalRect( titlebarRect( painter->font() ) );

    _titlePath = QPainterPath();
    _titlePath.addRect( originalRect );

    QRectF titleRect( originalRect );
    titleRect.setHeight( titleRect.height() + ( ROUNDRADIUS * 2 + 1 ) );

    QRectF contentsRect( titleRect );
    contentsRect.setY( originalRect.height() );
    contentsRect.setHeight( originalRect.height() + NODEPROPERTYHEIGHT*( properties.size() - 1 ) - 2*ROUNDRADIUS - 4 );

    QPainterPath titleBar( makeRoundedPath( titleRect ) );
    QPainterPath contents( makeRoundedPath( contentsRect ) );

    QPen outlinePen( Qt::black, 3 );
    if( isSelected() )
        {
        outlinePen.setColor( SELECTED_COLOUR );
        }
    QPainterPath globalLine( makeRoundedPath( titleRect.unite( contentsRect ) ) );
    painter->setPen( outlinePen );
    painter->drawPath( globalLine );
    painter->fillPath( titleBar, titleGradient( titleRect ) );


    painter->fillPath( contents, contentsBrush( contentsRect ) );

    QColor separatingLineColor( Qt::black );
    if( isSelected() )
        {
        separatingLineColor = SELECTED_COLOUR;
        }
    separatingLineColor.setAlpha( 128 );
    QPen separatingLinePen( separatingLineColor );
    QPen whitePen( Qt::white );

    painter->setPen( whitePen );
    painter->drawText( originalRect, Qt::AlignCenter, title );

    QRectF textRect( titleRect );
    textRect.moveTop( textRect.top() + originalRect.height() - 2*ROUNDRADIUS - 2 );
    FOREACH( properties, prop )
        {
        painter->setPen( whitePen );
        painter->drawText( textRect, Qt::AlignCenter, *prop );
        if( &(*prop) != &(properties.back()) )
            {
            painter->setPen( separatingLinePen );
            painter->drawLine( titleRect.x(), textRect.y()+NODEPROPERTYHEIGHT+4, titleRect.x()+titleRect.width(), textRect.y()+NODEPROPERTYHEIGHT+4 );
            }
        textRect.moveTop( textRect.top() + NODEPROPERTYHEIGHT );
        }
开发者ID:davidmueller13,项目名称:vexx,代码行数:60,代码来源:nodeWidget.cpp

示例9:

bool v3dViewAnnIntImageMaskHelper::addAnnotation( medAnnotationData * annData )
{
    medImageMaskAnnotationData * imad = qobject_cast<medImageMaskAnnotationData*>(annData);
    if ( !imad )
        return false;

    medAbstractDataImage * dataImage = imad->maskData();
    v3dView * view = this->getV3dView();
    int oldLayer = view->currentLayer();
    int maskLayer = view->layerCount();

    view->setData(dataImage, maskLayer);

    QList<double> scalars;
    QList<QColor> colors;
    for( medImageMaskAnnotationData::ColorMapType::const_iterator it(imad->colorMap().begin()), end(imad->colorMap().end());
        it != end; ++it )
    {
        scalars.push_back(it->first);
        colors.push_back(it->second);
    }


    view->setCurrentLayer(maskLayer);
    view->setColorLookupTable(scalars,colors);
//    qDebug() << "windowLevel" << view->view2d()->GetWindowLevel(maskLayer);
//    qDebug() << "lookuptable"<< view->view2d()->GetWindowLevel(maskLayer)->GetLookupTable();
    view->view2d()->GetWindowLevel(maskLayer)->GetLookupTable()->SetRange(
        scalars.first() - 1, // v3dView pads the data by one.
        scalars.back()  + 1);
    view->setCurrentLayer(oldLayer);

    this->annotationModified(annData);
    return true;
}
开发者ID:Hakim-F,项目名称:medInria-public,代码行数:35,代码来源:v3dViewAnnIntImageMaskHelper.cpp

示例10: AddCookie

	void CookiesEditModel::AddCookie (const QNetworkCookie& cookie)
	{
		int i = 0;
		if (Cookies_.size ())
			i = (Cookies_.end () - 1).key () + 1;
		Cookies_ [i] = cookie;
	
		QString domain = cookie.domain ();
	
		QList<QStandardItem*> foundItems = findItems (domain);
		QStandardItem *parent = 0;
		if (!foundItems.size ())
		{
			parent = new QStandardItem (domain);
			parent->setEditable (false);
			parent->setData (-1);
			invisibleRootItem ()->appendRow (parent);
		}
		else
			parent = foundItems.back ();
		QStandardItem *item = new QStandardItem (QString (Cookies_ [i].name ()));
		item->setData (i);
		item->setEditable (false);
		parent->appendRow (item);
	
		Jar_->setAllCookies (Cookies_.values ());
	}
开发者ID:Zereal,项目名称:leechcraft,代码行数:27,代码来源:cookieseditmodel.cpp

示例11: AddNewEvent

void TEventsLog::AddNewEvent(TEventExt *e)
	{
	qDebug() << tr("New event: ");
	QFile EvLogFile(EVLOG_FILENAME);
	if (!EvLogFile.open(QIODevice::Append | QIODevice::Text)) qDebug() << tr("File open error!");

	QList<QStandardItem*> items;
	int column=0;
	foreach(const QString &text, QStringList() << e->Event.DateTime.toString(tr("dd.MM.yyyy hh:mm:ss")) << e->Event.Text << ((e->OscIndex>=0)?QString().setNum(e->OscIndex):"") )
		{
		qDebug() << text.toUtf8() << ';';
		items << new QStandardItem(text);
		items.back()->setEditable(false);
		if(EvLogFile.isOpen())
			{
			char *buf=utf8_to_cp1251_qstr(text);
			EvLogFile.write(buf);
			delete buf;
			if((++column)<EventsList_Model.columnCount()) EvLogFile.write(";");
			else EvLogFile.write("\r\n");
			}
		}
	qDebug() << "\r\n";

	EventsList_Model.appendRow(items);
	if(EventsList_Model.rowCount()>EVLOG_NUM_MAX)
		{
		EventsList_Model.removeRow(0);
		}

	GotoLastEvent();
	}
开发者ID:PaulGribov,项目名称:oktron,代码行数:32,代码来源:teventslog.cpp

示例12: create_segments

static void create_segments()
      {
      segment.append(MidiSegment());

      segment[0].start = firstbeat; // Always start a segment at the very beginning of the piece (the first beat)
      for (int b = 0; b < num_sbeats; b++) {
            if (b == 0 && (sbeat[0].time - firstbeat) < ((sbeat[1].time-firstbeat) - (sbeat[0].time-firstbeat))/2)
                  continue;
            /* If it's the first beat of the piece, and the upbeat is
               less than half of the first beat interval, don't start a segment
            */
            else {
                  MidiSegment seg;
                  seg.start          = sbeat[b].time;
                  segment.back().end = sbeat[b].time;
                  segment.append(seg);
                  }
            }
      int s = segment.size() - 1;

    /* If final segment starts at or after final timepoint of piece, ignore it,
       decrementing number of segments by 1; if not, set that segment's ending
       to final timepoint of piece
       */
      if (segment[s].start >= final_timepoint) {
            s--;
            }
      else {
            segment[s].end = final_timepoint;
            /* qDebug("Final segment ends at %d", segment[s].end); */
            }
      segtotal = s; // index of final segment
      }
开发者ID:bojan88,项目名称:MuseScore,代码行数:33,代码来源:keyfinder.cpp

示例13:

QSharedPointer<VCSBase::AbstractCheckoutJob> GitoriousCloneWizard::createJob(const QList<QWizardPage*> &parameterPages,
                                                                    QString *checkoutPath)
{
    const Git::CloneWizardPage *cwp = qobject_cast<const Git::CloneWizardPage *>(parameterPages.back());
    QTC_ASSERT(cwp, return QSharedPointer<VCSBase::AbstractCheckoutJob>())
    return cwp->createCheckoutJob(checkoutPath);
}
开发者ID:anchowee,项目名称:QtCreator,代码行数:7,代码来源:gitoriousclonewizard.cpp

示例14: moveDownCustomCommand

void DlgCustomToolbarsImp::moveDownCustomCommand(const QString& name, const QByteArray& userdata)
{
    QVariant data = workbenchBox->itemData(workbenchBox->currentIndex(), Qt::UserRole);
    Workbench* w = WorkbenchManager::instance()->active();
    if (w && w->name() == std::string((const char*)data.toByteArray())) {
        QList<QToolBar*> bars = getMainWindow()->findChildren<QToolBar*>(name);
        if (bars.size() != 1)
            return;

        QByteArray cmd = userdata;
        int numSep = 0, indexSep = 0;
        if (cmd.startsWith("Separator")) {
            numSep = cmd.mid(9).toInt();
            cmd = "Separator";
        }
        QList<QAction*> actions = bars.front()->actions();
        for (QList<QAction*>::ConstIterator it = actions.begin(); it != actions.end(); ++it) {
            if ((*it)->data().toByteArray() == cmd) {
                // if we move a separator then make sure to pick up the right one
                if (numSep > 0) {
                    if (++indexSep < numSep)
                        continue;
                }
                QAction* act = *it;
                if (*it == actions.back())
                    break; // we're already on the last element
                ++it;
                // second last item
                if (*it == actions.back()) {
                    QList<QAction*> group = getActionGroup(act);
                    bars.front()->removeAction(act);
                    bars.front()->addAction(act);
                    if (!group.isEmpty())
                        setActionGroup(act, group);
                    break;
                }
                ++it;
                QList<QAction*> group = getActionGroup(act);
                bars.front()->removeAction(act);
                bars.front()->insertAction(*it, act);
                if (!group.isEmpty())
                    setActionGroup(act, group);
                break;
            }
        }
    }
}
开发者ID:3DPrinterGuy,项目名称:FreeCAD,代码行数:47,代码来源:DlgToolbarsImp.cpp

示例15: if

bool ConnectionManager2::applyConfig(QVariant const & config)
{
    if (config.type() != QVariant::List)
        return false;

    QList<Connection *> newConns;
    struct cleanup
    {
        QList<Connection *> & conns;
        cleanup(QList<Connection *> & conns) : conns(conns) {}
        ~cleanup() { for (int i = 0; i < conns.size(); ++i) conns[i]->releaseAll(); }
    } cleanupGuard(newConns);

    QList<QVariant> const & connConfigs = config.toList();

    for (int i = 0; i < connConfigs.size(); ++i)
    {
        if (connConfigs[i].type() != QVariant::Hash)
            return false;
        QHash<QString, QVariant> const & connConfig = connConfigs[i].toHash();

        QVariant typev = connConfig.value("type");
        if (typev.type() != QVariant::String)
            return false;

        QString const & type = typev.toString();

        ConnectionPointer<Connection> conn;
        if (type == "serial_port")
            conn.reset(new SerialPort());
        else if (type == "tcp_client")
            conn.reset(new TcpSocket());
        else if (type == "udp_socket")
            conn.reset(new UdpSocket());
#ifdef HAVE_LIBYB
        else if (type == "usb_yb_acm")
            conn.reset(new UsbAcmConnection2(m_yb_runner));
#endif

        if (!conn)
            return false;

        QVariant settings = connConfig.value("settings");
        if (settings.type() != QVariant::Hash || !conn->applyConfig(settings.toHash()))
            return false;

        newConns.push_back(conn.data());
        conn.take();
    }

    this->clearUserOwnedConns();
    while (!newConns.empty())
    {
        this->addUserOwnedConn(newConns.back());
        newConns.pop_back();
    }

    return true;
}
开发者ID:Tasssadar,项目名称:Lorris,代码行数:59,代码来源:connectionmgr2.cpp


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