本文整理汇总了C++中Q_FOREACH函数的典型用法代码示例。如果您正苦于以下问题:C++ Q_FOREACH函数的具体用法?C++ Q_FOREACH怎么用?C++ Q_FOREACH使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Q_FOREACH函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Q_FOREACH
void Export2FB2Dialog::handleChannelsSelectionChanged (const QItemSelection& selected,
const QItemSelection& deselected)
{
QStringList removedCategories;
Q_FOREACH (QModelIndex index, deselected.indexes ())
removedCategories << Core::Instance ().GetCategories (index);
removedCategories.removeDuplicates ();
Q_FOREACH (QString removed, removedCategories)
CurrentCategories_.removeAll (removed);
QStringList addedCategories;
Q_FOREACH (QModelIndex index, selected.indexes ())
addedCategories << Core::Instance ().GetCategories (index);
CurrentCategories_ << addedCategories;
CurrentCategories_.removeDuplicates ();
Selector_->setPossibleSelections (CurrentCategories_);
Selector_->selectAll ();
if (!HasBeenTextModified_ &&
Ui_.ChannelsTree_->selectionModel ()->selectedRows ().size () <= 1)
{
const QModelIndex& index = Ui_.ChannelsTree_->currentIndex ();
if (index.isValid ())
Ui_.Name_->setText (index.sibling (index.row (), 0).data ().toString ());
}
}
示例2: stop
void Testbench::doStep()
{
double currentTime = m_stopWatch.elapsedTime();
double timePassed = currentTime - m_timeStamp;
m_timeStamp = currentTime;
if(currentTime / PROCESS_PERIOD >= trajectoryTicks())
{
stop();
Q_FOREACH(SingleServoTestbench* tb, m_benches)
tb->updateStatistics();
if(m_ui->learnCheckBox->isChecked())
{
Q_FOREACH(SingleServoTestbench* tb, m_benches)
tb->updateTrajectory();
m_repTimer->start();
}
return;
}
Q_FOREACH(SingleServoTestbench* tb, m_benches)
{
tb->doStep(currentTime);
}
示例3: Q_FOREACH
// show/hide widgets - we need this function if widget is used in creator
void QgsRasterFormatSaveOptionsWidget::setType( QgsRasterFormatSaveOptionsWidget::Type type )
{
QList< QWidget* > widgets = this->findChildren<QWidget *>();
if (( type == Table ) || ( type == LineEdit ) )
{
// hide all controls, except stacked widget
Q_FOREACH ( QWidget* widget, widgets )
widget->setVisible( false );
mOptionsStackedWidget->setVisible( true );
Q_FOREACH ( QWidget* widget, mOptionsStackedWidget->findChildren<QWidget *>() )
widget->setVisible( true );
// show relevant page
if ( type == Table )
swapOptionsUI( 0 );
else if ( type == LineEdit )
swapOptionsUI( 1 );
}
else
{
// show all widgets, except profile buttons (unless Full)
Q_FOREACH ( QWidget* widget, widgets )
widget->setVisible( true );
if ( type != Full )
mProfileButtons->setVisible( false );
// show elevant page
if ( type == ProfileLineEdit )
swapOptionsUI( 1 );
}
}
示例4: Q_FOREACH
QgsCptCityArchive::~QgsCptCityArchive()
{
Q_FOREACH ( QgsCptCityDataItem *item, mRootItems )
delete item;
Q_FOREACH ( QgsCptCityDataItem *item, mSelectionItems )
delete item;
mRootItems.clear();
mSelectionItems.clear();
}
示例5: Q_FOREACH
void QTechniqueFilter::copy(const QNode *ref)
{
QFrameGraphNode::copy(ref);
const QTechniqueFilter *other = static_cast<const QTechniqueFilter*>(ref);
Q_FOREACH (QAnnotation *crit, other->d_func()->m_requireList)
addRequirement(qobject_cast<QAnnotation *>(QNode::clone(crit)));
Q_FOREACH (QParameter *p, other->d_func()->m_parameters)
addParameter(qobject_cast<QParameter *>(QNode::clone(p)));
}
示例6: Q_FOREACH
void QgsSnappingUtils::clearAllLocators()
{
Q_FOREACH ( QgsPointLocator* vlpl, mLocators )
delete vlpl;
mLocators.clear();
Q_FOREACH ( QgsPointLocator* vlpl, mTemporaryLocators )
delete vlpl;
mTemporaryLocators.clear();
}
示例7: QVariant
QVariant UserFiltersModel::data (const QModelIndex& index, int role) const
{
if (role != Qt::DisplayRole ||
!index.isValid ())
return QVariant ();
int row = index.row ();
bool isException = true;
SplitRow (&row, &isException);
const auto& list = isException ?
Filter_.Exceptions_ :
Filter_.Filters_;
const auto& item = list.at (row);
switch (index.column ())
{
case 0:
return item.OrigString_;
case 1:
return isException ?
tr ("Allowed") :
tr ("Blocked");
case 2:
switch (item.Option_.MatchType_)
{
case FilterOption::MTWildcard:
case FilterOption::MTPlain:
case FilterOption::MTBegin:
case FilterOption::MTEnd:
return tr ("Wildcard");
case FilterOption::MTRegexp:
return tr ("Regexp");
}
case 3:
return item.Option_.Case_ == Qt::CaseSensitive ?
tr ("True") :
tr ("False");
case 4:
{
const auto& options = item.Option_;
QStringList result;
Q_FOREACH (QString domain, options.Domains_)
result += domain.prepend ("+");
Q_FOREACH (QString domain, options.NotDomains_)
result += domain.prepend ("-");
return result.join ("; ");
}
default:
return QVariant ();
}
}
示例8: d_func
void QTechnique::copy(const QNode *ref)
{
QNode::copy(ref);
const QTechnique *tech = static_cast<const QTechnique*>(ref);
d_func()->m_openGLFilter.copy(tech->d_func()->m_openGLFilter);
Q_FOREACH (QAnnotation *annotation, tech->d_func()->m_annotationList)
addAnnotation(qobject_cast<QAnnotation *>(QNode::clone(annotation)));
Q_FOREACH (QRenderPass *pass, tech->d_func()->m_renderPasses)
addPass(qobject_cast<QRenderPass *>(QNode::clone(pass)));
Q_FOREACH (QParameter *p, tech->d_func()->m_parameters)
addParameter(qobject_cast<QParameter *>(QNode::clone(p)));
}
示例9: d_func
void QRenderPass::copy(const QNode *ref)
{
QNode::copy(ref);
const QRenderPass *other = static_cast<const QRenderPass*>(ref);
d_func()->m_shader = qobject_cast<QShaderProgram *>(QNode::clone(other->d_func()->m_shader));
Q_FOREACH (QAnnotation *crit, other->d_func()->m_annotationList)
addAnnotation(qobject_cast<QAnnotation *>(QNode::clone(crit)));
Q_FOREACH (QParameterMapping *binding, other->d_func()->m_bindings)
addBinding(qobject_cast<QParameterMapping *>(QNode::clone(binding)));
Q_FOREACH (QRenderState *renderState, other->d_func()->m_renderStates)
addRenderState(qobject_cast<QRenderState *>(QNode::clone(renderState)));
}
示例10: qDeleteAll
void CVisSystemCanvasNodeLayout::layoutNodes()
{
#if 0
if(!d->canvas)
return;
// Get Root Node
QList<CVisSystemCanvasNodeItem*> rootNodes = d->getRootNodes();
if(!rootNodes.count())
return;
// Delete the old tree
qDeleteAll(TreeNode::GlobalTreeNodeList);
TreeNode::GlobalTreeNodeList.clear();
// Construct the new node tree
QList<TreeNode*> topNodes;
Q_FOREACH(CVisSystemCanvasNodeItem* rootNode, rootNodes)
topNodes.append(new TreeNode(rootNode));
// Layout the new node tree
QRectF occupiedRect;
Q_FOREACH(TreeNode* n, topNodes)
occupiedRect |= n->layout(occupiedRect);
// Delete all the tree nodes
qDeleteAll(TreeNode::GlobalTreeNodeList);
TreeNode::GlobalTreeNodeList.clear();
#endif
QList<CVisSystemCanvasNodeItem*> nodeItemList = d->canvas->nodeItemList();
if(!nodeItemList.count())
return;
d->visitedNodes.clear();
d->visitingNodes.clear();
for(int i=0; i<nodeItemList.count(); i++)
d->layoutNodeItem(nodeItemList[i]);
d->visitedNodes.clear();
d->visitingNodes.clear();
for(int i=0; i<nodeItemList.count(); i++)
d->centerNodeItem(nodeItemList[i]);
d->canvas->bringToCenter();
d->canvas->zoomFit();
}
示例11: Q_FOREACH
void djvViewFileMenu::menuUpdate()
{
_p->recent->clear();
Q_FOREACH(QAction * action,
actions()->group(djvViewFileActions::RECENT_GROUP)->actions())
_p->recent->addAction(action);
_p->layer->clear();
Q_FOREACH(QAction * action,
actions()->group(djvViewFileActions::LAYER_GROUP)->actions())
_p->layer->addAction(action);
}
示例12: horizontalViewScaleFactor
void QgsComposerNodesItem::drawNodes( QPainter *painter ) const
{
double rectSize = 3.0 / horizontalViewScaleFactor();
QgsStringMap properties;
properties.insert( "name", "cross" );
properties.insert( "color_border", "red" );
QScopedPointer<QgsMarkerSymbolV2> symbol;
symbol.reset( QgsMarkerSymbolV2::createSimple( properties ) );
symbol.data()->setSize( rectSize );
symbol.data()->setAngle( 45 );
QgsMapSettings ms = mComposition->mapSettings();
ms.setOutputDpi( painter->device()->logicalDpiX() );
QgsRenderContext context = QgsRenderContext::fromMapSettings( ms );
context.setPainter( painter );
context.setForceVectorOutput( true );
QScopedPointer<QgsExpressionContext> expressionContext;
expressionContext.reset( createExpressionContext() );
context.setExpressionContext( *expressionContext.data() );
symbol.data()->startRender( context );
Q_FOREACH ( QPointF pt, mPolygon )
symbol.data()->renderPoint( pt, nullptr, context );
symbol.data()->stopRender( context );
if ( mSelectedNode >= 0 && mSelectedNode < mPolygon.size() )
drawSelectedNode( painter );
}
示例13: Q_FOREACH
void Properties::load(const QSettings &rSettings)
{
QStringList keys = rSettings.childKeys();
QString key;
Q_FOREACH(key, keys)
insert(key, rSettings.value(key).toString());
}
示例14: horizontalViewScaleFactor
void QgsComposerNodesItem::drawNodes( QPainter *painter ) const
{
double rectSize = 3.0 / horizontalViewScaleFactor();
QgsStringMap properties;
properties.insert( QStringLiteral( "name" ), QStringLiteral( "cross" ) );
properties.insert( QStringLiteral( "color_border" ), QStringLiteral( "red" ) );
std::unique_ptr<QgsMarkerSymbol> symbol;
symbol.reset( QgsMarkerSymbol::createSimple( properties ) );
symbol->setSize( rectSize );
symbol->setAngle( 45 );
QgsRenderContext context = QgsComposerUtils::createRenderContextForComposition( mComposition, painter );
context.setForceVectorOutput( true );
QgsExpressionContext expressionContext = createExpressionContext();
context.setExpressionContext( expressionContext );
symbol->startRender( context );
Q_FOREACH ( QPointF pt, mPolygon )
symbol->renderPoint( pt, nullptr, context );
symbol->stopRender( context );
if ( mSelectedNode >= 0 && mSelectedNode < mPolygon.size() )
drawSelectedNode( painter );
}
示例15: Q_FOREACH
QByteArray QgsMimeDataUtils::layerTreeNodesToUriList( const QList<QgsLayerTreeNode *> &nodes )
{
UriList uris;
Q_FOREACH ( QgsLayerTreeNode *node, nodes )
_addLayerTreeNodeToUriList( node, uris );
return uriListToByteArray( uris );
}