@@ -44,7 +44,7 @@ biblioteq_image_drop_site::biblioteq_image_drop_site(QWidget *parent):
44
44
m_doubleClickResizeEnabled = true ;
45
45
m_doubleClicked = false ;
46
46
m_image = QImage ();
47
- m_imageFormat = " " ;
47
+ m_imageFormat. clear () ;
48
48
m_readOnly = false ;
49
49
setAcceptDrops (true );
50
50
}
@@ -203,7 +203,7 @@ void biblioteq_image_drop_site::dropEvent(QDropEvent *event)
203
203
#else
204
204
if (event)
205
205
{
206
- QUrl url (event->mimeData ()->text ());
206
+ QUrl const url (event->mimeData ()->text ());
207
207
208
208
filename = url.toLocalFile ().trimmed ();
209
209
}
@@ -238,9 +238,9 @@ void biblioteq_image_drop_site::dropEvent(QDropEvent *event)
238
238
239
239
if (pixmap.isNull ())
240
240
{
241
- m_image = QImage (" :/no_image .png" );
241
+ m_image = QImage (" :/missing_image .png" );
242
242
m_imageFormat = " PNG" ;
243
- pixmap = QPixmap (" :/no_image .png" );
243
+ pixmap = QPixmap (" :/missing_image .png" );
244
244
}
245
245
246
246
scene ()->addPixmap (pixmap);
@@ -260,27 +260,12 @@ void biblioteq_image_drop_site::enableDoubleClickResize(const bool state)
260
260
261
261
void biblioteq_image_drop_site::keyPressEvent (QKeyEvent *event)
262
262
{
263
- if (acceptDrops ())
264
- if (event)
265
- {
266
- if ((QGuiApplication::keyboardModifiers () & Qt::ControlModifier) &&
267
- event->key () == Qt::Key_V)
268
- {
269
- if (!m_readOnly)
270
- {
271
- auto clipboard = QApplication::clipboard ();
272
-
273
- if (clipboard)
274
- setImage (clipboard->image ());
275
- }
276
- }
277
- else if (event->key () == Qt::Key_Backspace ||
278
- event->key () == Qt::Key_Delete)
279
- {
280
- if (!m_readOnly && !scene ()->selectedItems ().isEmpty ())
281
- clear ();
282
- }
283
- }
263
+ if (event && m_readOnly == false )
264
+ if (event->key () == Qt::Key_Backspace || event->key () == Qt::Key_Delete)
265
+ if (scene ()->selectedItems ().isEmpty () == false )
266
+ clear ();
267
+
268
+ QGraphicsView::keyPressEvent (event);
284
269
}
285
270
286
271
void biblioteq_image_drop_site::loadFromData (const QByteArray &bytes)
@@ -306,9 +291,9 @@ void biblioteq_image_drop_site::loadFromData(const QByteArray &bytes)
306
291
307
292
if (pixmap.isNull ())
308
293
{
309
- m_image = QImage (" :/no_image .png" );
294
+ m_image = QImage (" :/missing_image .png" );
310
295
m_imageFormat = " PNG" ;
311
- pixmap = QPixmap (" :/no_image .png" );
296
+ pixmap = QPixmap (" :/missing_image .png" );
312
297
}
313
298
314
299
scene ()->addPixmap (pixmap);
@@ -334,7 +319,7 @@ void biblioteq_image_drop_site::mouseDoubleClickEvent(QMouseEvent *event)
334
319
auto pixmap (QPixmap::fromImage (m_image));
335
320
336
321
if (pixmap.isNull ())
337
- pixmap = QPixmap (" :/no_image .png" );
322
+ pixmap = QPixmap (" :/missing_image .png" );
338
323
339
324
scene ()->addPixmap (pixmap);
340
325
}
@@ -347,7 +332,7 @@ void biblioteq_image_drop_site::mouseDoubleClickEvent(QMouseEvent *event)
347
332
(size (), Qt::KeepAspectRatio, Qt::SmoothTransformation);
348
333
349
334
if (pixmap.isNull ())
350
- pixmap = QPixmap (" :/no_image .png" );
335
+ pixmap = QPixmap (" :/missing_image .png" );
351
336
352
337
scene ()->addPixmap (pixmap);
353
338
}
@@ -387,9 +372,9 @@ void biblioteq_image_drop_site::setImage(const QImage &image)
387
372
388
373
if (pixmap.isNull ())
389
374
{
390
- m_image = QImage (" :/no_image .png" );
375
+ m_image = QImage (" :/missing_image .png" );
391
376
m_imageFormat = " PNG" ;
392
- pixmap = QPixmap (" :/no_image .png" );
377
+ pixmap = QPixmap (" :/missing_image .png" );
393
378
}
394
379
395
380
scene ()->addPixmap (pixmap);
0 commit comments