Changeset View
Changeset View
Standalone View
Standalone View
src/hiderectitem.h
- This file was copied from src/selectionitem.h.
Show All 18 Lines | |||||
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
21 | * Lesser General Public License for more details. | 21 | * Lesser General Public License for more details. | ||
22 | * | 22 | * | ||
23 | * You should have received a copy of the GNU Lesser General Public | 23 | * You should have received a copy of the GNU Lesser General Public | ||
24 | * License along with this program. If not, see <http://www.gnu.org/licenses/>. | 24 | * License along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
25 | * | 25 | * | ||
26 | * ============================================================ */ | 26 | * ============================================================ */ | ||
27 | #ifndef SELECTIONITEM_H | | |||
28 | #define SELECTIONITEM_H | | |||
29 | 27 | | |||
30 | #include <QGraphicsPixmapItem> | 28 | #ifndef HIDERECTITEM_H | ||
31 | #include <QPainter> | 29 | #define HIDERECTITEM_H | ||
30 | | ||||
31 | #include <QGraphicsRectItem> | ||||
32 | 32 | | |||
33 | namespace KSaneIface | 33 | namespace KSaneIface | ||
34 | { | 34 | { | ||
35 | 35 | | |||
36 | class SelectionItem : public QGraphicsItem | 36 | class HideRectItem : public QGraphicsRectItem | ||
37 | { | 37 | { | ||
38 | public: | 38 | public: | ||
39 | typedef enum { | 39 | HideRectItem(); | ||
40 | None, | | |||
41 | Top, | | |||
42 | TopRight, | | |||
43 | Right, | | |||
44 | BottomRight, | | |||
45 | Bottom, | | |||
46 | BottomLeft, | | |||
47 | Left, | | |||
48 | TopLeft, | | |||
49 | Move, | | |||
50 | AddRemove | | |||
51 | } Intersects; | | |||
52 | | ||||
53 | explicit SelectionItem(const QRectF &rect); | | |||
54 | ~SelectionItem(); | | |||
55 | | ||||
56 | void setMaxRight(qreal maxRight); | | |||
57 | void setMaxBottom(qreal maxBottom); | | |||
58 | void setSaved(bool isSaved); | | |||
59 | | ||||
60 | Intersects intersects(const QPointF &point); | | |||
61 | | ||||
62 | void saveZoom(qreal zoom); | | |||
63 | 40 | | |||
sars: override and same for setRect() ? | |||||
They are not virtual... volkov: They are not virtual...
Maybe public inheritance is not a good choice here. | |||||
41 | QRectF rect() const; | ||||
64 | void setRect(const QRectF &rect); | 42 | void setRect(const QRectF &rect); | ||
65 | QPointF fixTranslation( QPointF dp); | | |||
66 | QRectF rect(); | | |||
67 | 43 | | |||
68 | public: | 44 | qreal devicePixelRatio() const; | ||
69 | // Graphics Item methods | 45 | void setDevicePixelRatio(qreal dpr); | ||
70 | QRectF boundingRect() const override; | | |||
71 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; | | |||
72 | 46 | | |||
73 | private: | 47 | private: | ||
74 | struct Private; | 48 | qreal m_devicePixelRatio; | ||
75 | Private *const d; | | |||
76 | }; | 49 | }; | ||
77 | 50 | | |||
78 | } // NameSpace KSaneIface | 51 | } // NameSpace KSaneIface | ||
79 | 52 | | |||
80 | #endif | 53 | #endif // HIDERECTITEM_H | ||
81 | |
override and same for setRect() ?