NOISSUE Implemented copy screenshots to the clipboard
- Added context-menu entry - Ctrl+C keybind works as well - If multiple screenshots are selected, only the first one gets copied
This commit is contained in:
@ -250,6 +250,12 @@ bool ScreenshotsPage::eventFilter(QObject *obj, QEvent *evt)
|
||||
return QWidget::eventFilter(obj, evt);
|
||||
}
|
||||
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(evt);
|
||||
|
||||
if (keyEvent->matches(QKeySequence::Copy)) {
|
||||
on_actionCopy_triggered();
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (keyEvent->key())
|
||||
{
|
||||
case Qt::Key_Delete:
|
||||
@ -372,6 +378,22 @@ void ScreenshotsPage::on_actionUpload_triggered()
|
||||
m_uploadActive = false;
|
||||
}
|
||||
|
||||
void ScreenshotsPage::on_actionCopy_triggered()
|
||||
{
|
||||
auto selection = ui->listView->selectionModel()->selectedRows();
|
||||
if(selection.size() < 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// You can only copy one image to the clipboard. In the case of multiple selected files, only the first one gets copied.
|
||||
auto item = selection[0];
|
||||
auto info = m_model->fileInfo(item);
|
||||
QImage image(info.absoluteFilePath());
|
||||
Q_ASSERT(!image.isNull());
|
||||
QApplication::clipboard()->setImage(image, QClipboard::Clipboard);
|
||||
}
|
||||
|
||||
void ScreenshotsPage::on_actionDelete_triggered()
|
||||
{
|
||||
auto mbox = CustomMessageBox::selectable(
|
||||
|
Reference in New Issue
Block a user