QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
| 信号 | Public 成员函数 | Protected 成员函数 | 所有成员列表
QwtCachePanner类 参考

QwtCachePanner provides panning of a widget 更多...

#include <qwt_cache_panner.h>

类 QwtCachePanner 继承关系图:
QwtPlotCachePanner QwtPolarCachePanner

class  PrivateData
 

信号

void panned (int dx, int dy)
 Signal emitted when panning is done
 
void moved (int dx, int dy)
 Signal emitted while the widget moved, but panning is not finished
 

Public 成员函数

 QwtCachePanner (QWidget *parent)
 Creates a panner that is enabled for the left mouse button
 
void setEnabled (bool)
 En/disable the panner
 
bool isEnabled () const
 Return whether the panner is enabled
 
void setMouseButton (Qt::MouseButton, Qt::KeyboardModifiers=Qt::NoModifier)
 Change the mouse button and modifiers used for panning
 
void getMouseButton (Qt::MouseButton &button, Qt::KeyboardModifiers &) const
 Get mouse button and modifiers used for panning
 
void setAbortKey (int key, Qt::KeyboardModifiers=Qt::NoModifier)
 Change the abort key
 
void getAbortKey (int &key, Qt::KeyboardModifiers &) const
 Get the abort key and modifiers
 
void setCursor (const QCursor &)
 Change the cursor that is active while panning
 
const QCursor cursor () const
 Return the cursor that is active while panning
 
void setOrientations (Qt::Orientations)
 Set the orientations where panning is enabled
 
Qt::Orientations orientations () const
 Return the orientation where panning is enabled
 
bool isOrientationEnabled (Qt::Orientation) const
 Check if an orientation is enabled
 
virtual bool eventFilter (QObject *, QEvent *) override
 Event filter
 

Protected 成员函数

virtual void widgetMousePressEvent (QMouseEvent *)
 Handle a mouse press event for the observed widget.
 
virtual void widgetMouseReleaseEvent (QMouseEvent *)
 Handle a mouse release event for the observed widget.
 
virtual void widgetMouseMoveEvent (QMouseEvent *)
 Handle a mouse move event for the observed widget.
 
virtual void widgetKeyPressEvent (QKeyEvent *)
 Handle a key press event for the observed widget.
 
virtual void widgetKeyReleaseEvent (QKeyEvent *)
 Handle a key release event for the observed widget.
 
virtual void paintEvent (QPaintEvent *) override
 Paint event
 
virtual QBitmap contentsMask () const
 Calculate a mask for the contents of the panned widget
 
virtual QPixmap grab () const
 Grab the widget into a pixmap
 

详细描述

QwtCachePanner provides panning of a widget

QwtCachePanner grabs the contents of a widget, that can be dragged in all directions. The offset between the start and the end position is emitted by the panned signal. QwtCachePanner grabs the content of the widget into a pixmap and moves the pixmap around, without initiating any repaint events for the widget. Areas, that are not part of content are not painted while panning. This makes panning fast enough for widgets, where repaints are too slow for mouse movements. For widgets, where repaints are very fast it might be better to implement panning manually by mapping mouse events into paint events.

构造及析构函数说明

◆ QwtCachePanner()

QwtCachePanner::QwtCachePanner ( QWidget *  parent)
explicit

Creates a panner that is enabled for the left mouse button

参数
[in]parentParent widget to be panned

Destructor

成员函数说明

◆ contentsMask()

QBitmap QwtCachePanner::contentsMask ( ) const
protectedvirtual

Calculate a mask for the contents of the panned widget

Sometimes only parts of the contents of a widget should be panned. F.e. for a widget with a styled background with rounded borders only the area inside of the border should be panned.

返回
An empty bitmap, indicating no mask

QwtPlotCachePanner 重载.

◆ cursor()

const QCursor QwtCachePanner::cursor ( ) const

Return the cursor that is active while panning

返回
Cursor active while panning
参见
setCursor()

◆ eventFilter()

bool QwtCachePanner::eventFilter ( QObject *  object,
QEvent *  event 
)
overridevirtual

Event filter

When isEnabled() is true mouse events of the observed widget are filtered.

参数
[in]objectObject to be filtered
[in]eventEvent
返回
Always false, beside for paint events for the parent widget
参见
widgetMousePressEvent(), widgetMouseReleaseEvent(), widgetMouseMoveEvent()

◆ getAbortKey()

void QwtCachePanner::getAbortKey ( int &  key,
Qt::KeyboardModifiers &  modifiers 
) const

Get the abort key and modifiers

参数
[out]keyKey code used for abort
[out]modifiersKeyboard modifiers used for abort

◆ getMouseButton()

void QwtCachePanner::getMouseButton ( Qt::MouseButton &  button,
Qt::KeyboardModifiers &  modifiers 
) const

Get mouse button and modifiers used for panning

参数
[out]buttonMouse button used for panning
[out]modifiersKeyboard modifiers used for panning

◆ grab()

QPixmap QwtCachePanner::grab ( ) const
protectedvirtual

Grab the widget into a pixmap

返回
Grabbed pixmap

QwtPlotCachePanner 重载.

◆ isEnabled()

bool QwtCachePanner::isEnabled ( ) const

Return whether the panner is enabled

返回
true when enabled, false otherwise
参见
setEnabled(), eventFilter()

◆ isOrientationEnabled()

bool QwtCachePanner::isOrientationEnabled ( Qt::Orientation  o) const

Check if an orientation is enabled

参数
[in]oOrientation to check
返回
True if the orientation is enabled
参见
orientations(), setOrientations()

◆ moved

void QwtCachePanner::moved ( int  dx,
int  dy 
)
signal

Signal emitted while the widget moved, but panning is not finished

参数
[in]dxOffset in horizontal direction
[in]dyOffset in vertical direction

◆ orientations()

Qt::Orientations QwtCachePanner::orientations ( ) const

Return the orientation where panning is enabled

返回
Orientation flags

◆ paintEvent()

void QwtCachePanner::paintEvent ( QPaintEvent *  event)
overrideprotectedvirtual

Paint event

Repaint the grabbed pixmap on its current position and fill the empty spaces by the background of the parent widget.

参数
[in]eventPaint event

◆ panned

void QwtCachePanner::panned ( int  dx,
int  dy 
)
signal

Signal emitted when panning is done

参数
[in]dxOffset in horizontal direction
[in]dyOffset in vertical direction

◆ setAbortKey()

void QwtCachePanner::setAbortKey ( int  key,
Qt::KeyboardModifiers  modifiers = Qt::NoModifier 
)

Change the abort key

The defaults are Qt::Key_Escape and Qt::NoModifiers

参数
[in]keyKey code (See Qt::Keycode)
[in]modifiersKeyboard modifiers

◆ setCursor()

void QwtCachePanner::setCursor ( const QCursor &  cursor)

Change the cursor that is active while panning

The default is the cursor of the parent widget.

参数
[in]cursorNew cursor
参见
setCursor()

◆ setEnabled()

void QwtCachePanner::setEnabled ( bool  on)

En/disable the panner

When enabled is true an event filter is installed for the observed widget, otherwise the event filter is removed.

参数
[in]ontrue or false
参见
isEnabled(), eventFilter()

◆ setMouseButton()

void QwtCachePanner::setMouseButton ( Qt::MouseButton  button,
Qt::KeyboardModifiers  modifiers = Qt::NoModifier 
)

Change the mouse button and modifiers used for panning

The defaults are Qt::LeftButton and Qt::NoModifier

参数
[in]buttonMouse button for panning
[in]modifiersKeyboard modifiers

◆ setOrientations()

void QwtCachePanner::setOrientations ( Qt::Orientations  o)

Set the orientations where panning is enabled

The default value is in both directions: Qt::Horizontal | Qt::Vertical

参数
[in]oOrientation flags

◆ widgetKeyPressEvent()

void QwtCachePanner::widgetKeyPressEvent ( QKeyEvent *  keyEvent)
protectedvirtual

Handle a key press event for the observed widget.

参数
keyEventKey event
参见
eventFilter(), widgetKeyReleaseEvent()

◆ widgetKeyReleaseEvent()

void QwtCachePanner::widgetKeyReleaseEvent ( QKeyEvent *  keyEvent)
protectedvirtual

Handle a key release event for the observed widget.

参数
keyEventKey event
参见
eventFilter(), widgetKeyReleaseEvent()

◆ widgetMouseMoveEvent()

void QwtCachePanner::widgetMouseMoveEvent ( QMouseEvent *  mouseEvent)
protectedvirtual

Handle a mouse move event for the observed widget.

参数
mouseEventMouse event
参见
eventFilter(), widgetMousePressEvent(), widgetMouseReleaseEvent()

◆ widgetMousePressEvent()

void QwtCachePanner::widgetMousePressEvent ( QMouseEvent *  mouseEvent)
protectedvirtual

Handle a mouse press event for the observed widget.

参数
mouseEventMouse event
参见
eventFilter(), widgetMouseReleaseEvent(), widgetMouseMoveEvent(),

QwtPolarCachePanner 重载.

◆ widgetMouseReleaseEvent()

void QwtCachePanner::widgetMouseReleaseEvent ( QMouseEvent *  mouseEvent)
protectedvirtual

Handle a mouse release event for the observed widget.

参数
mouseEventMouse event
参见
eventFilter(), widgetMousePressEvent(), widgetMouseMoveEvent(),

该类的文档由以下文件生成: