395 } |
395 } |
396 |
396 |
397 ui->quickColorList->addItem (item); |
397 ui->quickColorList->addItem (item); |
398 quickColorItems << item; |
398 quickColorItems << item; |
399 |
399 |
400 if (sel && &entry == sel) |
400 if (sel and &entry == sel) |
401 { |
401 { |
402 ui->quickColorList->setCurrentItem (item); |
402 ui->quickColorList->setCurrentItem (item); |
403 ui->quickColorList->scrollToItem (item); |
403 ui->quickColorList->scrollToItem (item); |
404 } |
404 } |
405 } |
405 } |
475 |
475 |
476 QListWidgetItem* item = ui->quickColorList->selectedItems() [0]; |
476 QListWidgetItem* item = ui->quickColorList->selectedItems() [0]; |
477 int idx = getItemRow (item, quickColorItems); |
477 int idx = getItemRow (item, quickColorItems); |
478 int dest = up ? (idx - 1) : (idx + 1); |
478 int dest = up ? (idx - 1) : (idx + 1); |
479 |
479 |
480 if (dest < 0 || dest >= quickColorItems.size()) |
480 if (dest < 0 or dest >= quickColorItems.size()) |
481 return; // destination out of bounds |
481 return; // destination out of bounds |
482 |
482 |
483 LDQuickColor tmp = quickColors[dest]; |
483 LDQuickColor tmp = quickColors[dest]; |
484 quickColors[dest] = quickColors[idx]; |
484 quickColors[dest] = quickColors[idx]; |
485 quickColors[idx] = tmp; |
485 quickColors[idx] = tmp; |