void DeviceExplorerModel::debug_printIndexes(const QModelIndexList& indexes) { std::cerr << "indexes: " << indexes.size() << " nodes: \n"; foreach(const QModelIndex & index, indexes) { if(index.isValid()) { std::cerr << " index.row=" << index.row() << " col=" << index.column() << " "; Device::Node* n = &nodeFromModelIndex(index); std::cerr << " n=" << n << " "; Device::Node* parent = n->parent(); if(n == &m_rootNode) { std::cerr << " rootNode parent=" << parent << "\n"; } else { std::cerr << " n->name=" << n->displayName().toStdString(); std::cerr << " parent=" << parent; std::cerr << " parent->name=" << parent->displayName().toStdString() << "\n"; } } else { std::cerr << " invalid index \n"; } } }
QVariant nameColumnData(const Device::Node& node, int role) { static const QFont italicFont{[] () { QFont f; f.setItalic(true); return f; }()}; using namespace iscore; const Device::IOType ioType = node.get<Device::AddressSettings>().ioType; switch(role) { case Qt::DisplayRole: case Qt::EditRole: return node.displayName(); case Qt::FontRole: { if(ioType == IOType::In || ioType == IOType::Out) { return italicFont; } } case Qt::ForegroundRole: { if(ioType == IOType::In || ioType == IOType::Out) { return QBrush(Qt::lightGray); } } default: return {}; } }