409 } |
409 } |
410 else |
410 else |
411 { |
411 { |
412 ColorToolbarItem newentry (value, nullptr); |
412 ColorToolbarItem newentry (value, nullptr); |
413 item = getSelectedQuickColor(); |
413 item = getSelectedQuickColor(); |
414 int idx = (item) ? getItemRow (item, quickColorItems) + 1 : quickColorItems.size(); |
414 int idx = (item) ? getItemRow (item, quickColorItems) + 1 : length(quickColorItems); |
415 quickColors.insert (idx, newentry); |
415 quickColors.insert (idx, newentry); |
416 entry = &quickColors[idx]; |
416 entry = &quickColors[idx]; |
417 } |
417 } |
418 |
418 |
419 updateQuickColorList (entry); |
419 updateQuickColorList (entry); |
444 |
444 |
445 QListWidgetItem* item = ui.quickColorList->selectedItems() [0]; |
445 QListWidgetItem* item = ui.quickColorList->selectedItems() [0]; |
446 int idx = getItemRow (item, quickColorItems); |
446 int idx = getItemRow (item, quickColorItems); |
447 int dest = up ? (idx - 1) : (idx + 1); |
447 int dest = up ? (idx - 1) : (idx + 1); |
448 |
448 |
449 if (dest < 0 or dest >= quickColorItems.size()) |
449 if (dest < 0 or dest >= length(quickColorItems)) |
450 return; // destination out of bounds |
450 return; // destination out of bounds |
451 |
451 |
452 qSwap (quickColors[dest], quickColors[idx]); |
452 qSwap (quickColors[dest], quickColors[idx]); |
453 updateQuickColorList (&quickColors[dest]); |
453 updateQuickColorList (&quickColors[dest]); |
454 } |
454 } |
458 // Add a separator to quick colors |
458 // Add a separator to quick colors |
459 // |
459 // |
460 void ConfigDialog::slot_addColorSeparator() |
460 void ConfigDialog::slot_addColorSeparator() |
461 { |
461 { |
462 quickColors << ColorToolbarItem::makeSeparator(); |
462 quickColors << ColorToolbarItem::makeSeparator(); |
463 updateQuickColorList (&quickColors[quickColors.size() - 1]); |
463 updateQuickColorList (&quickColors[length(quickColors) - 1]); |
464 } |
464 } |
465 |
465 |
466 // |
466 // |
467 // |
467 // |
468 // Clear all quick colors |
468 // Clear all quick colors |