Loading...
Searching...
No Matches
qwt_picker.h
/******************************************************************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef QWT_PICKER
#define QWT_PICKER
#include "qwt_global.h"
#include "qwt_event_pattern.h"
#include <qobject.h>
class QwtPickerMachine;
class QwtWidgetOverlay;
class QwtText;
class QWidget;
class QMouseEvent;
class QWheelEvent;
class QKeyEvent;
class QPainter;
class QPen;
class QFont;
class QRegion;
class QPainterPath;
class QPoint;
class QRect;
class QSize;
class QPolygon;
class QWT_EXPORT QwtPicker : public QObject, public QwtEventPattern
{
Q_OBJECT
Q_ENUMS( RubberBand DisplayMode ResizeMode )
Q_PROPERTY( bool isEnabled READ isEnabled WRITE setEnabled )
Q_PROPERTY( ResizeMode resizeMode READ resizeMode WRITE setResizeMode )
Q_PROPERTY( DisplayMode trackerMode READ trackerMode WRITE setTrackerMode )
Q_PROPERTY( QPen trackerPen READ trackerPen WRITE setTrackerPen )
Q_PROPERTY( QFont trackerFont READ trackerFont WRITE setTrackerFont )
Q_PROPERTY( RubberBand rubberBand READ rubberBand WRITE setRubberBand )
Q_PROPERTY( QPen rubberBandPen READ rubberBandPen WRITE setRubberBandPen )
public:
enum RubberBand
{
NoRubberBand = 0,
HLineRubberBand,
VLineRubberBand,
CrossRubberBand,
RectRubberBand,
EllipseRubberBand,
PolygonRubberBand,
UserRubberBand = 100
};
enum DisplayMode
{
AlwaysOff,
AlwaysOn,
ActiveOnly
};
enum ResizeMode
{
Stretch,
KeepSize
};
explicit QwtPicker( QWidget* parent );
explicit QwtPicker( RubberBand rubberBand,
DisplayMode trackerMode, QWidget* );
virtual ~QwtPicker();
void setStateMachine( QwtPickerMachine* );
const QwtPickerMachine* stateMachine() const;
QwtPickerMachine* stateMachine();
void setRubberBand( RubberBand );
RubberBand rubberBand() const;
void setTrackerMode( DisplayMode );
DisplayMode trackerMode() const;
void setResizeMode( ResizeMode );
ResizeMode resizeMode() const;
void setRubberBandPen( const QPen& );
QPen rubberBandPen() const;
void setTrackerPen( const QPen& );
QPen trackerPen() const;
void setTrackerFont( const QFont& );
QFont trackerFont() const;
bool isEnabled() const;
bool isActive() const;
virtual bool eventFilter( QObject*, QEvent* ) QWT_OVERRIDE;
QWidget* parentWidget();
const QWidget* parentWidget() const;
virtual QPainterPath pickArea() const;
virtual void drawRubberBand( QPainter* ) const;
virtual void drawTracker( QPainter* ) const;
virtual QRegion trackerMask() const;
virtual QRegion rubberBandMask() const;
virtual QwtText trackerText( const QPoint& pos ) const;
QPoint trackerPosition() const;
virtual QRect trackerRect( const QFont& ) const;
QPolygon selection() const;
public Q_SLOTS:
void setEnabled( bool );
Q_SIGNALS:
void activated( bool on );
void selected( const QPolygon& polygon );
void appended( const QPoint& pos );
void moved( const QPoint& pos );
void removed( const QPoint& pos );
void changed( const QPolygon& selection );
protected:
virtual QPolygon adjustedPoints( const QPolygon& ) const;
virtual void transition( const QEvent* );
virtual void begin();
virtual void append( const QPoint& );
virtual void move( const QPoint& );
virtual void remove();
virtual bool end( bool ok = true );
virtual bool accept( QPolygon& ) const;
virtual void reset();
virtual void widgetMousePressEvent( QMouseEvent* );
virtual void widgetMouseReleaseEvent( QMouseEvent* );
virtual void widgetMouseDoubleClickEvent( QMouseEvent* );
virtual void widgetMouseMoveEvent( QMouseEvent* );
virtual void widgetWheelEvent( QWheelEvent* );
virtual void widgetKeyPressEvent( QKeyEvent* );
virtual void widgetKeyReleaseEvent( QKeyEvent* );
virtual void widgetEnterEvent( QEvent* );
virtual void widgetLeaveEvent( QEvent* );
virtual void stretchSelection(
const QSize& oldSize, const QSize& newSize );
virtual void updateDisplay();
const QwtWidgetOverlay* rubberBandOverlay() const;
const QwtWidgetOverlay* trackerOverlay() const;
const QPolygon& pickedPoints() const;
QRect trackerRect( const QSize& ) const;
private:
void init( QWidget*, RubberBand rubberBand, DisplayMode trackerMode );
void setMouseTracking( bool );
class PrivateData;
PrivateData* m_data;
};
#endif
QwtEventPattern
A collection of event patterns.
Definition qwt_event_pattern.h:31
QwtPicker
QwtPicker provides selections on a widget.
Definition qwt_picker.h:104
QwtPicker::DisplayMode
DisplayMode
Display mode.
Definition qwt_picker.h:162
QwtPicker::AlwaysOn
@ AlwaysOn
Display always.
Definition qwt_picker.h:167
QwtPicker::AlwaysOff
@ AlwaysOff
Display never.
Definition qwt_picker.h:164
QwtPicker::selected
void selected(const QPolygon &polygon)
QwtPicker::activated
void activated(bool on)
QwtPicker::RubberBand
RubberBand
Definition qwt_picker.h:128
QwtPicker::VLineRubberBand
@ VLineRubberBand
A vertical line ( only for QwtPickerMachine::PointSelection )
Definition qwt_picker.h:136
QwtPicker::CrossRubberBand
@ CrossRubberBand
A crosshair ( only for QwtPickerMachine::PointSelection )
Definition qwt_picker.h:139
QwtPicker::EllipseRubberBand
@ EllipseRubberBand
An ellipse ( only for QwtPickerMachine::RectSelection )
Definition qwt_picker.h:145
QwtPicker::PolygonRubberBand
@ PolygonRubberBand
A polygon ( only for QwtPickerMachine::PolygonSelection )
Definition qwt_picker.h:148
QwtPicker::HLineRubberBand
@ HLineRubberBand
A horizontal line ( only for QwtPickerMachine::PointSelection )
Definition qwt_picker.h:133
QwtPicker::RectRubberBand
@ RectRubberBand
A rectangle ( only for QwtPickerMachine::RectSelection )
Definition qwt_picker.h:142
QwtPicker::ResizeMode
ResizeMode
Definition qwt_picker.h:182
QwtPicker::Stretch
@ Stretch
All points are scaled according to the new size,.
Definition qwt_picker.h:184
QwtPicker::appended
void appended(const QPoint &pos)
QwtPicker::moved
void moved(const QPoint &pos)
QwtPicker::removed
void removed(const QPoint &pos)
QwtPicker::changed
void changed(const QPolygon &selection)
QwtPickerMachine
A state machine for QwtPicker selections.
Definition qwt_picker_machine.h:29
QwtText
A class representing a text.
Definition qwt_text.h:52
QwtWidgetOverlay
An overlay for a widget.
Definition qwt_widget_overlay.h:41