Files
qt5-legatus-legacy/Lts/Viewer/SituationMap/Rubberbands/rubberband_handle_proxy.h
T
2026-08-13 18:33:10 +02:00

105 lines
3.1 KiB
Objective-C
Executable File

/**
**
** @RDE_HEADER@
** Definition of class RubberbandHandleProxy to forward adjust signals from View
** $Id$
** $HeadURL$
** $Author$
**
** -----------------------------------------------------------------------------------------------
**
** Hardware-Environment: Intel-PC
** Software-Environment: Windows 7, Qt 5.4. ArcGIS 10.2.5
**
** Language ........: C++ 11
**
** -----------------------------------------------------------------------------------------------
**
** Author ...........: Jörg Turla, SPD G, Tel. 3132
**
** -----------------------------------------------------------------------------------------------
**
** Notes .........:
**
** 10.07.2015, JT : First edition for use with Qt5
**
** -----------------------------------------------------------------------------------------------
*/
#pragma once
#include "rubberband_handle.h"
#include <QtWidgets/QGraphicsProxyWidget>
class QGraphicsView;
class QGraphicsScene;
namespace SituationMap { namespace RB
{
/**
@class RubberbandHandleProxy rubberband_handle_proxy.h
@brief Implementation of a procx to handle small menues and other widgets like buttons
@see RubberbandHandle
*/
class RubberbandHandleProxy : public RubberbandHandle
{
Q_OBJECT
public:
/**
@name Construction & Destruction
@{
*/
RubberbandHandleProxy( QGraphicsView *view, QWidget * widget );
RubberbandHandleProxy( Esri::ArcGISRuntime::MapGraphicsView * view, QWidget * widget );
RubberbandHandleProxy( Esri::ArcGISRuntime::MapGraphicsView * view, QGraphicsScene * scene, QWidget * widget );
~RubberbandHandleProxy();
/** @} */
bool isPositionInside( const QPointF & scenePosition ) const override;
void setPos(const QPointF & pos);
const RubberbandCoordinate & getCoordinate() const { return _coordinate; }
inline void setSceneOffset(const QPointF & offset) { _sceneOffset = offset; }
inline void show() { setVisibility(false); if (_widgetsProxy) { _widgetsProxy->show(); setVisibility(true); } }
inline void hide() { setVisibility(false); if (_widgetsProxy) { _widgetsProxy->hide(); setVisibility(false); } }
inline void setRotateSceneOffset(bool on = true) { _rotateSceneOffset = on; }
inline void setRestoreCursor( const QCursor & cursor ) { _restoreCursor = cursor; } // workaround Qt bug. remove when fixed
protected:
RubberbandCoordinate _coordinate;
QGraphicsProxyWidget * _widgetsProxy = nullptr;
QPointF _sceneOffset;
bool _rotateSceneOffset;
QPointer<QGraphicsView> _restoreView;
QCursor _restoreCursor; // workaround Qt bug. remove when fixed
void updateGraphic() override {}
void adjustCoordinates() override;
void adjustWindow( const QRectF& ) override;
private:
QPointF getRotatedSceneOffset() const;
private:
void init( QWidget * widget );
}; /* RubberbandHandleProxy */
} } /* namespace SituationMap::RB */