#include <Panner.h>

Inheritance diagram for Panner:
Inheritance graph
Collaboration diagram for Panner:
Collaboration graph

Public Slots

void setRectExtents (float x0, float y0, float width, float height)
 Set the extents of the panned rectangle within the overall panner widget. More...
 
void setRectWidth (float width)
 Set the width of the panned rectangle as a fraction (0 -> 1) of that of the whole panner widget. More...
 
void setRectHeight (float height)
 Set the height of the panned rectangle as a fraction (0 -> 1) of that of the whole panner widget. More...
 
void setRectCentreX (float x)
 Set the location of the centre of the panned rectangle on the x axis, as a proportion (0 -> 1) of the width of the whole panner widget. More...
 
void setRectCentreY (float y)
 Set the location of the centre of the panned rectangle on the y axis, as a proportion (0 -> 1) of the height of the whole panner widget. More...
 
void scroll (bool up)
 Move up (if up is true) or down a bit. More...
 
void scroll (bool up, int n)
 Move up (if up is true) or down a bit. More...
 
void resetToDefault ()
 

Signals

void rectExtentsChanged (float, float, float, float)
 Emitted when the panned rectangle is dragged or otherwise moved. More...
 
void rectCentreMoved (float, float)
 Emitted when the rectangle is dragged or otherwise moved (as well as extentsChanged). More...
 
void doubleClicked ()
 Emitted when the panner is double-clicked (for the "customer" code to pop up a value editing dialog, for example). More...
 
void mouseEntered ()
 
void mouseLeft ()
 

Public Member Functions

 Panner (QWidget *parent=0)
 
virtual ~Panner ()
 
void setDefaultRectCentre (float, float)
 
void setThumbColour (QColor colour)
 
void setAlpha (int backgroundAlpha, int thumbAlpha)
 
void setScrollUnit (float unit)
 Set the amount the scroll() function or mouse wheel movement makes the panner rectangle move by. More...
 
void getRectExtents (float &x0, float &y0, float &width, float &height)
 
QSize sizeHint () const override
 

Protected Member Functions

void mousePressEvent (QMouseEvent *e) override
 
void mouseDoubleClickEvent (QMouseEvent *e) override
 
void mouseMoveEvent (QMouseEvent *e) override
 
void mouseReleaseEvent (QMouseEvent *e) override
 
void wheelEvent (QWheelEvent *e) override
 
void paintEvent (QPaintEvent *e) override
 
void enterEvent (QEvent *) override
 
void leaveEvent (QEvent *) override
 
void normalise ()
 
void emitAndUpdate ()
 
float centreX () const
 
float centreY () const
 

Protected Attributes

float m_rectX
 
float m_rectY
 
float m_rectWidth
 
float m_rectHeight
 
float m_scrollUnit
 
float m_defaultCentreX
 
float m_defaultCentreY
 
bool m_defaultsSet
 
QColor m_thumbColour
 
int m_backgroundAlpha
 
int m_thumbAlpha
 
bool m_clicked
 
QPoint m_clickPos
 
float m_dragStartX
 
float m_dragStartY
 
WheelCounter m_wheelCounter
 

Detailed Description

Definition at line 23 of file Panner.h.

Constructor & Destructor Documentation

Panner::Panner ( QWidget *  parent = 0)

Definition at line 28 of file Panner.cpp.

Panner::~Panner ( )
virtual

Definition at line 47 of file Panner.cpp.

Member Function Documentation

void Panner::setDefaultRectCentre ( float  cx,
float  cy 
)

Definition at line 292 of file Panner.cpp.

References m_defaultCentreX, m_defaultCentreY, and m_defaultsSet.

void Panner::setThumbColour ( QColor  colour)
void Panner::setAlpha ( int  backgroundAlpha,
int  thumbAlpha 
)

Definition at line 52 of file Panner.cpp.

References m_backgroundAlpha, and m_thumbAlpha.

Referenced by Pane::updateHeadsUpDisplay().

void Panner::setScrollUnit ( float  unit)

Set the amount the scroll() function or mouse wheel movement makes the panner rectangle move by.

The default value of 0 means to select a value automatically based on the dimensions of the panner rectangle.

Definition at line 59 of file Panner.cpp.

References m_scrollUnit.

void Panner::getRectExtents ( float &  x0,
float &  y0,
float &  width,
float &  height 
)

Definition at line 217 of file Panner.cpp.

References m_rectHeight, m_rectWidth, m_rectX, and m_rectY.

QSize Panner::sizeHint ( ) const
override

Definition at line 286 of file Panner.cpp.

void Panner::rectExtentsChanged ( float  ,
float  ,
float  ,
float   
)
signal

Emitted when the panned rectangle is dragged or otherwise moved.

Arguments are x0, y0, width and height of the rectangle in the range 0 -> 1 as proportions of the width and height of the whole widget.

Referenced by emitAndUpdate(), and mouseMoveEvent().

void Panner::rectCentreMoved ( float  ,
float   
)
signal

Emitted when the rectangle is dragged or otherwise moved (as well as extentsChanged).

Arguments are the centre coordinates of the rectangle in the range 0 -> 1 as proportions of the width and height of the whole widget.

Referenced by emitAndUpdate(), and mouseMoveEvent().

void Panner::doubleClicked ( )
signal

Emitted when the panner is double-clicked (for the "customer" code to pop up a value editing dialog, for example).

Referenced by mouseDoubleClickEvent().

void Panner::mouseEntered ( )
signal

Referenced by enterEvent().

void Panner::mouseLeft ( )
signal

Referenced by leaveEvent().

void Panner::setRectExtents ( float  x0,
float  y0,
float  width,
float  height 
)
slot

Set the extents of the panned rectangle within the overall panner widget.

Coordinates are in the range 0 -> 1 in both axes, with 0 at the top in the y axis.

Definition at line 226 of file Panner.cpp.

References emitAndUpdate(), m_rectHeight, m_rectWidth, m_rectX, m_rectY, and normalise().

Referenced by Pane::updateVerticalPanner().

void Panner::setRectWidth ( float  width)
slot

Set the width of the panned rectangle as a fraction (0 -> 1) of that of the whole panner widget.

Definition at line 248 of file Panner.cpp.

References emitAndUpdate(), m_rectWidth, and normalise().

void Panner::setRectHeight ( float  height)
slot

Set the height of the panned rectangle as a fraction (0 -> 1) of that of the whole panner widget.

Definition at line 257 of file Panner.cpp.

References emitAndUpdate(), m_rectHeight, and normalise().

void Panner::setRectCentreX ( float  x)
slot

Set the location of the centre of the panned rectangle on the x axis, as a proportion (0 -> 1) of the width of the whole panner widget.

Definition at line 266 of file Panner.cpp.

References emitAndUpdate(), m_rectWidth, m_rectX, and normalise().

void Panner::setRectCentreY ( float  y)
slot

Set the location of the centre of the panned rectangle on the y axis, as a proportion (0 -> 1) of the height of the whole panner widget.

Definition at line 276 of file Panner.cpp.

References emitAndUpdate(), m_rectHeight, m_rectY, and normalise().

void Panner::scroll ( bool  up)
slot

Move up (if up is true) or down a bit.

This is basically the same action as rolling the mouse wheel one notch.

Definition at line 65 of file Panner.cpp.

Referenced by wheelEvent(), and Pane::wheelVertical().

void Panner::scroll ( bool  up,
int  n 
)
slot

Move up (if up is true) or down a bit.

This is basically the same action as rolling the mouse wheel n notches.

Definition at line 71 of file Panner.cpp.

References emitAndUpdate(), m_rectHeight, m_rectY, m_scrollUnit, and normalise().

void Panner::resetToDefault ( )
slot
void Panner::mousePressEvent ( QMouseEvent *  e)
overrideprotected

Definition at line 90 of file Panner.cpp.

References m_clicked, m_clickPos, m_dragStartX, m_dragStartY, m_rectX, m_rectY, and resetToDefault().

void Panner::mouseDoubleClickEvent ( QMouseEvent *  e)
overrideprotected

Definition at line 105 of file Panner.cpp.

References doubleClicked().

void Panner::mouseMoveEvent ( QMouseEvent *  e)
overrideprotected
void Panner::mouseReleaseEvent ( QMouseEvent *  e)
overrideprotected

Definition at line 132 of file Panner.cpp.

References m_clicked, and mouseMoveEvent().

void Panner::wheelEvent ( QWheelEvent *  e)
overrideprotected

Definition at line 141 of file Panner.cpp.

References WheelCounter::count(), m_wheelCounter, and scroll().

void Panner::paintEvent ( QPaintEvent *  e)
overrideprotected
void Panner::enterEvent ( QEvent *  )
overrideprotected

Definition at line 148 of file Panner.cpp.

References mouseEntered().

void Panner::leaveEvent ( QEvent *  )
overrideprotected

Definition at line 154 of file Panner.cpp.

References mouseLeft().

float Panner::centreX ( ) const
inlineprotected

Definition at line 149 of file Panner.h.

Referenced by emitAndUpdate(), mouseMoveEvent(), and normalise().

float Panner::centreY ( ) const
inlineprotected

Definition at line 150 of file Panner.h.

Referenced by emitAndUpdate(), mouseMoveEvent(), and normalise().

Member Data Documentation

float Panner::m_rectX
protected
float Panner::m_rectWidth
protected
float Panner::m_rectHeight
protected
float Panner::m_scrollUnit
protected

Definition at line 139 of file Panner.h.

Referenced by scroll(), and setScrollUnit().

float Panner::m_defaultCentreX
protected

Definition at line 141 of file Panner.h.

Referenced by normalise(), resetToDefault(), and setDefaultRectCentre().

float Panner::m_defaultCentreY
protected

Definition at line 142 of file Panner.h.

Referenced by normalise(), resetToDefault(), and setDefaultRectCentre().

bool Panner::m_defaultsSet
protected

Definition at line 143 of file Panner.h.

Referenced by normalise(), and setDefaultRectCentre().

QColor Panner::m_thumbColour
protected

Definition at line 145 of file Panner.h.

Referenced by paintEvent().

int Panner::m_backgroundAlpha
protected

Definition at line 146 of file Panner.h.

Referenced by paintEvent(), and setAlpha().

int Panner::m_thumbAlpha
protected

Definition at line 147 of file Panner.h.

Referenced by paintEvent(), and setAlpha().

bool Panner::m_clicked
protected

Definition at line 152 of file Panner.h.

Referenced by mouseMoveEvent(), mousePressEvent(), and mouseReleaseEvent().

QPoint Panner::m_clickPos
protected

Definition at line 153 of file Panner.h.

Referenced by mouseMoveEvent(), and mousePressEvent().

float Panner::m_dragStartX
protected

Definition at line 154 of file Panner.h.

Referenced by mouseMoveEvent(), and mousePressEvent().

float Panner::m_dragStartY
protected

Definition at line 155 of file Panner.h.

Referenced by mouseMoveEvent(), and mousePressEvent().

WheelCounter Panner::m_wheelCounter
protected

Definition at line 157 of file Panner.h.

Referenced by wheelEvent().


The documentation for this class was generated from the following files: