16#include <QApplication>
17#include <QContextMenuEvent>
20#include <QGraphicsPixmapItem>
21#include <QGraphicsPolygonItem>
22#include <QGraphicsScene>
56 "After an image file is imported, or an Engauge Document opened, an image appears in this area. "
57 "Points are added to the image.\n\n"
58 "If the image is a graph with two axes and one or more curves, then three axis points must be "
59 "created along those axes. Just put two axis points on one axis and a third axis point on the other "
60 "axis, as far apart as possible for higher accuracy. Then curve points can be added along the curves.\n\n"
61 "If the image is a map with a scale to define length, then two axis points must be "
62 "created at either end of the scale. Then curve points can be added.\n\n"
63 "Zooming the image in or out is performed using any of several methods:\n"
64 "1) rotating the mouse wheel when the cursor is outside of the image\n"
65 "2) pressing the minus or plus keys\n"
66 "3) selecting a new zoom setting from the View/Zoom menu"));
76 <<
" selectedCount=" << scene()->selectedItems().count();
99 QGraphicsView::contextMenuEvent (
event);
104 LOG4CPP_INFO_S ((*
mainCat)) <<
"GraphicsView::dragEnterEvent " << (
event->mimeData ()->hasUrls () ?
"urls" :
"non-urls");
106 if (
event->mimeData ()->hasImage () ||
107 event->mimeData ()->hasUrls ()) {
108 event->acceptProposedAction();
116 if (
event->mimeData ()->hasImage () ||
117 event->mimeData ()->hasUrls ()) {
118 event->acceptProposedAction();
133 if (
event->mimeData ()->hasUrls () &&
139 if (
event->mimeData()->hasImage()) {
144 event->mimeData ()->hasUrls (),
146 event->mimeData ()->hasImage (),
149 event->acceptProposedAction();
154 QGraphicsView::dropEvent (
event);
193bool GraphicsView::inBounds (
const QPointF &posScreen)
195 QRectF boundingRect = scene()->sceneRect();
197 return 0 <= posScreen.x () &&
198 0 <= posScreen.y () &&
199 posScreen.x () < boundingRect.width() &&
200 posScreen.y () < boundingRect.height();
208 Qt::Key
key =
static_cast<Qt::Key
> (
event->key());
212 if (
key == Qt::Key_Down ||
213 key == Qt::Key_Left ||
214 key == Qt::Key_Right ||
222 QGraphicsView::keyPressEvent (
event);
234 if (!inBounds (posScreen)) {
237 posScreen =
QPointF (-1.0, -1.0);
242 QGraphicsView::mouseMoveEvent (
event);
251 if (!inBounds (posScreen)) {
254 posScreen =
QPointF (-1.0, -1.0);
259 QGraphicsView::mousePressEvent (
event);
268 if (!inBounds (posScreen)) {
271 posScreen =
QPointF (-1.0, -1.0);
286 QGraphicsView::mouseReleaseEvent (
event);
295 QList<QGraphicsItem*>::const_iterator
itr;
315 if (!
urlText.contains (
"http")) {
337 <<
" phase=" <<
event->phase();
343 if ((
event->modifiers() & Qt::ControlModifier) != 0) {
363 QGraphicsView::wheelEvent (
event);
@ DATA_KEY_GRAPHICS_ITEM_TYPE
Unique identifier for QGraphicsItem object
const int INNER_RADIUS_MIN
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) define ENGAUGE...
GraphicsItemType
Runtime type identification (RTTI) for QGraphicsItem objects.
@ GRAPHICS_ITEM_TYPE_POINT
const QString AXIS_CURVE_NAME
log4cpp::Category * mainCat
virtual void mouseReleaseEvent(QMouseEvent *event)
Intercept mouse release events to move one or more Points.
void signalDraggedImage(QImage)
Send dragged image to MainWindow for import. This typically comes from dragging a file.
virtual void wheelEvent(QWheelEvent *event)
Convert wheel events into zoom in/out.
virtual void dropEvent(QDropEvent *event)
Intercept mouse drop event to support drag-and-drop. This initiates asynchronous loading of the dragg...
void slotDropRegression(QString)
Receive drag and drop regression test url.
void signalKeyPress(Qt::Key, bool atLeastOneSelectedItem)
Send keypress to MainWindow for eventual processing by DigitizeStateAbstractBase subclasses.
void signalMouseRelease(QPointF)
Send mouse release to MainWindow for moving Points.
virtual void dragEnterEvent(QDragEnterEvent *event)
Intercept mouse drag event to support drag-and-drop.
virtual void keyPressEvent(QKeyEvent *event)
Intercept key press events to handle left/right/up/down moving.
void signalViewZoomOut()
Send wheel event to MainWindow for zooming out.
virtual void dragMoveEvent(QDragMoveEvent *event)
Intercept mouse move event to support drag-and-drop.
void signalDraggedDigFile(QString)
Send dragged dig file to MainWindow for import. This comes from dragging an engauge dig file.
virtual void mousePressEvent(QMouseEvent *event)
Intercept mouse press events to create one or more Points.
void signalContextMenuEventAxis(QString pointIdentifier)
Send right click on axis point to MainWindow for editing.
void signalViewZoomIn()
Send wheel event to MainWindow for zooming in.
GraphicsView(QGraphicsScene *scene, MainWindow &mainWindow)
Single constructor.
virtual void mouseMoveEvent(QMouseEvent *event)
Intercept mouse move events to populate the current cursor position in StatusBar.
void signalMousePress(QPointF)
Send mouse press to MainWindow for creating one or more Points.
void signalDraggedImageUrl(QUrl)
Send dragged url to MainWindow for import. This typically comes from dragging an image from a browser...
void signalContextMenuEventGraph(QStringList pointIdentifiers)
Send right click on graph point(s) to MainWindow for editing.
void signalMouseMove(QPointF)
Send mouse move to MainWindow for eventual display of cursor coordinates in StatusBar.
virtual void contextMenuEvent(QContextMenuEvent *event)
Intercept context event to support point editing.
Returns information about files.
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
#define LOG4CPP_INFO_S(logger)
#define LOG4CPP_DEBUG_S(logger)