#ifndef PB_ACTIONSELECTITEMDRAWABLEGV_H #define PB_ACTIONSELECTITEMDRAWABLEGV_H #include #include "ct_actions/abstract/ct_abstractactionforgraphicsview.h" /** * @brief Action to select items, points, faces, edges, etc... * * You can use this action in your action if you want. Just call methods : * * init() * mousePressEvent() * etc..... * * in methods of your action. * * Dont forget to set the selection mode => setSelectionMode method */ class PB_ActionSelectItemDrawableGV : public CT_AbstractActionForGraphicsView { Q_OBJECT public: PB_ActionSelectItemDrawableGV(); QString uniqueName() const; QString title() const; QString description() const; QIcon icon() const; QString type() const; void init(); bool mousePressEvent(QMouseEvent *e); bool mouseMoveEvent(QMouseEvent *e); bool mouseReleaseEvent(QMouseEvent *e); bool keyPressEvent(QKeyEvent *e); bool keyReleaseEvent(QKeyEvent *e); void drawOverlay(GraphicsViewInterface &view, QPainter &painter); CT_AbstractAction* copy() const; /** * @brief change the selection mode for this action. The mode will be set to view * when the mousePressEvent() method is called * @return false if we are between mousePressEvent() and mouseReleaseEvent() */ bool setSelectionMode(GraphicsViewInterface::SelectionMode mode); GraphicsViewInterface::SelectionMode selectionMode() const; private: QRect m_selectionRectangle; int m_status; GraphicsViewInterface::SelectionMode m_selectionMode; bool m_mousePressed; GraphicsViewInterface::SelectionMode selectionModeToBasic(GraphicsViewInterface::SelectionMode mode) const; private slots: void redrawOverlay(); }; #endif // PB_ACTIONSELECTITEMDRAWABLEGV_H