MCPcopy Create free account
hub / github.com/KDE/labplot / keyPressEvent

Method keyPressEvent

src/frontend/datapicker/DatapickerImageView.cpp:357–377  ·  view source on GitHub ↗

############################################################################## #################################### Events ############################### ##############################################################################

Source from the content-addressed store, hash-verified

355// #################################### Events ###############################
356// ##############################################################################
357void DatapickerImageView::keyPressEvent(QKeyEvent* event) {
358 if (event->matches(QKeySequence::Paste)) {
359 const QClipboard* clipboard = QApplication::clipboard();
360 const QMimeData* mimeData = clipboard->mimeData();
361 if (mimeData->hasImage()) {
362 m_image->setImage(qvariant_cast<QImage>(mimeData->imageData()), QStringLiteral(""), true);
363 event->accept();
364 } else if (mimeData->hasText()) {
365 // Check if it is a filepath
366 QString text = mimeData->text();
367 if (text.startsWith(QStringLiteral("file://")))
368 text.replace(QStringLiteral("file://"), QStringLiteral(""));
369 QFileInfo fi(text);
370 if (fi.exists()) {
371 m_image->setImage(fi.absoluteFilePath(), true);
372 event->accept();
373 }
374 }
375 }
376 QGraphicsView::keyPressEvent(event);
377}
378
379void DatapickerImageView::wheelEvent(QWheelEvent* event) {
380 // https://wiki.qt.io/Smooth_Zoom_In_QGraphicsView

Callers

nothing calls this directly

Calls 5

setImageMethod · 0.80
acceptMethod · 0.80
replaceMethod · 0.80
existsMethod · 0.80
textMethod · 0.45

Tested by

no test coverage detected