1 // Copyright 2005-2019 The Mumble Developers. All rights reserved.
2 // Use of this source code is governed by a BSD-style license
3 // that can be found in the LICENSE file at the root of the
4 // Mumble source tree or at <https://www.mumble.info/LICENSE>.
5 
6 #ifndef MUMBLE_MUMBLE_OVERLAYPOSITIONABLEITEM_H
7 #define MUMBLE_MUMBLE_OVERLAYPOSITIONABLEITEM_H
8 
9 #include <QtCore/QtGlobal>
10 #if QT_VERSION >= 0x050000
11 # include <QtWidgets/QGraphicsItem>
12 #else
13 # include <QtGui/QGraphicsItem>
14 #endif
15 
16 class OverlayPositionableItem : public QObject, public QGraphicsPixmapItem {
17 	Q_OBJECT
18 	Q_DISABLE_COPY(OverlayPositionableItem);
19 public:
20 	OverlayPositionableItem(QRectF *posPtr, const bool isPositionable=false);
21 	virtual ~OverlayPositionableItem();
22 	void updateRender();
23 	void setItemVisible(const bool &visible);
24 private:
25 	/// Float value between 0 and 1 where 0,0 is top left, and 1,1 is bottom right
26 	QRectF *m_position;
27 	const bool m_isPositionEditable;
28 	QGraphicsEllipseItem *m_qgeiHandle;
29 	void createPositioningHandle();
30 	bool sceneEventFilter(QGraphicsItem *, QEvent *) Q_DECL_OVERRIDE;
31 private slots:
32 	void onMove();
33 };
34 
35 #endif
36