digiKam
focuspoint.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 : 28/08/2021
7  * Description : Focus point properties container (relative to original image size)
8  *
9  * Copyright (C) 2021-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  * Copyright (C) 2021 by Phuoc Khanh Le <phuockhanhnk94 at gmail dot com>
11  *
12  * This program is free software; you can redistribute it
13  * and/or modify it under the terms of the GNU General
14  * Public License as published by the Free Software Foundation;
15  * either version 2, or (at your option)
16  * 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_FOCUSPOINT_H
26 #define DIGIKAM_FOCUSPOINT_H
27 
28 // Qt includes
29 
30 #include <QVariant>
31 #include <QStringList>
32 #include <QRectF>
33 #include <QDebug>
34 #include <QExplicitlySharedDataPointer>
35 
36 // Local includes
37 
38 #include "digikam_export.h"
39 #include "metaengine.h"
40 
41 namespace Digikam
42 {
43 
44 class DIGIKAM_EXPORT FocusPoint
45 {
46 public:
47 
48  enum TypePoint
49  {
50  Inactive = 0,
51  InFocus = 1,
52  Selected = 2,
53  SelectedInFocus = 3
54  };
55 
56 public:
57 
63  FocusPoint(float x_position, float y_position, float width, float height, TypePoint type);
64  FocusPoint(float x_position, float y_position, float width, float height);
65  explicit FocusPoint(const QRectF& rectF);
66  FocusPoint(const FocusPoint& other);
67  FocusPoint();
68  ~FocusPoint();
69 
73  FocusPoint& operator=(const FocusPoint& other);
74 
78  void setType(TypePoint type);
79  TypePoint getType() const;
80  QString getTypeDescription() const;
81 
85  void setCenterPosition(float x_position, float y_position);
86  void setSize(float width, float height);
87  void setRect(const QRectF& rectF);
88  QPointF getCenterPosition() const;
89  QSizeF getSize() const;
90  QRectF getRect() const;
91 
95  QRect getRectBySize(const QSize& size) const;
96 
97 private:
98 
99  class Private;
100  QExplicitlySharedDataPointer<Private> d;
101 };
102 
107 {
108  return (static_cast<FocusPoint::TypePoint>(static_cast<int>(type1) | static_cast<int>(type2)));
109 }
110 
112 {
113  return (static_cast<FocusPoint::TypePoint>(static_cast<int>(type1) & static_cast<int>(type2)));
114 }
115 
117 {
118  return (type1 = type1 | type2);
119 }
120 
122 {
123  return (type1 = type1 & type2);
124 }
125 
127 DIGIKAM_EXPORT QDebug operator<<(QDebug dbg, const FocusPoint& fp);
128 
129 } // namespace Digikam
130 
131 #endif // DIGIKAM_FOCUSPOINT_H
Definition: focuspoint.h:45
TypePoint
Definition: focuspoint.h:49
Definition: datefolderview.cpp:43
QDebug operator<<(QDebug dbg, const DbEngineParameters &p)
Definition: dbengineparameters.cpp:863
FocusPoint::TypePoint operator&(FocusPoint::TypePoint type1, FocusPoint::TypePoint type2)
Definition: focuspoint.h:111
FocusPoint::TypePoint & operator|=(FocusPoint::TypePoint &type1, FocusPoint::TypePoint type2)
Definition: focuspoint.h:116
FocusPoint::TypePoint operator|(FocusPoint::TypePoint type1, FocusPoint::TypePoint type2)
Definition: focuspoint.h:106
FocusPoint::TypePoint & operator&=(FocusPoint::TypePoint &type1, FocusPoint::TypePoint type2)
Definition: focuspoint.h:121