improve clipboard processing

This commit is contained in:
Syping 2018-06-29 08:02:28 +02:00
parent 25c64b7f5d
commit 0127bc61e6

View file

@ -1424,14 +1424,26 @@ bool ProfileInterface::eventFilter(QObject *watched, QEvent *event)
case Qt::Key_V:
if (QApplication::keyboardModifiers().testFlag(Qt::ControlModifier) && !QApplication::keyboardModifiers().testFlag(Qt::ShiftModifier))
{
QImage clipboardImage = QApplication::clipboard()->image();
if (!clipboardImage.isNull())
const QMimeData *clipboardData = QApplication::clipboard()->mimeData();
if (clipboardData->hasImage())
{
QImage *snapmaticImage = new QImage(clipboardImage);
QImage *snapmaticImage = new QImage(qvariant_cast<QImage>(clipboardData->imageData()));
importImage(snapmaticImage, QDateTime::currentDateTime());
}
QUrl clipboardUrl = QUrl::fromUserInput(QApplication::clipboard()->text());
if (clipboardUrl.isValid())
else if (clipboardData->hasUrls())
{
if (clipboardData->urls().length() >= 2)
{
on_saProfileContent_dropped(clipboardData); // replace later with own function importUrls()
}
else if (clipboardData->urls().length() == 1)
{
QUrl clipboardUrl = clipboardData->urls().at(0);
if (clipboardUrl.isLocalFile())
{
importFile(clipboardUrl.toLocalFile(), QDateTime::currentDateTime(), true);
}
else
{
QDialog urlPasteDialog(this);
#if QT_VERSION >= 0x050000
@ -1504,6 +1516,8 @@ bool ProfileInterface::eventFilter(QObject *watched, QEvent *event)
}
}
}
}
}
else if (event->type() == QEvent::MouseMove)
{
if ((watched->objectName() == "SavegameWidget" || watched->objectName() == "SnapmaticWidget") && isProfileLoaded)