Envision
A visual programming IDE for object-oriented languages
|
Public Types | |
using | ItemCategories = QFlags< ItemCategory > |
enum | ItemCategory { NoItemCategory = 0x0 , CodeItemCategory = 0x1 , MenuItemCategory = 0x2 , SelectionItemCategory = 0x4 , CursorItemCategory = 0x8 } |
using | OnZoomHandler = std::function< void(qreal factor)> |
using | OnZoomHandlerRemove = std::function< void()> |
using | RefreshActionFunction = std::function< void(Scene *scene)> |
Public Member Functions | |
Scene () | |
virtual | ~Scene () |
int | addOnZoomHandler (OnZoomHandler onZoomHandler, OnZoomHandlerRemove onZoomHandlerRemove) |
OverlayGroup * | addOverlayGroup (const QString &name) |
void | addPostEventAction (CustomSceneEvent::EventFunction function) |
void | addPostEventAction (QEvent *action) |
Adds an action to be executed after the current event. More... | |
void | addRefreshActionFunction (RefreshActionFunction func) |
void | addTopLevelItem (Item *item, bool show=true) |
void | addTopLevelNode (Node *node, MajorMinorIndex index={}) |
QList< OverlayGroup * > | allOverlayGroups () const |
bool | approximateUpdate () |
View * | currentPaintView () const |
ViewItem * | currentViewItem () |
Convenience method to get the manager's current view item. More... | |
virtual void | customEvent (QEvent *event) override |
Item * | focusItem () const |
Returns the focused item if it is an instance of Item* or the closest of its ancestors that is an Item*. More... | |
bool | isCurrentMousePressAClick () const |
bool | isHiddenCategory (ItemCategory cat) |
QPointF | lastMouseHoverPosition () const |
void | listenToTreeManager (Model::TreeManager *manager) |
Cursor * | mainCursor () |
qreal | mainViewScalingFactor () const |
Returns the scaling factor applied by the main view associated of this item's scene. More... | |
void | nodesUpdated (QSet< Node * > modifiedNodes, QSet< Node * > removedNodes) |
OverlayGroup * | overlayGroup (const QString &name) |
qreal | previousMainViewScalingFactor () const |
Returns the scaling factor used before the active one. More... | |
void | removeAllOnZoomHandlers () |
void | removeOnZoomHandler (int onZoomHandlerId) |
void | removeOverlay (Item *overlay, const QString &groupName={}) |
void | removeOverlayGroup (const QString &name) |
void | removeOverlayGroup (OverlayGroup *group) |
void | removeOverlayOf (Item *itemWithOverlay, const QString &groupName={}) |
void | removeTopLevelItem (Item *item) |
ModelRenderer * | renderer () |
virtual SceneHandlerItem * | sceneHandlerItem () |
void | scheduleUpdate () |
QList< Item * > | selectedItems () const |
Returns a list of selected items. More... | |
void | setApproximateUpdate (bool b) |
void | setHiddenItemCategories (ItemCategories hidden=NoItemCategory) |
void | setItemIsSensitiveToScale (Item *item, bool update) |
void | setMainCursor (Cursor *cursor) |
void | setMainViewScalingFactor (qreal factor) |
void | setRenderer (ModelRenderer *renderer) |
const QList< Item * > & | topLevelItems () const |
void | updateNow () |
ViewItemManager * | viewItems () const |
Static Public Member Functions | |
static QList< Scene * > & | allScenes () |
Returns all existing scenes. More... | |
static ModelRenderer * | defaultRenderer () |
Protected Member Functions | |
virtual bool | event (QEvent *event) override |
virtual void | keyPressEvent (QKeyEvent *event) override |
virtual void | mouseDoubleClickEvent (QGraphicsSceneMouseEvent *mouseEvent) override |
virtual void | mouseMoveEvent (QGraphicsSceneMouseEvent *mouseEvent) override |
virtual void | mousePressEvent (QGraphicsSceneMouseEvent *mouseEvent) override |
virtual void | mouseReleaseEvent (QGraphicsSceneMouseEvent *mouseEvent) override |
Private Types | |
typedef Model::Node | Node |
Private Member Functions | |
void | computeSceneRect () |
QList< Item * > | itemsThatShouldHaveASelection () |
void | setCurrentPaintView (View *view) |
Private Attributes | |
bool | approximateUpdate_ {} |
View * | currentPaintView_ {} |
ItemCategories | hiddenItemCategories_ |
bool | inAnUpdate_ {} |
bool | inEventHandler_ {} |
bool | initialized_ {} |
bool | isCurrentMousePressAClick_ {} |
QSet< Item * > | itemsSensitiveToScale_ |
QPointF | lastMouseHoverPosition_ |
QElapsedTimer | lastMousePressTimer_ {} |
Cursor * | mainCursor_ {} |
bool | mainCursorsJustSet_ {} |
qreal | mainViewScalingFactor_ {1.0} |
bool | mainViewScalingFactorChanged_ {false} |
const int | MAX_MILLISECONDS_FOR_A_CLICK = 500 |
bool | needsUpdate_ {} |
QHash< int, QPair< OnZoomHandler, OnZoomHandlerRemove > > | onZoomHandlers_ |
QHash< QString, OverlayGroup * > | overlayGroups_ |
QList< QEvent * > | postEventActions_ |
qreal | previousMainViewScalingFactor_ {mainViewScalingFactor_} |
QList< RefreshActionFunction > | refreshActionFunctions_ |
ModelRenderer * | renderer_ {} |
SceneHandlerItem * | sceneHandlerItem_ {} |
QList< Item * > | topLevelItems_ |
ViewItemManager * | viewItemManager_ {} |
Static Private Attributes | |
static int | addOnZoomHandlerId_ = 0 |
Friends | |
class | View |
class | ViewItemManager |
using Visualization::Scene::ItemCategories = QFlags<ItemCategory> |
|
private |
using Visualization::Scene::OnZoomHandler = std::function<void (qreal factor)> |
using Visualization::Scene::OnZoomHandlerRemove = std::function<void ()> |
using Visualization::Scene::RefreshActionFunction = std::function<void (Scene* scene)> |
Visualization::Scene::Scene | ( | ) |
|
virtual |
int Visualization::Scene::addOnZoomHandler | ( | OnZoomHandler | onZoomHandler, |
OnZoomHandlerRemove | onZoomHandlerRemove | ||
) |
OverlayGroup * Visualization::Scene::addOverlayGroup | ( | const QString & | name | ) |
void Visualization::Scene::addPostEventAction | ( | CustomSceneEvent::EventFunction | function | ) |
void Visualization::Scene::addPostEventAction | ( | QEvent * | action | ) |
Adds an action to be executed after the current event.
This method can only be called while handling an event.
|
inline |
void Visualization::Scene::addTopLevelItem | ( | Item * | item, |
bool | show = true |
||
) |
void Visualization::Scene::addTopLevelNode | ( | Node * | node, |
MajorMinorIndex | index = {} |
||
) |
|
inline |
|
static |
Returns all existing scenes.
|
inline |
|
private |
|
inline |
ViewItem * Visualization::Scene::currentViewItem | ( | ) |
Convenience method to get the manager's current view item.
|
overridevirtual |
|
static |
|
overrideprotectedvirtual |
Item * Visualization::Scene::focusItem | ( | ) | const |
Returns the focused item if it is an instance of Item* or the closest of its ancestors that is an Item*.
This method hides QGraphicsScene::focusItem() const.
|
inline |
|
inline |
|
private |
|
overrideprotectedvirtual |
|
inline |
void Visualization::Scene::listenToTreeManager | ( | Model::TreeManager * | manager | ) |
|
inline |
|
inline |
Returns the scaling factor applied by the main view associated of this item's scene.
|
overrideprotectedvirtual |
|
overrideprotectedvirtual |
|
overrideprotectedvirtual |
|
overrideprotectedvirtual |
void Visualization::Scene::nodesUpdated | ( | QSet< Node * > | modifiedNodes, |
QSet< Node * > | removedNodes | ||
) |
OverlayGroup * Visualization::Scene::overlayGroup | ( | const QString & | name | ) |
|
inline |
Returns the scaling factor used before the active one.
void Visualization::Scene::removeAllOnZoomHandlers | ( | ) |
void Visualization::Scene::removeOnZoomHandler | ( | int | onZoomHandlerId | ) |
void Visualization::Scene::removeOverlay | ( | Item * | overlay, |
const QString & | groupName = {} |
||
) |
void Visualization::Scene::removeOverlayGroup | ( | const QString & | name | ) |
void Visualization::Scene::removeOverlayGroup | ( | OverlayGroup * | group | ) |
void Visualization::Scene::removeOverlayOf | ( | Item * | itemWithOverlay, |
const QString & | groupName = {} |
||
) |
void Visualization::Scene::removeTopLevelItem | ( | Item * | item | ) |
|
inline |
|
inlinevirtual |
void Visualization::Scene::scheduleUpdate | ( | ) |
QList< Item * > Visualization::Scene::selectedItems | ( | ) | const |
|
inline |
|
private |
|
inline |
void Visualization::Scene::setItemIsSensitiveToScale | ( | Item * | item, |
bool | update | ||
) |
void Visualization::Scene::setMainCursor | ( | Cursor * | cursor | ) |
void Visualization::Scene::setMainViewScalingFactor | ( | qreal | factor | ) |
|
inline |
|
inline |
void Visualization::Scene::updateNow | ( | ) |
|
inline |
|
friend |
|
friend |
|
staticprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |