AstBrowserWidget Class Reference

Treeview for browsing a Sage-AST. More...

#include <AstBrowserWidget.h>

Inheritance diagram for AstBrowserWidget:

Inheritance graph
[legend]
List of all members.

Public Slots

virtual void setNode (SgNode *node)
 Sets the root node of the View.
virtual bool gotoNode (SgNode *node)
virtual void setFilter (AstFilterInterface *newFilter)
virtual void setFileFilter (int fileId)
 Convenience function which creates an AstFilterFileById and filters the view with it.

Signals

void nodeActivated (SgNode *node)
void nodeActivatedAlt (SgNode *node)
void clicked (const QString &file, int startRow, int startCol, int endRow, int endCol)
 Emitted when clicked, provides the sourcefile and position of the SgNode (can be connected to an editor).
void nodeDropped (SgNode *node, const QPoint &p)

Public Member Functions

 AstBrowserWidget (QWidget *parent=0)
 AstBrowserWidget (SgNode *node, QWidget *parent=0)
virtual ~AstBrowserWidget ()
void setSgDragEnabled (bool b)
void setSgDropEnabled (bool b)
bool isSgDragEnabled () const
bool isSgDropEnabled () const
void addArrow (const QModelIndex &i1, const QModelIndex &i2)
void removeAllArrows ()

Protected Slots

virtual void viewClicked (const QModelIndex &ind)
void viewDoubleClicked (const QModelIndex &ind)

Protected Member Functions

virtual void dragEnterEvent (QDragEnterEvent *ev)
virtual void dragMoveEvent (QDragMoveEvent *ev)
virtual void dropEvent (QDropEvent *ev)
virtual void mousePressEvent (QMouseEvent *event)
virtual void mouseMoveEvent (QMouseEvent *event)
virtual bool acceptMimeData (const QMimeData *mimeData)
virtual void handleMimeData (const QMimeData *mimeData, const QPoint &pos)
 extracts and takes proper action for the arrived mimeData
virtual void paintEvent (QPaintEvent *ev)
void drawArrowBezier (const QPoint &p1, const QPoint &p2, QPainter *painter, float curvature)
void normalizeVec (QPointF &vec) const
QPointF getOrtho (const QPointF &input, bool direction=true) const
virtual void updateModel ()

Protected Attributes

QtAstModelmodel
QList< QPair< QModelIndex,
QModelIndex > > 
arrows
AstFilterInterfacecurFilter
SgNode * curNode
QPoint dragStartPosition
 position of mouseclick, used for d&d functions
bool dragEnabled
 if SgNodes can be dragged out of this view
bool dropEnabled
 if SgNodes can be dropped at this view

Properties

bool SgDragEnabled []
bool SgDropEnabled []

Detailed Description

Treeview for browsing a Sage-AST.

AstBrowserWidget.jpg

This view shows a Qt-TreeView of a Sage-AST.
For changing the display call setNode() which sets a new rootNode or gotoNode() which selects a given node

If the user clicks on a node the signal nodeActivated() is emitted, on when double clicking nodeActivatedAlt() is called

It's possible to filter the view with an AstFilterInterface. For example filtering out all nodes which are part of header files etc.

To get icons and node-descriptions the functions in namespace AstDisplayInfo are used

A custom model is used for respresenting the AST: QtAstModel

Definition at line 29 of file AstBrowserWidget.h.


Constructor & Destructor Documentation

AstBrowserWidget::AstBrowserWidget ( QWidget *  parent = 0  ) 

Definition at line 9 of file AstBrowserWidget.cpp.

AstBrowserWidget::AstBrowserWidget ( SgNode *  node,
QWidget *  parent = 0 
)

Definition at line 20 of file AstBrowserWidget.cpp.

AstBrowserWidget::~AstBrowserWidget (  )  [virtual]

Definition at line 29 of file AstBrowserWidget.cpp.


Member Function Documentation

bool RoseTreeView::acceptMimeData ( const QMimeData *  mimeData  )  [protected, virtual, inherited]

handler to decide wether to accept a certain mime data default is to accept application/SgNode to support application/SgNode-* overwrite these two functions in the derived class

Definition at line 195 of file RoseTreeView.cpp.

Referenced by RoseTreeView::dragEnterEvent().

Here is the caller graph for this function:

void RoseTreeView::addArrow ( const QModelIndex &  i1,
const QModelIndex &  i2 
) [inherited]

Definition at line 207 of file RoseTreeView.cpp.

Referenced by AsmView::addArrows().

Here is the caller graph for this function:

void RoseTreeView::clicked ( const QString &  file,
int  startRow,
int  startCol,
int  endRow,
int  endCol 
) [signal, inherited]

Emitted when clicked, provides the sourcefile and position of the SgNode (can be connected to an editor).

Referenced by RoseTreeView::RoseTreeView(), and RoseTreeView::viewClicked().

void RoseTreeView::dragEnterEvent ( QDragEnterEvent *  ev  )  [protected, virtual, inherited]

Definition at line 171 of file RoseTreeView.cpp.

Here is the call graph for this function:

void RoseTreeView::dragMoveEvent ( QDragMoveEvent *  ev  )  [protected, virtual, inherited]

Definition at line 179 of file RoseTreeView.cpp.

void RoseTreeView::drawArrowBezier ( const QPoint &  p1,
const QPoint &  p2,
QPainter *  painter,
float  curvature 
) [protected, inherited]

Definition at line 266 of file RoseTreeView.cpp.

Referenced by RoseTreeView::paintEvent().

Here is the call graph for this function:

Here is the caller graph for this function:

void RoseTreeView::dropEvent ( QDropEvent *  ev  )  [protected, virtual, inherited]

Definition at line 185 of file RoseTreeView.cpp.

Here is the call graph for this function:

QPointF RoseTreeView::getOrtho ( const QPointF &  input,
bool  direction = true 
) const [protected, inherited]

Definition at line 259 of file RoseTreeView.cpp.

Referenced by RoseTreeView::drawArrowBezier().

Here is the caller graph for this function:

virtual bool AstBrowserWidget::gotoNode ( SgNode *  node  )  [inline, virtual, slot]

Reimplemented from RoseTreeView.

Definition at line 41 of file AstBrowserWidget.h.

void RoseTreeView::handleMimeData ( const QMimeData *  mimeData,
const QPoint &  pos 
) [protected, virtual, inherited]

extracts and takes proper action for the arrived mimeData

Definition at line 200 of file RoseTreeView.cpp.

Referenced by RoseTreeView::dropEvent().

Here is the call graph for this function:

Here is the caller graph for this function:

bool RoseTreeView::isSgDragEnabled (  )  const [inline, inherited]

Definition at line 43 of file RoseTreeView.h.

bool RoseTreeView::isSgDropEnabled (  )  const [inline, inherited]

Definition at line 44 of file RoseTreeView.h.

void RoseTreeView::mouseMoveEvent ( QMouseEvent *  event  )  [protected, virtual, inherited]

Definition at line 136 of file RoseTreeView.cpp.

Here is the call graph for this function:

void RoseTreeView::mousePressEvent ( QMouseEvent *  event  )  [protected, virtual, inherited]

Reimplemented in ProjectView.

Definition at line 128 of file RoseTreeView.cpp.

Referenced by ProjectView::mousePressEvent().

Here is the caller graph for this function:

void RoseTreeView::nodeActivated ( SgNode *  node  )  [signal, inherited]

Emitted if clicked on an Entry warning: may be null (appropriate action would be to clear the attached view)

Referenced by AstBrowserWidget(), and RoseTreeView::viewClicked().

void RoseTreeView::nodeActivatedAlt ( SgNode *  node  )  [signal, inherited]

Referenced by AstBrowserWidget(), and RoseTreeView::viewDoubleClicked().

void RoseTreeView::nodeDropped ( SgNode *  node,
const QPoint &  p 
) [signal, inherited]

Referenced by AsmView::AsmView(), AstBrowserWidget(), BAstView::BAstView(), and RoseTreeView::handleMimeData().

void RoseTreeView::normalizeVec ( QPointF &  vec  )  const [protected, inherited]

Definition at line 250 of file RoseTreeView.cpp.

Referenced by RoseTreeView::drawArrowBezier().

Here is the caller graph for this function:

void RoseTreeView::paintEvent ( QPaintEvent *  ev  )  [protected, virtual, inherited]

Definition at line 220 of file RoseTreeView.cpp.

Here is the call graph for this function:

void RoseTreeView::removeAllArrows (  )  [inherited]

Definition at line 213 of file RoseTreeView.cpp.

Referenced by AsmView::selectionChanged().

void AstBrowserWidget::setFileFilter ( int  fileId  )  [virtual, slot]

Convenience function which creates an AstFilterFileById and filters the view with it.

Definition at line 48 of file AstBrowserWidget.cpp.

void AstBrowserWidget::setFilter ( AstFilterInterface newFilter  )  [virtual, slot]

Filters the view by using an AstFilterInterface

Parameters:
newFilter the filter, for resetting (show all nodes) use NULL

Reimplemented from RoseTreeView.

Definition at line 40 of file AstBrowserWidget.cpp.

Referenced by setFileFilter().

void AstBrowserWidget::setNode ( SgNode *  node  )  [virtual, slot]

Sets the root node of the View.

Reimplemented from RoseTreeView.

Definition at line 35 of file AstBrowserWidget.cpp.

Referenced by AstBrowserWidget().

void RoseTreeView::setSgDragEnabled ( bool  b  )  [inline, inherited]

Definition at line 40 of file RoseTreeView.h.

void RoseTreeView::setSgDropEnabled ( bool  b  )  [inline, inherited]

Definition at line 41 of file RoseTreeView.h.

Referenced by ProjectView::ProjectView().

Here is the caller graph for this function:

virtual void RoseTreeView::updateModel (  )  [inline, protected, virtual, inherited]

Reimplemented in AsmView, BAstView, and ProjectView.

Definition at line 97 of file RoseTreeView.h.

Referenced by RoseTreeView::RoseTreeView(), RoseTreeView::setFilter(), and RoseTreeView::setNode().

Here is the caller graph for this function:

void RoseTreeView::viewClicked ( const QModelIndex &  ind  )  [protected, virtual, slot, inherited]

Definition at line 77 of file RoseTreeView.cpp.

Referenced by AstBrowserWidget(), and RoseTreeView::RoseTreeView().

void RoseTreeView::viewDoubleClicked ( const QModelIndex &  ind  )  [protected, slot, inherited]

Definition at line 108 of file RoseTreeView.cpp.

Referenced by AstBrowserWidget(), and RoseTreeView::RoseTreeView().


Member Data Documentation

QList<QPair<QModelIndex,QModelIndex> > RoseTreeView::arrows [protected, inherited]

Definition at line 95 of file RoseTreeView.h.

Referenced by RoseTreeView::addArrow(), RoseTreeView::paintEvent(), and RoseTreeView::removeAllArrows().

AstFilterInterface* RoseTreeView::curFilter [protected, inherited]

The user calls setNode and filter, the new values are stored here then updateView is called

Definition at line 104 of file RoseTreeView.h.

Referenced by RoseTreeView::setFilter(), BAstView::updateModel(), and AsmView::updateModel().

SgNode* RoseTreeView::curNode [protected, inherited]

Definition at line 105 of file RoseTreeView.h.

Referenced by AsmView::contextMenuEvent(), AsmView::on_nodeDropped(), RoseTreeView::setNode(), BAstView::updateModel(), and AsmView::updateModel().

bool RoseTreeView::dragEnabled [protected, inherited]

if SgNodes can be dragged out of this view

Definition at line 110 of file RoseTreeView.h.

Referenced by RoseTreeView::isSgDragEnabled(), RoseTreeView::mouseMoveEvent(), and RoseTreeView::setSgDragEnabled().

QPoint RoseTreeView::dragStartPosition [protected, inherited]

position of mouseclick, used for d&d functions

Definition at line 109 of file RoseTreeView.h.

Referenced by RoseTreeView::mouseMoveEvent(), and RoseTreeView::mousePressEvent().

bool RoseTreeView::dropEnabled [protected, inherited]

if SgNodes can be dropped at this view

Definition at line 111 of file RoseTreeView.h.

Referenced by RoseTreeView::acceptMimeData(), RoseTreeView::dropEvent(), RoseTreeView::isSgDropEnabled(), and RoseTreeView::setSgDropEnabled().

QtAstModel* AstBrowserWidget::model [protected]

Reimplemented from RoseTreeView.

Definition at line 53 of file AstBrowserWidget.h.

Referenced by AstBrowserWidget(), setFilter(), setNode(), and ~AstBrowserWidget().


Property Documentation

bool RoseTreeView::SgDragEnabled [read, write, inherited]

Definition at line 33 of file RoseTreeView.h.

bool RoseTreeView::SgDropEnabled [read, write, inherited]

Definition at line 33 of file RoseTreeView.h.


The documentation for this class was generated from the following files:
Generated on Tue Sep 15 14:48:48 2009 for RoseQtWidgets by  doxygen 1.4.7