|
HAL
v4.5.0-283-g3f42a39fa
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
|
#include </home/runner/work/hal/hal/plugins/clock_tree_viewer/include/clock_tree_viewer/clock_tree_scene.h>


Public Member Functions | |
| ClockTreeScene (QObject *parent=nullptr) | |
| void | setLayout (const ctv::Layout &layout, const ctv::Style &style, const ClockTreeColors &colors) |
| void | setColors (const ClockTreeColors &colors) |
| void | setHighlight (const QVector< int > &nodes) |
| void | clearLayout () |
| bool | hasLayout () const |
| const ctv::Style & | style () const |
| QColor | edgeColor () const |
| QColor | nodeColor (int index) const |
| const QVector< int > & | highlightedNodes () const |
| QRectF | highlightedRect () const |
| Result< QImage > | renderPicture (const QColor &background) |
Public Member Functions inherited from QGraphicsScene | |
| QGraphicsScene (QObject *parent) | |
| QGraphicsScene (const QRectF &sceneRect, QObject *parent) | |
| QGraphicsScene (qreal x, qreal y, qreal width, qreal height, QObject *parent) | |
| virtual | ~QGraphicsScene () |
| QRectF | sceneRect () const const |
| qreal | width () const const |
| qreal | height () const const |
| void | setSceneRect (const QRectF &rect) |
| void | setSceneRect (qreal x, qreal y, qreal w, qreal h) |
| void | render (QPainter *painter, const QRectF &target, const QRectF &source, Qt::AspectRatioMode aspectRatioMode) |
| QGraphicsScene::ItemIndexMethod | itemIndexMethod () const const |
| void | setItemIndexMethod (QGraphicsScene::ItemIndexMethod method) |
| bool | isSortCacheEnabled () const const |
| void | setSortCacheEnabled (bool enabled) |
| int | bspTreeDepth () const const |
| void | setBspTreeDepth (int depth) |
| QRectF | itemsBoundingRect () const const |
| QList< QGraphicsItem * > | items (Qt::SortOrder order) const const |
| QList< QGraphicsItem * > | items (const QPointF &pos, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const const |
| QList< QGraphicsItem * > | items (const QRectF &rect, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const const |
| QList< QGraphicsItem * > | items (const QPolygonF &polygon, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const const |
| QList< QGraphicsItem * > | items (const QPainterPath &path, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const const |
| QList< QGraphicsItem * > | collidingItems (const QGraphicsItem *item, Qt::ItemSelectionMode mode) const const |
| QGraphicsItem * | itemAt (const QPointF &position) const const |
| QGraphicsItem * | itemAt (const QPointF &position, const QTransform &deviceTransform) const const |
| QList< QGraphicsItem * > | items (qreal x, qreal y, qreal w, qreal h, Qt::ItemSelectionMode mode) const const |
| QList< QGraphicsItem * > | items (qreal x, qreal y, qreal w, qreal h, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const const |
| QGraphicsItem * | itemAt (qreal x, qreal y) const const |
| QGraphicsItem * | itemAt (qreal x, qreal y, const QTransform &deviceTransform) const const |
| QList< QGraphicsItem * > | selectedItems () const const |
| QPainterPath | selectionArea () const const |
| void | setSelectionArea (const QPainterPath &path, const QTransform &deviceTransform) |
| void | setSelectionArea (const QPainterPath &path, Qt::ItemSelectionMode mode, const QTransform &deviceTransform) |
| void | setSelectionArea (const QPainterPath &path, Qt::ItemSelectionOperation selectionOperation, Qt::ItemSelectionMode mode, const QTransform &deviceTransform) |
| QGraphicsItemGroup * | createItemGroup (const QList< QGraphicsItem * > &items) |
| void | destroyItemGroup (QGraphicsItemGroup *group) |
| void | addItem (QGraphicsItem *item) |
| QGraphicsEllipseItem * | addEllipse (const QRectF &rect, const QPen &pen, const QBrush &brush) |
| QGraphicsLineItem * | addLine (const QLineF &line, const QPen &pen) |
| QGraphicsPathItem * | addPath (const QPainterPath &path, const QPen &pen, const QBrush &brush) |
| QGraphicsPixmapItem * | addPixmap (const QPixmap &pixmap) |
| QGraphicsPolygonItem * | addPolygon (const QPolygonF &polygon, const QPen &pen, const QBrush &brush) |
| QGraphicsRectItem * | addRect (const QRectF &rect, const QPen &pen, const QBrush &brush) |
| QGraphicsTextItem * | addText (const QString &text, const QFont &font) |
| QGraphicsSimpleTextItem * | addSimpleText (const QString &text, const QFont &font) |
| QGraphicsProxyWidget * | addWidget (QWidget *widget, Qt::WindowFlags wFlags) |
| QGraphicsEllipseItem * | addEllipse (qreal x, qreal y, qreal w, qreal h, const QPen &pen, const QBrush &brush) |
| QGraphicsLineItem * | addLine (qreal x1, qreal y1, qreal x2, qreal y2, const QPen &pen) |
| QGraphicsRectItem * | addRect (qreal x, qreal y, qreal w, qreal h, const QPen &pen, const QBrush &brush) |
| void | removeItem (QGraphicsItem *item) |
| QGraphicsItem * | focusItem () const const |
| void | setFocusItem (QGraphicsItem *item, Qt::FocusReason focusReason) |
| bool | hasFocus () const const |
| void | setFocus (Qt::FocusReason focusReason) |
| void | clearFocus () |
| void | setStickyFocus (bool enabled) |
| bool | stickyFocus () const const |
| QGraphicsItem * | mouseGrabberItem () const const |
| QBrush | backgroundBrush () const const |
| void | setBackgroundBrush (const QBrush &brush) |
| QBrush | foregroundBrush () const const |
| void | setForegroundBrush (const QBrush &brush) |
| virtual QVariant | inputMethodQuery (Qt::InputMethodQuery query) const const |
| QList< QGraphicsView * > | views () const const |
| void | update (qreal x, qreal y, qreal w, qreal h) |
| void | invalidate (qreal x, qreal y, qreal w, qreal h, QGraphicsScene::SceneLayers layers) |
| QStyle * | style () const const |
| void | setStyle (QStyle *style) |
| QFont | font () const const |
| void | setFont (const QFont &font) |
| QPalette | palette () const const |
| void | setPalette (const QPalette &palette) |
| bool | isActive () const const |
| QGraphicsItem * | activePanel () const const |
| void | setActivePanel (QGraphicsItem *item) |
| QGraphicsWidget * | activeWindow () const const |
| void | setActiveWindow (QGraphicsWidget *widget) |
| bool | sendEvent (QGraphicsItem *item, QEvent *event) |
| qreal | minimumRenderSize () const const |
| void | setMinimumRenderSize (qreal minSize) |
| bool | focusOnTouch () const const |
| void | setFocusOnTouch (bool enabled) |
| void | update (const QRectF &rect) |
| void | invalidate (const QRectF &rect, QGraphicsScene::SceneLayers layers) |
| void | advance () |
| void | clearSelection () |
| void | clear () |
| void | changed (const QList< QRectF > ®ion) |
| void | sceneRectChanged (const QRectF &rect) |
| void | selectionChanged () |
| void | focusItemChanged (QGraphicsItem *newFocusItem, QGraphicsItem *oldFocusItem, Qt::FocusReason reason) |
Public Member Functions inherited from QObject | |
| virtual const QMetaObject * | metaObject () const const |
| QObject (QObject *parent) | |
| virtual | ~QObject () |
| QString | objectName () const const |
| void | setObjectName (const QString &name) |
| bool | isWidgetType () const const |
| bool | isWindowType () const const |
| bool | signalsBlocked () const const |
| bool | blockSignals (bool block) |
| QThread * | thread () const const |
| void | moveToThread (QThread *targetThread) |
| int | startTimer (int interval, Qt::TimerType timerType) |
| int | startTimer (std::chrono::milliseconds time, Qt::TimerType timerType) |
| void | killTimer (int id) |
| T | findChild (const QString &name, Qt::FindChildOptions options) const const |
| QList< T > | findChildren (const QString &name, Qt::FindChildOptions options) const const |
| QList< T > | findChildren (const QRegExp ®Exp, Qt::FindChildOptions options) const const |
| QList< T > | findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const |
| const QObjectList & | children () const const |
| void | setParent (QObject *parent) |
| void | installEventFilter (QObject *filterObj) |
| void | removeEventFilter (QObject *obj) |
| QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const |
| bool | disconnect (const char *signal, const QObject *receiver, const char *method) const const |
| bool | disconnect (const QObject *receiver, const char *method) const const |
| void | dumpObjectTree () |
| void | dumpObjectInfo () |
| void | dumpObjectTree () const const |
| void | dumpObjectInfo () const const |
| bool | setProperty (const char *name, const QVariant &value) |
| QVariant | property (const char *name) const const |
| QList< QByteArray > | dynamicPropertyNames () const const |
| void | destroyed (QObject *obj) |
| void | objectNameChanged (const QString &objectName) |
| QObject * | parent () const const |
| bool | inherits (const char *className) const const |
| void | deleteLater () |
| Q_DISABLE_COPY (Class) | |
| Q_DISABLE_MOVE (Class) | |
| Q_DISABLE_COPY_MOVE (Class) | |
| T | qobject_cast (QObject *object) |
| T | qobject_cast (const QObject *object) |
| T | qFindChild (const QObject *obj, const QString &name) |
| QList< T > | qFindChildren (const QObject *obj, const QString &name) |
| QList< T > | qFindChildren (const QObject *obj, const QRegExp ®Exp) |
| Q_CLASSINFO (Name, Value) | |
| Q_INTERFACES (...) | |
| Q_PROPERTY (...) | |
| Q_ENUMS (...) | |
| Q_FLAGS (...) | |
| Q_ENUM (...) | |
| Q_FLAG (...) | |
| Q_ENUM_NS (...) | |
| Q_FLAG_NS (...) | |
| Q_OBJECT Q_OBJECT | |
| Q_GADGET Q_GADGET | |
| Q_NAMESPACE Q_NAMESPACE | |
| Q_NAMESPACE_EXPORT (EXPORT_MACRO) | |
| Q_SIGNALS Q_SIGNALS | |
| Q_SIGNAL Q_SIGNAL | |
| Q_SLOTS Q_SLOTS | |
| Q_SLOT Q_SLOT | |
| Q_EMIT Q_EMIT | |
| Q_INVOKABLE Q_INVOKABLE | |
| Q_REVISION Q_REVISION | |
| Q_SET_OBJECT_NAME (Object) | |
| QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT | |
Static Public Member Functions | |
| static QPointF | fromChip (double x, double y) |
| static QPointF | toChip (const QPointF &scenePosition) |
Static Public Member Functions inherited from QObject | |
| QString | tr (const char *sourceText, const char *disambiguation, int n) |
| QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
| QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
| QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
| QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type) |
| QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, Functor functor) |
| QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type) |
| bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
| bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
| bool | disconnect (const QMetaObject::Connection &connection) |
| bool | disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method) |
The scene that holds the drawing of a clock tree: a line for every connection and a dot for every gate.
Gates can be highlighted by a ring around them. The ring has the same size on the screen at every zoom, so a single gate can be found in a drawing of the whole chip, where the dot of a gate is far smaller than a pixel.
The scene paints no background of its own, the view shows its own. Chip coordinates have their origin in the lower left corner, the scene's y axis points down. The scene therefore stores the chip's y coordinate negated, use fromChip and toChip to convert.
Definition at line 69 of file clock_tree_scene.h.
|
explicit |
Construct an empty scene.
| [in] | parent | - The parent object. Defaults to a nullptr. |
Definition at line 63 of file clock_tree_scene.cpp.
| void hal::ClockTreeScene::clearLayout | ( | ) |
Remove the drawing.
Definition at line 254 of file clock_tree_scene.cpp.
References QVector::clear(), QGraphicsScene::clear(), and QGraphicsScene::setSceneRect().
Referenced by setLayout().
|
inline |
Get the color the lines are painted in.
Definition at line 146 of file clock_tree_scene.h.
|
static |
Get the position in the scene of a position on the chip.
| [in] | x | - The x coordinate on the chip. |
| [in] | y | - The y coordinate on the chip. |
Definition at line 70 of file clock_tree_scene.cpp.
Referenced by setLayout().
|
inline |
Check whether a drawing is shown.
true if there is a drawing, false otherwise. Definition at line 129 of file clock_tree_scene.h.
Referenced by hal::ClockTreeGraphicsView::showArea().
|
inline |
Get the gates that are highlighted.
ctv::Layout::nodes, sorted. Definition at line 167 of file clock_tree_scene.h.
| QRectF hal::ClockTreeScene::highlightedRect | ( | ) | const |
Get the area that the highlighted gates are in.
highlightedNodes to tell them apart. Definition at line 230 of file clock_tree_scene.cpp.
References QVector::first(), QVector::isEmpty(), x, and y.
|
inline |
Get the color a dot is painted in.
| [in] | index | - The index of the gate in ctv::Layout::nodes. |
Definition at line 157 of file clock_tree_scene.h.
References index, and QVector::value().
Render the whole drawing and its margin into a picture, independent of any view and its zoom. Highlights are part of the picture.
A picture that would be larger than ctv::MAX_PICTURE_SIDE_PIXELS on a side gets a lower resolution than the style asks for, unless the user chose that resolution.
| [in] | background | - The color of the background, which the scene does not paint. |
Definition at line 278 of file clock_tree_scene.cpp.
References QRectF::adjusted(), QPainter::Antialiasing, QPainter::end(), ERR, QImage::fill(), QImage::Format_RGB32, QRectF::height(), QGraphicsScene::height(), QImage::isNull(), QColor::isValid(), hal::ctv::MAX_PICTURE_SIDE_PIXELS, OK, hal::ctv::Style::picture_margin, hal::ctv::Style::pixels_per_unit, hal::ctv::Style::pixels_per_unit_is_fixed, QGraphicsScene::render(), QPainter::setRenderHint(), Qt::white, QRectF::width(), and QGraphicsScene::width().
Referenced by hal::ClockTreeViewer::savePicture().
| void hal::ClockTreeScene::setColors | ( | const ClockTreeColors & | colors | ) |
Paint the current drawing in other colors. Only what actually changes color is repainted.
| [in] | colors | - The new colors, for the gates and connections of the layout that is shown. |
Definition at line 134 of file clock_tree_scene.cpp.
References hal::ctv::Style::edge_width, QPen::setCosmetic(), and QVector::size().
| void hal::ClockTreeScene::setHighlight | ( | const QVector< int > & | nodes | ) |
Highlight gates by a ring around each of them, instead of the ones that were highlighted before.
| [in] | nodes | - The gates, as indices into ctv::Layout::nodes. Indices that are out of range are ignored. |
Definition at line 181 of file clock_tree_scene.cpp.
References QGraphicsScene::addItem(), QVector::begin(), QVector::clear(), QVector::end(), QVector::erase(), QGraphicsItem::ItemIgnoresTransformations, Qt::NoBrush, QVector::push_back(), QVector::reserve(), QPen::setCosmetic(), and QVector::size().
| void hal::ClockTreeScene::setLayout | ( | const ctv::Layout & | layout, |
| const ctv::Style & | style, | ||
| const ClockTreeColors & | colors | ||
| ) |
Replace the drawing. The scene is as large as the tree plus the picture margin on every side.
| [in] | layout | - The gates and connections to draw. |
| [in] | style | - The sizes to draw them with. |
| [in] | colors | - The colors to draw them with. |
Definition at line 86 of file clock_tree_scene.cpp.
References QGraphicsScene::addEllipse(), QGraphicsScene::addLine(), QRectF::adjusted(), clearLayout(), hal::ctv::Style::edge_width, hal::ctv::Layout::edges, hal::ctv::Edge::from, fromChip(), QGraphicsScene::itemsBoundingRect(), hal::ctv::Style::node_radius, hal::ctv::Layout::nodes, hal::ctv::Style::picture_margin, QVector::push_back(), QVector::reserve(), QGraphicsScene::setSceneRect(), style(), hal::core_strings::to(), hal::ctv::Edge::to, hal::ctv::Node::x, and hal::ctv::Node::y.
| const ctv::Style & hal::ClockTreeScene::style | ( | ) | const |
Get the sizes the current drawing was made with.
Definition at line 273 of file clock_tree_scene.cpp.
Referenced by setLayout(), and hal::ClockTreeGraphicsView::showArea().
Get the position on the chip of a position in the scene.
| [in] | scenePosition | - The position in the scene. |
Definition at line 75 of file clock_tree_scene.cpp.
References QPointF::x(), and QPointF::y().
Referenced by hal::ClockTreeGraphicsView::mouseMoveEvent().