| 181 | } |
| 182 | |
| 183 | void MainWindow::loadConfigLabels() { |
| 184 | _isLoadingNewLabels = true; |
| 185 | list_label->clear(); |
| 186 | QMapIterator<QString, LabelInfo> it(labels); |
| 187 | while (it.hasNext()) { |
| 188 | it.next(); |
| 189 | const LabelInfo & label = it.value(); |
| 190 | QListWidgetItem * item = new QListWidgetItem(list_label); |
| 191 | LabelWidget * label_widget = new LabelWidget(label,this); |
| 192 | |
| 193 | item->setSizeHint(label_widget->sizeHint()); |
| 194 | item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); |
| 195 | list_label->addItem(item); |
| 196 | list_label->setItemWidget(item, label_widget); |
| 197 | |
| 198 | auto& ref = labels[it.key()]; |
| 199 | ref.item = item; |
| 200 | |
| 201 | int id = list_label->row(item); |
| 202 | |
| 203 | if (id < 40) { |
| 204 | QShortcut * shortcut = _shortcuts.at(id); |
| 205 | QString text = label.name + " (" + shortcut->key().toString() + ")"; |
| 206 | label_widget->setText(text); |
| 207 | } |
| 208 | } |
| 209 | id_labels = getId2Label(labels); |
| 210 | _isLoadingNewLabels = false; |
| 211 | } |
| 212 | |
| 213 | void MainWindow::changeColor(QListWidgetItem* item) { |
| 214 | LabelWidget * widget = static_cast<LabelWidget*>(list_label->itemWidget(item)); |
nothing calls this directly
no test coverage detected