gsdview.graphicsview

Classes adding simple graphics functionalities to GSDView.

Classes

BaseDrawTool([scene]) Abstract base class for all mouse tools needing draw operations.
BaseMouseTool() Abstract base class for all mouse tools.
BaseRectTool([scene]) Tool to draw a rectangle onto opened raster band.
GraphicsView(*args) A Graphics View emitting signals corresponding to events not handled
GraphicsViewMonitor Emit signals when a registered graphics view changes status.
MouseManager([defaultmodename]) Tools controller allowing user interacting with the scene.
PointerTool() Tool for mouse pointer mode.
RectAreaSelectionTool([scene])
ScrollTool() Tool for mouse scrolling mode.
SelectedItemsGroup Is only useful to group all selection items.
SelectedRectGroup Is only useful to group all selection rects.
SelectionTool([scene]) Tool for mouse selection mode.
class gsdview.graphicsview.BaseDrawTool(scene=None)

Abstract base class for all mouse tools needing draw operations.

drawingFinished(scene)
Useful to keep track if user is currently drawing and to restore item status. In fact while drawing all under items could be selected.
drawingStarted(scene)
Useful to keep track if user is currently drawing and to backup item status. In fact while drawing all under items could be selected.
class gsdview.graphicsview.BaseMouseTool

Abstract base class for all mouse tools.

Other mouse tools can be added subclassing it.

reset(started=False)
class gsdview.graphicsview.BaseRectTool(scene=None)

Tool to draw a rectangle onto opened raster band.

mouseMove(scene, scenepos, buttons)

Handle mouseMoveEvent for this tool.

Set rectangle last point on current cursor position. This point can be top-left or bottom-right one according to its position relative to the first one. Draw a rectangle ending to current cursor position.

mousePress(scene, scenepos, button)

Handle mousePressEvent for this tool.

Select the first point of the rectangle. Draw a rectangle collapsed in a single point.

mouseRelease(scene, scenepos, button)

Handle mouseReleaseEvent for this tool.

A flag indicating rectangle is not yet completed is set to False.

class gsdview.graphicsview.GraphicsView(*args)

A Graphics View emitting signals corresponding to events not handled by Qt (for example QMatrix transformations).

fitInView(*args)
Perform QGraphicsView action and emit ‘scaled()’ signal.
resetMatrix()
Perform QGraphicsView action and emit ‘scaled()’ signal.
scale(sx, sy)
Perform QGraphicsView action and emit ‘scaled()’ signal.
setMatrix(qmatrix)
Perform QGraphicsView action and emit ‘scaled()’ signal.
wheelEvent(event)

Reimplementation of QGraphicsView.wheelEvent handler.

Emit a signal but doesn’t call base implementation because view doesn’t have to scroll if you want to perform a custom operation with wheel event.

class gsdview.graphicsview.GraphicsViewMonitor

Emit signals when a registered graphics view changes status.

Signals :
  • scrolled(QGraphicsView*): scroll on graphicsview
  • resized(QGraphicsView*, QSize): emitted when the graphicsview window is resized
  • viewportResized(QGraphicsView*):
  • leave(QGraphicsView*):
  • scaled(QGraphicsView*)
  • wheel(int)
enter(scene)
eventFilter(obj, event)
leave(scene)
mouseMoved(scene, scenepos, buttons)
mousePressed(scene, scenepos, button)
mouseReleased(scene, scenepos, button)
register(graphicsview)
resized(graphcsview, size)
GraphicsViw resized
scaled(graphicsview)
scrolled(graphicsview)
viewportResized(graphicsview)
wheel(graphicsview, delta)
class gsdview.graphicsview.MouseManager(defaultmodename=None)

Tools controller allowing user interacting with the scene.

Extend QObject. It contains a private variable ‘_toolmap’ mapping toolnames to tool classes. ‘activetool’ keeps track of selected tool. ‘graphicsactions’ is a QActionGroup useful to have exclusive mouse modes group.

addtool(tool, action)

Add a new tool to ‘_toolmap’ dict and relative action to ‘graphcisactions’ action group.

Parameters :
  • ‘tool’: new tool instance
  • ‘action’: action related to new tool
areaSelected(scene, selected_rect)
defaultmode
alias of ScrollTool
forceActionFromMode(mousemodename)
get_actions()
Return graphicsactions.
mouseMoved(scene, scenepos, button)
mousePressed(scene, scenepos, button)
mouseReleased(scene, scenepos, button)
setmode(modename)

Set active graphics tool.

Parameters :
  • ‘modename’: mouse mode selected. It should be a key of ‘_toolmap’ dict
class gsdview.graphicsview.PointerTool
Tool for mouse pointer mode.
class gsdview.graphicsview.RectAreaSelectionTool(scene=None)
mousePress(scene, scenepos, button)
Handle mousePressEvent for this tool.
mouseRelease(scene, scenepos, button)
Handle mouseReleaseEvent for this tool.
class gsdview.graphicsview.ScrollTool
Tool for mouse scrolling mode.
class gsdview.graphicsview.SelectedItemsGroup
Is only useful to group all selection items.
class gsdview.graphicsview.SelectedRectGroup

Is only useful to group all selection rects.

It contains one item at a time

addToGroup(newitem)
delete containing items before adding a new one
clearSelections()
selection()
class gsdview.graphicsview.SelectionTool(scene=None)

Tool for mouse selection mode.

mousePress(scene, scenepos, button)

Handle mousePressEvent for this tool.

Select the first point of the selected rectangle.

mouseRelease(scene, scenepos, button)

Handle mouseReleaseEvent for this tool.

A flag indicating selection is not yet completed is set to False.

Previous topic

gsdview.qt4support

Next topic

gsdview.info

This Page