| 119 | } |
| 120 | |
| 121 | QVariant ComponentsNode::data(const QModelIndex& index, int role) const |
| 122 | { |
| 123 | if (!name.isEmpty()) { |
| 124 | if (role == Qt::DisplayRole && index.column() == 0) |
| 125 | return name; |
| 126 | return {}; |
| 127 | } |
| 128 | |
| 129 | static const QStringList mountType(GbrObj::tr("TH|SMD|BGA|Other").split('|')); |
| 130 | if (role == Qt::DisplayRole) { |
| 131 | switch (index.column()) { |
| 132 | case 0: /* <field> Manufacturer. */ |
| 133 | return component.refdes(); |
| 134 | case 1: /* <field> Manufacturer part number. */ |
| 135 | return component.manufacturer().partNumber; |
| 136 | case 2: /* <field> E.g. 220nF. */ |
| 137 | return component.value(); |
| 138 | case 3: /* (TH|SMD|BGA|Other) Mount type. */ |
| 139 | return mountType.value(component.mount()); |
| 140 | case 4: /* <field> Footprint name. It is strongly recommended to comply with the IPC-7351 footprint names and pin numbering for all standard components. */ |
| 141 | return component.footprintName(); |
| 142 | case 5: /* <field> Package name. It is strongly recommended to comply with the JEDEC JEP95 standard. */ |
| 143 | return component.package().name; |
| 144 | case 6: /* <field> Package description. */ |
| 145 | return component.package().description; |
| 146 | case 7: /* <decimal> Height, in the unit of the file. */ |
| 147 | return component.height(); |
| 148 | default: |
| 149 | return {}; |
| 150 | } |
| 151 | } |
| 152 | return {}; |
| 153 | } |
| 154 | |
| 155 | int ComponentsNode::childCount() const { return childItems.count(); } |
| 156 | } |
no test coverage detected