From f0c4bb1fa946357004a6534255af1cbeb74bdca2 Mon Sep 17 00:00:00 2001 From: Tats Date: Fri, 3 Jul 2015 17:21:11 -0600 Subject: [PATCH] Allow display of controls only in currently selected mapping. --- Mapper.cpp | 11 ++++++++++- Mapper.h | 6 +----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Mapper.cpp b/Mapper.cpp index 9c5d3bf..fb46317 100644 --- a/Mapper.cpp +++ b/Mapper.cpp @@ -21,6 +21,15 @@ #include "Mapper.h" #include "MainWindow.h" +void VertexGraphicsItem::paint(QPainter *painter, + const QStyleOptionGraphicsItem *option, + QWidget* widget) +{ + Q_UNUSED(widget); + if (((ShapeGraphicsItem*)parentItem())->getMapping()->getId() == MainWindow::instance()->getCurrentMappingId()) + Util::drawControlsVertex(painter, QPointF(0,0), (option->state & QStyle::State_Selected)); +} + ShapeGraphicsItem::ShapeGraphicsItem(Mapping::ptr mapping, bool output) : _mapping(mapping), _output(output) { @@ -230,7 +239,7 @@ void TextureGraphicsItem::_doPaint(QPainter *painter, // End drawing. _postDraw(painter); -// if (selected) + if (getMapping()->getId() == MainWindow::instance()->getCurrentMappingId()) _doDrawControls(painter); } diff --git a/Mapper.h b/Mapper.h index 0ccff79..732d724 100644 --- a/Mapper.h +++ b/Mapper.h @@ -105,11 +105,7 @@ public: virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, - QWidget* widget) - { - Q_UNUSED(widget); - Util::drawControlsVertex(painter, QPointF(0,0), (option->state & QStyle::State_Selected)); - } + QWidget* widget); protected: int _index;