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 ()); } }
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); }
// 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 ); } }
QgsCptCityArchive::~QgsCptCityArchive() { Q_FOREACH ( QgsCptCityDataItem *item, mRootItems ) delete item; Q_FOREACH ( QgsCptCityDataItem *item, mSelectionItems ) delete item; mRootItems.clear(); mSelectionItems.clear(); }
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))); }
void QgsSnappingUtils::clearAllLocators() { Q_FOREACH ( QgsPointLocator* vlpl, mLocators ) delete vlpl; mLocators.clear(); Q_FOREACH ( QgsPointLocator* vlpl, mTemporaryLocators ) delete vlpl; mTemporaryLocators.clear(); }
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 (); } }
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))); }
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))); }
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(); }
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); }
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 ); }
void Properties::load(const QSettings &rSettings) { QStringList keys = rSettings.childKeys(); QString key; Q_FOREACH(key, keys) insert(key, rSettings.value(key).toString()); }
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 ); }
QByteArray QgsMimeDataUtils::layerTreeNodesToUriList( const QList<QgsLayerTreeNode *> &nodes ) { UriList uris; Q_FOREACH ( QgsLayerTreeNode *node, nodes ) _addLayerTreeNodeToUriList( node, uris ); return uriListToByteArray( uris ); }
void QQnxWindow::setGeometry(const QRect &rect) { const QRect oldGeometry = setGeometryHelper(rect); #if !defined(QT_NO_OPENGL) // If this is an OpenGL window we need to request that the GL context updates // the EGLsurface on which it is rendering. The surface will be recreated the // next time QQnxGLContext::makeCurrent() is called. { // We want the setting of the atomic bool in the GL context to be atomic with // setting m_requestedBufferSize and therefore extended the scope to include // that test. const QMutexLocker locker(&m_mutex); m_requestedBufferSize = rect.size(); if (m_platformOpenGLContext != 0 && bufferSize() != rect.size()) m_platformOpenGLContext->requestSurfaceChange(); } #endif // Send a geometry change event to Qt (triggers resizeEvent() in QWindow/QWidget). // Calling flushWindowSystemEvents() here would flush input events which // could result in re-entering QQnxWindow::setGeometry() again. QWindowSystemInterface::setSynchronousWindowsSystemEvents(true); QWindowSystemInterface::handleGeometryChange(window(), rect); QWindowSystemInterface::setSynchronousWindowsSystemEvents(false); // Now move all children. if (!oldGeometry.isEmpty()) { const QPoint offset = rect.topLeft() - oldGeometry.topLeft(); Q_FOREACH (QQnxWindow *childWindow, m_childWindows) childWindow->setOffset(offset); } }
void RoomConfigWidget::handlePermsReceived (const QList<QXmppMucItem>& perms) { if (qobject_cast<QXmppMucRoom*> (sender ()) && sender () != RoomHandler_) return; for (const auto& perm : perms) { auto parentItem = Aff2Cat_ [perm.affiliation ()]; if (!parentItem) { qWarning () << Q_FUNC_INFO << "no parent item for" << perm.affiliation (); continue; } auto firstItem = new QStandardItem (perm.jid ()); firstItem->setData (perm.reason (), ItemRoles::Reason); QList<QStandardItem*> items; items << firstItem; items << new QStandardItem (perm.reason ()); Q_FOREACH (QStandardItem *item, items) item->setEditable (false); parentItem->appendRow (items); } for (auto item : Aff2Cat_.values ()) { item->sortChildren (0); Ui_.PermsTree_->expand (item->index ()); } }
void DeliciousService::RestoreAccounts () { QSettings settings (QSettings::IniFormat, QSettings::UserScope, QCoreApplication::organizationName (), QCoreApplication::applicationName () + "_Poshuku_OnlineBookmarks_Delicious_Accounts"); int size = settings.beginReadArray ("Accounts"); for (int i = 0; i < size; ++i) { settings.setArrayIndex (i); QByteArray data = settings .value ("SerializedData").toByteArray (); DeliciousAccount *acc = DeliciousAccount::Deserialize (data, this); if (!acc) { qWarning () << Q_FUNC_INFO << "undeserializable account" << i; continue; } Accounts_ << acc; } if (!Accounts_.isEmpty ()) { QObjectList list; Q_FOREACH (DeliciousAccount *acc, Accounts_) list << acc->GetQObject (); emit accountAdded (list); } }
QList<IAccount*> GlooxProtocol::GetRegisteredAccounts () { QList<IAccount*> result; Q_FOREACH (GlooxAccount *acc, Accounts_) result << static_cast<IAccount*> (acc); return result; }
void PackagesDelegate::handleRowActionFinished (int row) { // Front — deepest proxy, back — outermost. QList<QAbstractProxyModel*> proxyChain; QAbstractItemModel *realModel = Model_; QAbstractProxyModel *proxy = 0; while ((proxy = qobject_cast<QAbstractProxyModel*> (realModel))) { proxyChain.push_front (proxy); realModel = proxy->sourceModel (); } QModelIndex index = realModel->index (row, 0); Q_FOREACH (QAbstractProxyModel *pm, proxyChain) index = pm->mapFromSource (index); row = index.row (); if (Row2InstallRemove_.contains (row)) { Row2InstallRemove_ [row]->setChecked (false); Row2InstallRemove_ [row]->defaultAction ()->setChecked (false); Row2InstallRemove_ [row]->setChecked (false); } if (Row2Update_.contains (row)) { Row2Update_ [row]->defaultAction ()->setChecked (false); } }
void NetworkManager::disconnectServices() { if (m_manager) { disconnect(m_manager, SIGNAL(ServicesChanged(ConnmanObjectList,QList<QDBusObjectPath>)), this, SLOT(updateServices(ConnmanObjectList,QList<QDBusObjectPath>))); disconnect(m_manager, SIGNAL(SavedServicesChanged(ConnmanObjectList)), this, SLOT(updateSavedServices(ConnmanObjectList))); } Q_FOREACH (NetworkService *service, m_servicesCache) service->deleteLater(); m_servicesCache.clear(); if (m_defaultRoute != m_invalidDefaultRoute) { m_defaultRoute = m_invalidDefaultRoute; Q_EMIT defaultRouteChanged(m_defaultRoute); } if (!m_servicesOrder.isEmpty()) { m_servicesOrder.clear(); Q_EMIT servicesChanged(); } if (!m_savedServicesOrder.isEmpty()) { m_savedServicesOrder.clear(); Q_EMIT savedServicesChanged(); } }
void OPMLWriter::WriteBody (QDomElement& root, QDomDocument& doc, const channels_shorts_t& channels) const { QDomElement body = doc.createElement ("body"); for (channels_shorts_t::const_iterator i = channels.begin (), end = channels.end (); i != end; ++i) { QStringList sourceTags = i->Tags_; QStringList tags; Q_FOREACH (QString st, sourceTags) tags << Core::Instance ().GetProxy ()->GetTagsManager ()->GetTag (st); tags.sort (); QDomElement inserter; inserter = LeechCraft::Util::GetElementForTags (tags, body, doc, "outline", boost::function<QString (const QDomElement&)> (TagGetter), boost::function<void (QDomElement&, const QString&)> (TagSetter)); QDomElement item = doc.createElement ("outline"); item.setAttribute ("title", i->Title_); Feed_ptr feed = Core::Instance ().GetStorageBackend ()-> GetFeed (i->FeedID_); item.setAttribute ("xmlUrl", feed->URL_); item.setAttribute ("htmlUrl", i->Link_); inserter.appendChild (item); } root.appendChild (body); }
void KeyframeModel::initJointDisplay(QWidget* widget) { Q_FOREACH(QObject* obj, widget->children()) obj->deleteLater(); if(widget->layout()) delete widget->layout(); QVBoxLayout* layout = new QVBoxLayout(widget); m_ikl = new InvKinBox(m_rbdl, "left_foot_link", m_motion.jointList, widget); connect(m_ikl, SIGNAL(changed()), this, SLOT(updateRobotDisplay())); layout->addWidget(m_ikl); m_ikr = new InvKinBox(m_rbdl, "right_foot_link", m_motion.jointList, widget); connect(m_ikr, SIGNAL(changed()), this, SLOT(updateRobotDisplay())); layout->addWidget(m_ikr); QWidget* jointWidget = new QWidget(widget); m_jointManager = new JointManager(jointWidget, m_motion.jointList); connect(m_jointManager, SIGNAL(positionSpinChanged()), this, SLOT(updateRobotDisplay())); connect(m_jointManager, SIGNAL(sliderChanged()), this, SLOT(updateRobotDisplay())); layout->addWidget(jointWidget); connect(m_jointManager, SIGNAL(positionSpinChanged()), m_ikl, SLOT(updateFromMotionFile())); connect(m_jointManager, SIGNAL(positionSpinChanged()), m_ikr, SLOT(updateFromMotionFile())); connect(m_jointManager, SIGNAL(sliderChanged()), m_ikl, SLOT(updateFromMotionFile())); connect(m_jointManager, SIGNAL(sliderChanged()), m_ikr, SLOT(updateFromMotionFile())); }
QList<QObject*> RoomHandler::GetParticipants () const { QList<QObject*> result; Q_FOREACH (RoomParticipantEntry_ptr rpe, Nick2Entry_.values ()) result << rpe.get (); return result; }
QVariantList QcWaveform::waveColors() const { QVariantList clist; Q_FOREACH( QColor clr, _waveColors ) clist << QVariant(clr); return clist; }
int main(int argc, char **argv) { QApplication app(argc, argv); app.setOrganizationDomain("inria.fr"); app.setOrganizationName("INRIA"); app.setApplicationName("PCA demo"); // Import resources from libCGALQt4. // See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE CGAL_QT4_INIT_RESOURCES; MainWindow mainWindow; mainWindow.show(); QStringList args = app.arguments(); args.removeAt(0); if(!args.empty() && args[0] == "--use-meta") { mainWindow.setAddKeyFrameKeyboardModifiers(::Qt::MetaModifier); args.removeAt(0); } Q_FOREACH(QString filename, args) mainWindow.open(filename); return app.exec(); }
QList<QgsAbstractLabelProvider*> QgsRuleBasedLabelProvider::subProviders() { QList<QgsAbstractLabelProvider*> lst; Q_FOREACH ( QgsVectorLayerLabelProvider* subprovider, mSubProviders.values() ) lst << subprovider; return lst; }
SvgWriter::SvgWriter(const QList<KoShapeLayer*> &layers, const QSizeF &pageSize) : m_pageSize(pageSize) , m_writeInlineImages(true) { Q_FOREACH (KoShapeLayer *layer, layers) m_toplevelShapes.append(layer); }
int main(int argc, char **argv) { QApplication app(argc, argv); app.setOrganizationDomain("inria.fr"); app.setOrganizationName("INRIA"); app.setApplicationName("AABB tree demo"); //for windows app.setAttribute(Qt::AA_UseDesktopOpenGL); // Import resources from libCGALQt (Qt5). CGAL_QT_INIT_RESOURCES; MainWindow mainWindow; mainWindow.show(); QStringList args = app.arguments(); args.removeAt(0); if(!args.empty() && args[0] == "--use-meta") { mainWindow.setAddKeyFrameKeyboardModifiers(::Qt::MetaModifier); args.removeAt(0); } Q_FOREACH(QString filename, args) mainWindow.open(filename); return app.exec(); }
void Quick3DTextureExtension::clearTextureImageList(QQmlListProperty<QAbstractTextureImage> *list) { Quick3DTextureExtension *self = qobject_cast<Quick3DTextureExtension *>(list->object); if (self) Q_FOREACH (QAbstractTextureImage *img, self->parentTexture()->textureImages()) self->parentTexture()->removeTextureImage(img); }