diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2019-06-09 17:05:51 -0400 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2019-06-15 14:40:40 -0400 |
| commit | 5fa7fd7fb9f3a8f67e8842420d7a2ad600722119 (patch) | |
| tree | b430028b757695c649fa74a84978802ad44d1fb3 /src/editexecutablesdialog.cpp | |
| parent | cbe6dd93b1607f9b95037c2e131f34c27d32753d (diff) | |
moved add/remove to the top, changed them to tool buttons with icons, added up/down buttons
Diffstat (limited to 'src/editexecutablesdialog.cpp')
| -rw-r--r-- | src/editexecutablesdialog.cpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/editexecutablesdialog.cpp b/src/editexecutablesdialog.cpp index 96f4660a..9747a86f 100644 --- a/src/editexecutablesdialog.cpp +++ b/src/editexecutablesdialog.cpp @@ -348,6 +348,44 @@ void EditExecutablesDialog::save() } } +void EditExecutablesDialog::moveSelection(int by) +{ + auto* item = selectedItem(); + if (!item) { + return; + } + + // moving down the list + while (by > 0) { + const auto row = ui->list->row(item); + + if (row >= (ui->list->count() - 1)) { + break; + } + + ui->list->takeItem(row); + ui->list->insertItem(row + 1, item); + item->setSelected(true); + + --by; + } + + // moving up the list + while (by < 0) { + const auto row = ui->list->row(item); + + if (row <= 0) { + break; + } + + ui->list->takeItem(row); + ui->list->insertItem(row - 1, item); + item->setSelected(true); + + ++by; + } +} + void EditExecutablesDialog::on_list_itemSelectionChanged() { updateUI(selectedExe()); @@ -408,6 +446,16 @@ void EditExecutablesDialog::on_remove_clicked() } } +void EditExecutablesDialog::on_up_clicked() +{ + moveSelection(-1); +} + +void EditExecutablesDialog::on_down_clicked() +{ + moveSelection(+1); +} + bool EditExecutablesDialog::isTitleConflicting(const QString& s) { for (const auto& exe : m_executablesList) { |
