NAME
BQViewportItem - BRTT Qt graphics extension graphics item base class
SYNOPSIS
$(QTNATIVELIBS) -lbqplot_native -lbanner -lbrttutil -lbumapdata $(DBLIBS) $(TRLIBS)
#include "BQ.h"
DESCRIPTION
The
BQViewportItem class acts as a base class for all
bqplot graphics items,
including viewports. This is a helper class that is not normally instantiated directly
by application programmers. This base class implements generic
bqplot object functionality.
CONSTRUCTOR
BQViewportItem(BQViewport *master, QWidget *widget, char *class_name=NULL, char *item_name=NULL, int register_item=1);
BQViewportItem(BQViewport *master, QWidget *widget, QString class_name, QString item_name, int register_item=1);
Where master is the BQViewport parent object, widget is the QWidget inherited object in cases where
the bqplot item inherits the QWidget class (which only happens for BQViewport objects), class_name is an optional class name for the object, item_name
is an optional object item name and register_item is a flag which if set will cause the object to be registered with the master viewport with
a call to BQViewport::registerItem(3).
BQViewportItem METHODS
-
void setLayer (QString name);
This will cause the object to be put into the BQLayer object buffer with name name (see BQLayer(3)). Note that this name will be modified
according to getFullName below.
The BQLayer object will automatically be created if an object with name name does not exist.
-
void removeLayer ();
This will cause the object to be disassociated with a layer buffer.
-
bool hasLayer();
This will return a boolean indicating if the object has a layer buffer associated with it.
-
BQLayer *getLayer();
This will return the BQLayer object pointer of an associated layer buffer.
-
QString getLayerName();
This will return the BQLayer object name of an associated layer buffer.
-
QString getFullLayerName(QString name);
The layer names used by BQLayer objects are usually different from the names
specified by the applicaiton programmer. The actual layer names used by BQLayer
objects are referred to as "full" layer names and include automatically generated
suffixes that associate each layer with the viewport that is its master. If a layer
name specified by the application programmer does not contain a ":" character,
then the name is automatically modified to be in the
form <name>:<viewport_name>. Each viewport autogenerates a
unique name when it is created and that name is appended to the specified <name>
string specified by the application program. If the specified <name>
string contains a ":" character, then the auto prefix is not added. This
function will return the full layer name for a program supplied name name.
-
void setItemStale ();
This causes the object's stale flag to be set. When the stale flag is set, then at the next repaint the item will be completely re-rendered.
This generally is only important when items are using layer buffers.
-
void setAntialias (bool antialias);
This sets or clears the Qt render hints antalias flag.
-
BQViewport *getViewportParent();
This will return an object's associated viewport.
-
void showItem();
-
void hideItem();
These will cause an object to be shown (displayed) or hidden (not displayed).
-
bool isShown();
Returns true if the item is currently shown or false otherwise.
-
void processItem();
-
void ignoreItem();
These will cause an object's event stream to be processed or ignored.
-
void setItemName(QString name);
This will set the item name.
-
QString getItemName();
This will get the item name.
-
void moveViewport(BQViewport *viewport);
This can be used to move an item's viewport to viewport.
-
virtual int processEvent (int type, QEvent *event);
-
virtual void drawViewportItem (QPainter *painter) = 0;
These are virtual functions that should be implemented by objects that inherit BQViewportItem.
The Qt event stream can be intercepted and processed with processEvent, where type
is the event type, one of BQ_QEVENT_TYPE_MOUSEPRESS, BQ_QEVENT_TYPE_MOUSEMOVE, BQ_QEVENT_TYPE_MOUSERELEASE, BQ_QEVENT_TYPE_KEYPRESS, BQ_QEVENT_TYPE_WHEEL, BQ_QEVENT_TYPE_ENTER, or BQ_QEVENT_TYPE_LEAVE,
and event is the QEvent object. processEvent should return either BQ_QEVENT_RETURN_OK, meaning the event was processed and should continue to
be propagated through the other items in the viewport display list, or BQ_QEVENT_RETURN_DONT_PROPAGATE, meaning the event was processed and should not be propagated
to the other items in the viewport display list. drawViewportItem is called whenever the item needs to be re-rendered. If the item is using a BQLayer backing store, then
the painter object pointer will point to the QPixmap associated with the BQLayer. Otherwise the painter object pointer will point to the QPainter
object associated with the display. Note that when an item has an associated BQLayer backing store, then this function will only be called when the item's stale flag has
been set. Also note that BQLayer item objects, also sub-classed from BQViewportItem, are always drawn to the display regardless of the stale flag.
SEE ALSO
bqplot(3),
BQViewport(3),
BQLayer(3)
AUTHOR
Danny Harvey, BRTT