diff --git a/src/board/UBBoardView.cpp b/src/board/UBBoardView.cpp index 3dd30148..a1315084 100644 --- a/src/board/UBBoardView.cpp +++ b/src/board/UBBoardView.cpp @@ -516,8 +516,6 @@ void UBBoardView::mousePressEvent (QMouseEvent *event) } } -QSet mJustSelectedItems; - void UBBoardView::mouseMoveEvent (QMouseEvent *event) { @@ -563,7 +561,8 @@ UBBoardView::mouseMoveEvent (QMouseEvent *event) || item->type() == UBGraphicsPixmapItem::Type || item->type() == UBGraphicsVideoItem::Type || item->type() == UBGraphicsAudioItem::Type - || item->type() == UBGraphicsSvgItem::Type) { + || item->type() == UBGraphicsSvgItem::Type + || item->type() == UBGraphicsTextItem::Type) { if (!mJustSelectedItems.contains(item)) { item->setSelected(true); diff --git a/src/board/UBBoardView.h b/src/board/UBBoardView.h index a0d0e838..21bc12b8 100644 --- a/src/board/UBBoardView.h +++ b/src/board/UBBoardView.h @@ -125,6 +125,7 @@ class UBBoardView : public QGraphicsView QMouseEvent *suspendedMousePressEvent; UBRubberBand *mUBRubberBand; + QSet mJustSelectedItems; private slots: diff --git a/src/domain/UBGraphicsItemDelegate.h b/src/domain/UBGraphicsItemDelegate.h index f560b546..cc3c8e3b 100644 --- a/src/domain/UBGraphicsItemDelegate.h +++ b/src/domain/UBGraphicsItemDelegate.h @@ -4,7 +4,7 @@ * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * This prograscenem is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. diff --git a/src/domain/UBGraphicsScene.cpp b/src/domain/UBGraphicsScene.cpp index c7fa1ff8..496338ab 100644 --- a/src/domain/UBGraphicsScene.cpp +++ b/src/domain/UBGraphicsScene.cpp @@ -1784,7 +1784,6 @@ QGraphicsItem* UBGraphicsScene::scaleToFitDocumentSize(QGraphicsItem* item, bool return item; } - void UBGraphicsScene::addRuler(QPointF center) { UBGraphicsRuler* ruler = new UBGraphicsRuler(); // mem : owned and destroyed by the scene diff --git a/src/domain/UBGraphicsWidgetItem.cpp b/src/domain/UBGraphicsWidgetItem.cpp index 13487641..af71898c 100644 --- a/src/domain/UBGraphicsWidgetItem.cpp +++ b/src/domain/UBGraphicsWidgetItem.cpp @@ -91,6 +91,12 @@ void UBGraphicsWidgetItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) mDelegate->hoverLeaveEvent(event); UBGraphicsProxyWidget::hoverLeaveEvent(event); } +void UBGraphicsWidgetItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event) +{ + qDebug() << "hover move catched"; + UBGraphicsProxyWidget::hoverMoveEvent(event); +} + bool UBGraphicsWidgetItem::eventFilter(QObject *obj, QEvent *event) { diff --git a/src/domain/UBGraphicsWidgetItem.h b/src/domain/UBGraphicsWidgetItem.h index 2b73b5bc..2d29d30c 100644 --- a/src/domain/UBGraphicsWidgetItem.h +++ b/src/domain/UBGraphicsWidgetItem.h @@ -87,6 +87,8 @@ class UBGraphicsWidgetItem : public UBGraphicsProxyWidget virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event); virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); + virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event); + virtual bool eventFilter(QObject *obj, QEvent *event); diff --git a/src/domain/ubgraphicsgroupcontaineritem.cpp b/src/domain/ubgraphicsgroupcontaineritem.cpp index 3099e288..9f71cd94 100644 --- a/src/domain/ubgraphicsgroupcontaineritem.cpp +++ b/src/domain/ubgraphicsgroupcontaineritem.cpp @@ -63,6 +63,12 @@ void UBGraphicsGroupContainerItem::destroy() { mDelegate->remove(true); } +void UBGraphicsGroupContainerItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event) +{ + qDebug() << "hover move group"; + QGraphicsItemGroup::hoverMoveEvent(event); +} + void UBGraphicsGroupContainerItem::mousePressEvent(QGraphicsSceneMouseEvent *event) { if (mDelegate->mousePressEvent(event)) { diff --git a/src/domain/ubgraphicsgroupcontaineritem.h b/src/domain/ubgraphicsgroupcontaineritem.h index 87cc38ab..c2dc73d7 100644 --- a/src/domain/ubgraphicsgroupcontaineritem.h +++ b/src/domain/ubgraphicsgroupcontaineritem.h @@ -26,7 +26,7 @@ public: protected: - + virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event); virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); diff --git a/src/domain/ubgraphicsgroupcontaineritemdelegate.cpp b/src/domain/ubgraphicsgroupcontaineritemdelegate.cpp index ff763520..43286df6 100644 --- a/src/domain/ubgraphicsgroupcontaineritemdelegate.cpp +++ b/src/domain/ubgraphicsgroupcontaineritemdelegate.cpp @@ -44,21 +44,4 @@ void UBGraphicsGroupContainerItemDelegate::decorateMenu(QMenu *menu) void UBGraphicsGroupContainerItemDelegate::buildButtons() { UBGraphicsItemDelegate::buildButtons(); - - mDestroyGroupButton = new DelegateButton(":/images/font.svg", mDelegated, mFrame, Qt::TopLeftSection); - - mButtons << mDestroyGroupButton; - - connect(mDestroyGroupButton, SIGNAL(clicked()), (UBGraphicsGroupContainerItemDelegate*)this, SLOT(destroyGroup())); -} - -void UBGraphicsGroupContainerItemDelegate::destroyGroup() -{ - qDebug() << "got an event"; - foreach (QGraphicsItem *item, delegated()->childItems()) { - delegated()->removeFromGroup(item); - item->setFlag(QGraphicsItem::ItemIsSelectable, true); - } - - remove(true); } diff --git a/src/domain/ubgraphicsgroupcontaineritemdelegate.h b/src/domain/ubgraphicsgroupcontaineritemdelegate.h index 7160bb00..56a525f8 100644 --- a/src/domain/ubgraphicsgroupcontaineritemdelegate.h +++ b/src/domain/ubgraphicsgroupcontaineritemdelegate.h @@ -17,10 +17,6 @@ protected: virtual void decorateMenu(QMenu *menu); virtual void buildButtons(); - -private slots: - void destroyGroup(); - private: DelegateButton *mDestroyGroupButton; };