Avoid trailing line breaks

master
Andrei Kortunov 1 month ago
parent f0543c5500
commit bd59247270

@ -252,17 +252,17 @@ void Launcher::DataFilesPage::buildView()
void Launcher::DataFilesPage::slotCopySelectedItemsPaths() void Launcher::DataFilesPage::slotCopySelectedItemsPaths()
{ {
QClipboard* clipboard = QApplication::clipboard(); QClipboard* clipboard = QApplication::clipboard();
QString filepaths; QStringList filepaths;
for (QListWidgetItem* item : ui.directoryListWidget->selectedItems()) for (QListWidgetItem* item : ui.directoryListWidget->selectedItems())
{ {
QString path = qvariant_cast<Config::SettingValue>(item->data(Qt::UserRole)).originalRepresentation; QString path = qvariant_cast<Config::SettingValue>(item->data(Qt::UserRole)).originalRepresentation;
filepaths += path + "\n"; filepaths.push_back(path);
} }
if (!filepaths.isEmpty()) if (!filepaths.isEmpty())
{ {
clipboard->setText(filepaths); clipboard->setText(filepaths.join("\n"));
} }
} }

@ -320,17 +320,17 @@ void ContentSelectorView::ContentSelector::slotCheckMultiSelectedItems()
void ContentSelectorView::ContentSelector::slotCopySelectedItemsPaths() void ContentSelectorView::ContentSelector::slotCopySelectedItemsPaths()
{ {
QClipboard* clipboard = QApplication::clipboard(); QClipboard* clipboard = QApplication::clipboard();
QString filepaths; QStringList filepaths;
for (const QModelIndex& index : ui->addonView->selectionModel()->selectedIndexes()) for (const QModelIndex& index : ui->addonView->selectionModel()->selectedIndexes())
{ {
int row = mAddonProxyModel->mapToSource(index).row(); int row = mAddonProxyModel->mapToSource(index).row();
const ContentSelectorModel::EsmFile* file = mContentModel->item(row); const ContentSelectorModel::EsmFile* file = mContentModel->item(row);
filepaths += file->filePath() + "\n"; filepaths.push_back(file->filePath());
} }
if (!filepaths.isEmpty()) if (!filepaths.isEmpty())
{ {
clipboard->setText(filepaths); clipboard->setText(filepaths.join("\n"));
} }
} }

Loading…
Cancel
Save