improve clipboard processing
This commit is contained in:
parent
25c64b7f5d
commit
0127bc61e6
1 changed files with 78 additions and 64 deletions
|
@ -1424,14 +1424,26 @@ bool ProfileInterface::eventFilter(QObject *watched, QEvent *event)
|
||||||
case Qt::Key_V:
|
case Qt::Key_V:
|
||||||
if (QApplication::keyboardModifiers().testFlag(Qt::ControlModifier) && !QApplication::keyboardModifiers().testFlag(Qt::ShiftModifier))
|
if (QApplication::keyboardModifiers().testFlag(Qt::ControlModifier) && !QApplication::keyboardModifiers().testFlag(Qt::ShiftModifier))
|
||||||
{
|
{
|
||||||
QImage clipboardImage = QApplication::clipboard()->image();
|
const QMimeData *clipboardData = QApplication::clipboard()->mimeData();
|
||||||
if (!clipboardImage.isNull())
|
if (clipboardData->hasImage())
|
||||||
{
|
{
|
||||||
QImage *snapmaticImage = new QImage(clipboardImage);
|
QImage *snapmaticImage = new QImage(qvariant_cast<QImage>(clipboardData->imageData()));
|
||||||
importImage(snapmaticImage, QDateTime::currentDateTime());
|
importImage(snapmaticImage, QDateTime::currentDateTime());
|
||||||
}
|
}
|
||||||
QUrl clipboardUrl = QUrl::fromUserInput(QApplication::clipboard()->text());
|
else if (clipboardData->hasUrls())
|
||||||
if (clipboardUrl.isValid())
|
{
|
||||||
|
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);
|
QDialog urlPasteDialog(this);
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
|
@ -1504,6 +1516,8 @@ bool ProfileInterface::eventFilter(QObject *watched, QEvent *event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (event->type() == QEvent::MouseMove)
|
else if (event->type() == QEvent::MouseMove)
|
||||||
{
|
{
|
||||||
if ((watched->objectName() == "SavegameWidget" || watched->objectName() == "SnapmaticWidget") && isProfileLoaded)
|
if ((watched->objectName() == "SavegameWidget" || watched->objectName() == "SnapmaticWidget") && isProfileLoaded)
|
||||||
|
|
Loading…
Reference in a new issue