Changeset View
Changeset View
Standalone View
Standalone View
lib/documentview/abstractrasterimageviewtool.cpp
Show All 16 Lines | |||||
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software | ||
18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
19 | 19 | | |||
20 | */ | 20 | */ | ||
21 | // Self | 21 | // Self | ||
22 | #include "abstractrasterimageviewtool.h" | 22 | #include "abstractrasterimageviewtool.h" | ||
23 | 23 | | |||
24 | // Qt | 24 | // Qt | ||
25 | #include <QCursor> | ||||
25 | #include <QGraphicsSceneWheelEvent> | 26 | #include <QGraphicsSceneWheelEvent> | ||
27 | #include <QStandardPaths> | ||||
26 | 28 | | |||
27 | // KDE | 29 | // KDE | ||
28 | 30 | | |||
29 | // Local | 31 | // Local | ||
30 | #include "rasterimageview.h" | 32 | #include "rasterimageview.h" | ||
31 | 33 | | |||
32 | namespace Gwenview | 34 | namespace Gwenview | ||
33 | { | 35 | { | ||
34 | 36 | | |||
35 | struct AbstractRasterImageViewToolPrivate | 37 | struct AbstractRasterImageViewToolPrivate | ||
36 | { | 38 | { | ||
37 | RasterImageView* mRasterImageView; | 39 | RasterImageView* mRasterImageView; | ||
40 | QCursor mZoomCursor; | ||||
muhlenpfordt: Maybe this could be changed to a global object for using here and in `AbstractImageView`? | |||||
41 | | ||||
42 | void setupZoomCursor() | ||||
43 | { | ||||
44 | // We do not use "appdata" here because that does not work when this | ||||
45 | // code is called from a KPart. | ||||
46 | const QString path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("gwenview/cursors/zoom.png")); | ||||
47 | const QPixmap cursorPixmap = QPixmap(path); | ||||
48 | mZoomCursor = QCursor(cursorPixmap, 11, 11); | ||||
49 | } | ||||
50 | | ||||
38 | }; | 51 | }; | ||
39 | 52 | | |||
40 | AbstractRasterImageViewTool::AbstractRasterImageViewTool(RasterImageView* view) | 53 | AbstractRasterImageViewTool::AbstractRasterImageViewTool(RasterImageView* view) | ||
41 | : QObject(view) | 54 | : QObject(view) | ||
42 | , d(new AbstractRasterImageViewToolPrivate) | 55 | , d(new AbstractRasterImageViewToolPrivate) | ||
43 | { | 56 | { | ||
44 | d->mRasterImageView = view; | 57 | d->mRasterImageView = view; | ||
58 | d->setupZoomCursor(); | ||||
45 | } | 59 | } | ||
46 | 60 | | |||
47 | AbstractRasterImageViewTool::~AbstractRasterImageViewTool() | 61 | AbstractRasterImageViewTool::~AbstractRasterImageViewTool() | ||
48 | { | 62 | { | ||
49 | delete d; | 63 | delete d; | ||
50 | } | 64 | } | ||
51 | 65 | | |||
52 | RasterImageView* AbstractRasterImageViewTool::imageView() const | 66 | RasterImageView* AbstractRasterImageViewTool::imageView() const | ||
53 | { | 67 | { | ||
54 | return d->mRasterImageView; | 68 | return d->mRasterImageView; | ||
55 | } | 69 | } | ||
56 | 70 | | |||
57 | void AbstractRasterImageViewTool::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event) | 71 | void AbstractRasterImageViewTool::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event) | ||
58 | { | 72 | { | ||
59 | event->ignore(); | 73 | event->ignore(); | ||
60 | } | 74 | } | ||
61 | 75 | | |||
62 | void AbstractRasterImageViewTool::wheelEvent(QGraphicsSceneWheelEvent* event) | 76 | void AbstractRasterImageViewTool::wheelEvent(QGraphicsSceneWheelEvent* event) | ||
63 | { | 77 | { | ||
64 | event->ignore(); | 78 | event->ignore(); | ||
65 | } | 79 | } | ||
66 | 80 | | |||
81 | QCursor AbstractRasterImageViewTool::zoomCursor() const | ||||
82 | { | ||||
83 | return d->mZoomCursor; | ||||
84 | } | ||||
85 | | ||||
67 | } // namespace | 86 | } // namespace |
Maybe this could be changed to a global object for using here and in AbstractImageView?