File indexing completed on 2025-01-05 03:59:45

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2013-09-13
0007  * Description : rubber item for Canvas
0008  *
0009  * SPDX-FileCopyrightText: 2013-2014 by Yiou Wang <geow812 at gmail dot com>
0010  *
0011  * SPDX-License-Identifier: GPL-2.0-or-later
0012  *
0013  * ============================================================ */
0014 
0015 #include "rubberitem.h"
0016 
0017 namespace Digikam
0018 {
0019 
0020 class Q_DECL_HIDDEN RubberItem::Private
0021 {
0022 public:
0023 
0024     explicit Private()
0025       : canvas(nullptr)
0026     {
0027     }
0028 
0029     Canvas* canvas;
0030 };
0031 
0032 RubberItem::RubberItem(ImagePreviewItem* const parent)
0033     : RegionFrameItem(parent),
0034       d(new Private)
0035 {
0036 }
0037 
0038 RubberItem::~RubberItem()
0039 {
0040     delete d;
0041 }
0042 
0043 void RubberItem::setCanvas(Canvas* const canvas)
0044 {
0045     d->canvas = canvas;
0046 }
0047 
0048 void RubberItem::mouseReleaseEvent(QGraphicsSceneMouseEvent* event)
0049 {
0050     RegionFrameItem::mouseReleaseEvent(event);
0051     d->canvas->slotSelected();
0052 }
0053 
0054 void RubberItem::mouseMoveEvent(QGraphicsSceneMouseEvent* event)
0055 {
0056     RegionFrameItem::mouseMoveEvent(event);
0057     d->canvas->slotSelectionMoved();
0058 }
0059 
0060 } // namespace Digikam
0061 
0062 #include "moc_rubberitem.cpp"