Mercurial > hg > svgui
comparison view/Pane.cpp @ 663:1a0fdad4af4d tonioni
Merge from the default branch
author | Chris Cannam |
---|---|
date | Fri, 12 Jul 2013 13:25:22 +0100 |
parents | 8663a831838f 7cb6112c59ca |
children | 917039d333bb |
comparison
equal
deleted
inserted
replaced
660:8663a831838f | 663:1a0fdad4af4d |
---|---|
38 #include <QBitmap> | 38 #include <QBitmap> |
39 #include <QDragEnterEvent> | 39 #include <QDragEnterEvent> |
40 #include <QDropEvent> | 40 #include <QDropEvent> |
41 #include <QCursor> | 41 #include <QCursor> |
42 #include <QTextStream> | 42 #include <QTextStream> |
43 #include <QMimeData> | |
43 | 44 |
44 #include <iostream> | 45 #include <iostream> |
45 #include <cmath> | 46 #include <cmath> |
46 | 47 |
47 //!!! for HUD -- pull out into a separate class | 48 //!!! for HUD -- pull out into a separate class |
1122 | 1123 |
1123 int sw = 0; | 1124 int sw = 0; |
1124 if (m_manager && m_manager->shouldShowVerticalScale()) { | 1125 if (m_manager && m_manager->shouldShowVerticalScale()) { |
1125 for (LayerList::iterator vi = m_layers.end(); vi != m_layers.begin(); ) { | 1126 for (LayerList::iterator vi = m_layers.end(); vi != m_layers.begin(); ) { |
1126 --vi; | 1127 --vi; |
1127 QPainter paint(image); | |
1128 sw = (*vi)->getVerticalScaleWidth | 1128 sw = (*vi)->getVerticalScaleWidth |
1129 (this, m_manager->shouldShowVerticalColourScale(), paint); | 1129 (this, m_manager->shouldShowVerticalColourScale(), paint); |
1130 break; | 1130 break; |
1131 } | 1131 } |
1132 } | 1132 } |
1538 return; | 1538 return; |
1539 } | 1539 } |
1540 | 1540 |
1541 // std::cerr << "mouseMoveEvent" << std::endl; | 1541 // std::cerr << "mouseMoveEvent" << std::endl; |
1542 | 1542 |
1543 updateContextHelp(&e->pos()); | 1543 QPoint pos = e->pos(); |
1544 updateContextHelp(&pos); | |
1544 | 1545 |
1545 if (m_navigating && m_clickedInRange && !m_releasing) { | 1546 if (m_navigating && m_clickedInRange && !m_releasing) { |
1546 | 1547 |
1547 // if no buttons pressed, and not called from | 1548 // if no buttons pressed, and not called from |
1548 // mouseReleaseEvent, we want to reset clicked-ness (to avoid | 1549 // mouseReleaseEvent, we want to reset clicked-ness (to avoid |
2372 std::cerr << "dragEnterEvent: format: " | 2373 std::cerr << "dragEnterEvent: format: " |
2373 << formats.join(",").toStdString() | 2374 << formats.join(",").toStdString() |
2374 << ", possibleActions: " << e->possibleActions() | 2375 << ", possibleActions: " << e->possibleActions() |
2375 << ", proposedAction: " << e->proposedAction() << std::endl; | 2376 << ", proposedAction: " << e->proposedAction() << std::endl; |
2376 | 2377 |
2377 if (e->provides("text/uri-list") || e->provides("text/plain")) { | 2378 if (e->mimeData()->hasFormat("text/uri-list") || |
2379 e->mimeData()->hasFormat("text/plain")) { | |
2378 | 2380 |
2379 if (e->proposedAction() & Qt::CopyAction) { | 2381 if (e->proposedAction() & Qt::CopyAction) { |
2380 e->acceptProposedAction(); | 2382 e->acceptProposedAction(); |
2381 } else { | 2383 } else { |
2382 e->setDropAction(Qt::CopyAction); | 2384 e->setDropAction(Qt::CopyAction); |
2389 Pane::dropEvent(QDropEvent *e) | 2391 Pane::dropEvent(QDropEvent *e) |
2390 { | 2392 { |
2391 std::cerr << "dropEvent: text: \"" << e->mimeData()->text().toStdString() | 2393 std::cerr << "dropEvent: text: \"" << e->mimeData()->text().toStdString() |
2392 << "\"" << std::endl; | 2394 << "\"" << std::endl; |
2393 | 2395 |
2394 if (e->provides("text/uri-list") || e->provides("text/plain")) { | 2396 if (e->mimeData()->hasFormat("text/uri-list") || |
2397 e->mimeData()->hasFormat("text/plain")) { | |
2395 | 2398 |
2396 if (e->proposedAction() & Qt::CopyAction) { | 2399 if (e->proposedAction() & Qt::CopyAction) { |
2397 e->acceptProposedAction(); | 2400 e->acceptProposedAction(); |
2398 } else { | 2401 } else { |
2399 e->setDropAction(Qt::CopyAction); | 2402 e->setDropAction(Qt::CopyAction); |
2400 e->accept(); | 2403 e->accept(); |
2401 } | 2404 } |
2402 | 2405 |
2403 if (e->provides("text/uri-list")) { | 2406 if (e->mimeData()->hasFormat("text/uri-list")) { |
2404 | 2407 |
2405 SVDEBUG << "accepting... data is \"" << e->encodedData("text/uri-list").data() << "\"" << endl; | 2408 SVDEBUG << "accepting... data is \"" << e->mimeData()->data("text/uri-list").data() << "\"" << endl; |
2406 emit dropAccepted(QString::fromLocal8Bit | 2409 emit dropAccepted(QString::fromLocal8Bit |
2407 (e->encodedData("text/uri-list").data()) | 2410 (e->mimeData()->data("text/uri-list").data()) |
2408 .split(QRegExp("[\\r\\n]+"), | 2411 .split(QRegExp("[\\r\\n]+"), |
2409 QString::SkipEmptyParts)); | 2412 QString::SkipEmptyParts)); |
2410 } else { | 2413 } else { |
2411 emit dropAccepted(QString::fromLocal8Bit | 2414 emit dropAccepted(QString::fromLocal8Bit |
2412 (e->encodedData("text/plain").data())); | 2415 (e->mimeData()->data("text/plain").data())); |
2413 } | 2416 } |
2414 } | 2417 } |
2415 } | 2418 } |
2416 | 2419 |
2417 bool | 2420 bool |