void QSGRenderer::setRootNode(QSGRootNode *node) { if (m_root_node == node) return; if (m_root_node) { m_root_node->m_renderers.removeOne(this); nodeChanged(m_root_node, QSGNode::DirtyNodeRemoved); } m_root_node = node; if (m_root_node) { Q_ASSERT(!m_root_node->m_renderers.contains(this)); m_root_node->m_renderers << this; nodeChanged(m_root_node, QSGNode::DirtyNodeAdded); } }
/*! Sets the \a node as the root of the QSGNode scene that you want to render. You need to provide a \a node before trying to render the scene. \note This doesn't take ownership of \a node. \sa rootNode() */ void QSGAbstractRenderer::setRootNode(QSGRootNode *node) { Q_D(QSGAbstractRenderer); if (d->m_root_node == node) return; if (d->m_root_node) { d->m_root_node->m_renderers.removeOne(this); nodeChanged(d->m_root_node, QSGNode::DirtyNodeRemoved); } d->m_root_node = node; if (d->m_root_node) { Q_ASSERT(!d->m_root_node->m_renderers.contains(this)); d->m_root_node->m_renderers << this; nodeChanged(d->m_root_node, QSGNode::DirtyNodeAdded); } }
void FilterTreeBranch<T>::deleteAt(int i) { preRemoveChild(this, i); delete childNodes.takeAt(i); postRemoveChild(this, i); nodeChanged(); }
void GameUI::updateChangedNode(MythGenericTree *node, RomInfo *romInfo) { resetOtherTrees(node); if (node->getParent() == m_favouriteNode && romInfo->Favorite() == 0) { // node is being removed m_gameUITree->SetCurrentNode(m_favouriteNode); } else nodeChanged(node); }
void DefaultTreeModel::changed(ConstFieldMaskArg whichField, UInt32 origin, BitVector details) { Inherited::changed(whichField, origin, details); if(whichField & InternalRootFieldMask) { nodeChanged(getInternalRoot()); } }
void DefaultTreeModel::insertNodeInto(MutableTreeNodeRefPtr newChild, MutableTreeNodeRefPtr parent, const UInt32& index) { parent->insert(newChild, index); std::vector<UInt32> Indices; Indices.push_back(index); nodesWereInserted(parent, Indices); if(parent->getChildCount() == 1) { nodeChanged(parent); } }
int PolyLine::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = KTToolPlugin::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: nodeChanged(); break; default: ; } _id -= 1; } return _id; }
bool MythUIButtonTree::DoSetCurrentNode(MythGenericTree *node) { if (node) { if (node == m_currentNode) return true; m_currentNode = node; node->becomeSelectedChild(); emit nodeChanged(m_currentNode); return true; } return false; }
void DefinitionWatcher::startWatching(const DefinitionNode *node, bool init_diff) { if (auto diff_manager = node->getRoot()->getDiffManager()) { if (init_diff) { vector<const DefinitionDiff *> diffs; node->generateInitDiffs(&diffs); for (auto diff : diffs) { nodeChanged(node, diff, node); delete diff; } } diff_manager->addWatcher(node, this); registered_to.insert(diff_manager); } }
void DefaultTreeModel::removeNodeFromParent(MutableTreeNodeRefPtr node) { ModelTreeNodeRefPtr Parent = node->getParent(); std::vector<UInt32> ChildIndicies; ChildIndicies.push_back(Parent->getIndex(node)); std::vector<boost::any> Children; Children.push_back(dynamic_pointer_cast<ModelTreeNode>(node)); produceTreeNodesWillBeRemoved(getPath(boost::any(Parent)), ChildIndicies, Children); node->removeFromParent(); produceTreeNodesRemoved(getPath(boost::any(Parent)), ChildIndicies, Children); if(Parent->getChildCount() == 0) { nodeChanged(Parent); } }
FilterTreeNode *FilterItemList::termNode(const QString &term) { int i, count; FilterItem *fi; i = termIndex(term); if (i < 0) { fi = new FilterItem(term, this); count = childNodes.count(); preInsertChild(this, count); childNodes.append(fi); postInsertChild(this, count); nodeChanged(); return fi; } return childNodes.at(i); }
FilterItemList *LogicMap::typeList(CardFilter::Type type) { QList<FilterItemList *>::iterator i; int count; count = 0; for (i = childNodes.begin(); i != childNodes.end(); i++) { if ((*i)->type == type) break; count++; } if (i == childNodes.end()) { preInsertChild(this, count); i = childNodes.insert(i, new FilterItemList(type, this)); postInsertChild(this, count); nodeChanged(); } return *i; }
LogicMap *FilterTree::attrLogicMap(CardFilter::Attr attr) { QList<LogicMap *>::iterator i; int count; count = 0; for (i = childNodes.begin(); i != childNodes.end(); i++) { if ((*i)->attr == attr) break; count++; } if (i == childNodes.end()) { preInsertChild(this, count); i = childNodes.insert(i, new LogicMap(attr, this)); postInsertChild(this, count); nodeChanged(); } return *i; }
void OssiaImpulse::setNode(QString node) { if(!publisher_singleton) return; if (m_node == node) return; m_node = node; if(m_ossia_node) { auto par = m_ossia_node->getParent(); auto& cld = par->children(); auto it = std::find(cld.begin(), cld.end(), m_ossia_node); if(it != cld.end()) par->erase(it); } m_ossia_node = getOrCreateNode( publisher_singleton->_localDevice, node.split('/')); if(auto addr = m_ossia_node->getAddress()) { m_address = addr; } else { m_address = m_ossia_node->createAddress(OSSIA::Value::Type::IMPULSE); m_address->addCallback([=] (const OSSIA::Value* val) { emit impulse(); }); } emit nodeChanged(node); }
void qml_node::resetNode() { if(m_was_destroyed) return; m_node.clear(); nodeChanged(m_node); const bool reading = m_device ? m_device->readPreset() : false; reset_parent(); // Creation may not have finished yet. if (m_parentNode && !m_parentNode->ossiaNode()) { m_parentNode->resetNode(); } if (m_device) { // Utility function to set-up a node. auto setup_valid_node = [&] { m_ossia_node->about_to_be_deleted .connect<&qml_node::on_node_deleted>(this); m_node = QString::fromStdString(m_ossia_node->get_name()); nodeChanged(m_node); setPath(QString::fromStdString( ossia::net::address_string_from_node(*m_ossia_node))); applyNodeAttributes(); }; std::string node_name; bool relative = false; // Naming logic if (m_userRequestedNode.isEmpty()) { if (auto par = this->parent()) { node_name = par->objectName().toStdString(); if (node_name.empty()) node_name = par->metaObject()->className(); } if (node_name.empty()) node_name = "Object"; relative = true; } else if (m_userRequestedNode[0] != '/') { relative = true; node_name = m_userRequestedNode.toStdString(); } else if (m_userRequestedNode == QStringLiteral("/")) { m_ossia_node = &m_device->device().get_root_node(); setup_valid_node(); return; } else { node_name = m_userRequestedNode.toStdString(); } // Find the node auto get_parent = [&]() -> ossia::net::node_base& { if (m_parentNode && m_parentNode->ossiaNode()) return *m_parentNode->ossiaNode(); if (relative) { return findClosestParent( this->parent(), m_device->device().get_root_node()); } else { return m_device->device().get_root_node(); } }; ossia::net::node_base& parent = get_parent(); if (reading) { m_ossia_node = ossia::net::find_node(parent, node_name); if (m_ossia_node) { setup_valid_node(); } else { setPath({}); } } else { m_ossia_node = &ossia::net::create_node(parent, node_name); setup_valid_node(); } return; } // In case something went wrong... setPath({}); }
void GameUI::BuildTree() { m_gameTree = new MythGenericTree("game root", 0, false); // create system filter to only select games where handlers are present QString systemFilter; // The call to GameHandler::count() fills the handler list for us // to move through. unsigned handlercount = GameHandler::count(); for (unsigned i = 0; i < handlercount; ++i) { QString system = GameHandler::getHandler(i)->SystemName(); if (i == 0) systemFilter = "system in ('" + system + "'"; else systemFilter += ",'" + system + "'"; } if (systemFilter.isEmpty()) { systemFilter = "1=0"; LOG(VB_GENERAL, LOG_ERR, QString("Couldn't find any game handlers!")); } else systemFilter += ")"; m_showHashed = gCoreContext->GetSetting("GameTreeView").toInt(); // create a few top level nodes - this could be moved to a config based // approach with multiple roots if/when someone has the time to create // the relevant dialog screens QString levels = gCoreContext->GetSetting("GameFavTreeLevels"); MythGenericTree *new_node = new MythGenericTree(tr("Favorites"), 1, true); new_node->SetData(qVariantFromValue( new GameTreeInfo(levels, systemFilter + " and favorite=1"))); m_favouriteNode = m_gameTree->addNode(new_node); levels = gCoreContext->GetSetting("GameAllTreeLevels"); if (m_showHashed) { int pos = levels.indexOf("gamename"); if (pos >= 0) levels.insert(pos, " hash "); } new_node = new MythGenericTree(tr("All Games"), 1, true); new_node->SetData(qVariantFromValue( new GameTreeInfo(levels, systemFilter))); m_gameTree->addNode(new_node); new_node = new MythGenericTree(tr("- By Genre"), 1, true); new_node->SetData(qVariantFromValue( new GameTreeInfo("genre gamename", systemFilter))); m_gameTree->addNode(new_node); new_node = new MythGenericTree(tr("- By Year"), 1, true); new_node->SetData(qVariantFromValue( new GameTreeInfo("year gamename", systemFilter))); m_gameTree->addNode(new_node); new_node = new MythGenericTree(tr("- By Name"), 1, true); new_node->SetData(qVariantFromValue( new GameTreeInfo("gamename", systemFilter))); m_gameTree->addNode(new_node); new_node = new MythGenericTree(tr("- By Publisher"), 1, true); new_node->SetData(qVariantFromValue( new GameTreeInfo("publisher gamename", systemFilter))); m_gameTree->addNode(new_node); m_gameUITree->AssignTree(m_gameTree); nodeChanged(m_gameUITree->GetCurrentNode()); }
void OSGNode::emitNodeChanged() { if (h->complete) { emit nodeChanged(node()); } }