mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-06-29 01:54:20 +03:00
Move shortcut connection to constructor
Add copy functionality for changelog on ResourceUpdateDialog Signed-off-by: Dylan Schooner <dschooner05@gmail.com>
This commit is contained in:
parent
6f4460b604
commit
a16026828e
2 changed files with 21 additions and 40 deletions
|
|
@ -482,6 +482,7 @@ void ResourceUpdateDialog::appendResource(CheckUpdateTask::Update const& info, Q
|
|||
auto changelog_area = new QTextBrowser();
|
||||
|
||||
QString text = info.changelog;
|
||||
changelog->setData(0, Qt::UserRole, text);
|
||||
if (info.provider == ModPlatform::ResourceProvider::MODRINTH) {
|
||||
text = markdownToHTML(info.changelog.toUtf8());
|
||||
}
|
||||
|
|
@ -494,26 +495,6 @@ void ResourceUpdateDialog::appendResource(CheckUpdateTask::Update const& info, Q
|
|||
ui->modTreeWidget->setItemWidget(changelog, 0, changelog_area);
|
||||
|
||||
ui->modTreeWidget->addTopLevelItem(item_top);
|
||||
|
||||
// Overwrite Ctrl+C functionality to exclude the label when copying text from tree
|
||||
auto shortcut = new QShortcut(QKeySequence::Copy, ui->modTreeWidget);
|
||||
connect(shortcut, &QShortcut::activated, [this]() {
|
||||
auto currentItem = this->ui->modTreeWidget->currentItem();
|
||||
if (!currentItem)
|
||||
return;
|
||||
auto currentColumn = this->ui->modTreeWidget->currentColumn();
|
||||
|
||||
auto data = currentItem->data(currentColumn, Qt::UserRole);
|
||||
QString txt;
|
||||
|
||||
if (data.isValid()) {
|
||||
txt = data.toString();
|
||||
} else {
|
||||
txt = currentItem->text(currentColumn);
|
||||
}
|
||||
|
||||
QApplication::clipboard()->setText(txt);
|
||||
});
|
||||
}
|
||||
|
||||
auto ResourceUpdateDialog::getTasks() -> const QList<ResourceDownloadTask::Ptr>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue