digiKam
advprintcropframe.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2002-30-09
7  * Description : a tool to print images
8  *
9  * Copyright (C) 2002-2003 by Todd Shoemaker <todd at theshoemakers dot net>
10  * Copyright (C) 2007-2012 by Angelo Naselli <anaselli at linux dot it>
11  * Copyright (C) 2006-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
12  *
13  * This program is free software; you can redistribute it
14  * and/or modify it under the terms of the GNU General
15  * Public License as published by the Free Software Foundation;
16  * either version 2, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * ============================================================ */
24 
25 #ifndef DIGIKAM_ADV_PRINT_CROP_FRAME_H
26 #define DIGIKAM_ADV_PRINT_CROP_FRAME_H
27 
28 // Qt includes
29 
30 #include <QWidget>
31 
32 class QResizeEvent;
33 
35 {
36 
37 class AdvPrintPhoto;
38 
39 class AdvPrintCropFrame : public QWidget
40 {
41  Q_OBJECT
42 
43 public:
44 
45  explicit AdvPrintCropFrame(QWidget* const parent);
46  ~AdvPrintCropFrame() override;
47 
48  void init(AdvPrintPhoto* const photo,
49  int woutlay,
50  int houtlay,
51  bool autoRotate,
52  bool paint);
53 
54  void setColor(const QColor&);
55  QColor color() const;
56 
57  void drawCropRectangle(bool draw = true);
58 
59 protected:
60 
61  void paintEvent(QPaintEvent*) override;
62  void mousePressEvent(QMouseEvent*) override;
63  void mouseReleaseEvent(QMouseEvent*) override;
64  void mouseMoveEvent(QMouseEvent*) override;
65  void keyReleaseEvent(QKeyEvent*) override;
66 
67 private:
68 
69  QRect screenToPhotoRect(const QRect&) const;
70  QRect photoToScreenRect(const QRect&) const;
71  void resizeEvent(QResizeEvent*) override;
72  void updateImage();
73 
74 private:
75 
76  class Private;
77  Private* const d;
78 };
79 
80 } // Namespace Digikam
81 
82 #endif // DIGIKAM_ADV_PRINT_CROP_FRAME_H
Definition: advprintcropframe.h:40
void setColor(const QColor &)
Definition: advprintcropframe.cpp:342
AdvPrintCropFrame(QWidget *const parent)
Definition: advprintcropframe.cpp:78
void mousePressEvent(QMouseEvent *) override
Definition: advprintcropframe.cpp:249
void keyReleaseEvent(QKeyEvent *) override
Definition: advprintcropframe.cpp:294
void mouseMoveEvent(QMouseEvent *) override
Definition: advprintcropframe.cpp:266
QColor color() const
Definition: advprintcropframe.cpp:348
~AdvPrintCropFrame() override
Definition: advprintcropframe.cpp:84
void drawCropRectangle(bool draw=true)
Definition: advprintcropframe.cpp:353
void paintEvent(QPaintEvent *) override
Definition: advprintcropframe.cpp:214
void mouseReleaseEvent(QMouseEvent *) override
Definition: advprintcropframe.cpp:258
void init(AdvPrintPhoto *const photo, int woutlay, int houtlay, bool autoRotate, bool paint)
Definition: advprintcropframe.cpp:89
Definition: advprintphoto.cpp:43