File indexing completed on 2025-01-19 03:50:43

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2006-21-12
0007  * Description : a embedded item-view to show the image preview widget.
0008  *
0009  * SPDX-FileCopyrightText: 2006-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  * SPDX-FileCopyrightText: 2009-2012 by Andi Clemens <andi dot clemens at gmail dot com>
0011  * SPDX-FileCopyrightText: 2010-2011 by Aditya Bhatt <adityabhatt1991 at gmail dot com>
0012  *
0013  * SPDX-License-Identifier: GPL-2.0-or-later
0014  *
0015  * ============================================================ */
0016 
0017 #include "itempreviewcanvas.h"
0018 
0019 // Qt includes
0020 
0021 #include <QGraphicsSceneContextMenuEvent>
0022 
0023 // Local includes
0024 
0025 #include "itempreviewview.h"
0026 #include "facegroup.h"
0027 
0028 namespace Digikam
0029 {
0030 
0031 class Q_DECL_HIDDEN ItemPreviewCanvas::Private
0032 {
0033 public:
0034 
0035     explicit Private()
0036       : group(nullptr)
0037     {
0038     }
0039 
0040     FaceGroup* group;
0041     ItemInfo   info;
0042 };
0043 
0044 ItemPreviewCanvas::ItemPreviewCanvas()
0045     : d(new Private)
0046 {
0047     setAcceptHoverEvents(true);
0048 }
0049 
0050 ItemPreviewCanvas::~ItemPreviewCanvas()
0051 {
0052     delete d;
0053 }
0054 
0055 void ItemPreviewCanvas::setFaceGroup(FaceGroup* const group)
0056 {
0057     d->group = group;
0058 }
0059 
0060 void ItemPreviewCanvas::setItemInfo(const ItemInfo& info)
0061 {
0062     d->info = info;
0063     setPath(info.filePath());
0064 }
0065 
0066 ItemInfo ItemPreviewCanvas::imageInfo() const
0067 {
0068     return d->info;
0069 }
0070 
0071 void ItemPreviewCanvas::hoverEnterEvent(QGraphicsSceneHoverEvent* e)
0072 {
0073     d->group->itemHoverEnterEvent(e);
0074 }
0075 
0076 void ItemPreviewCanvas::hoverLeaveEvent(QGraphicsSceneHoverEvent* e)
0077 {
0078     d->group->itemHoverLeaveEvent(e);
0079 }
0080 
0081 void ItemPreviewCanvas::hoverMoveEvent(QGraphicsSceneHoverEvent* e)
0082 {
0083     d->group->itemHoverMoveEvent(e);
0084 }
0085 
0086 } // namespace Digikam
0087 
0088 #include "moc_itempreviewcanvas.cpp"