Commit f4fffe47 authored by Ivan Ilyin's avatar Ivan Ilyin

unstable but fresh changes multiple selection and grouping

parent eb83f272
......@@ -516,8 +516,6 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
}
}
QSet<QGraphicsItem*> 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);
......
......@@ -125,6 +125,7 @@ class UBBoardView : public QGraphicsView
QMouseEvent *suspendedMousePressEvent;
UBRubberBand *mUBRubberBand;
QSet<QGraphicsItem*> mJustSelectedItems;
private slots:
......
......@@ -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.
......
......@@ -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
......
......@@ -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)
{
......
......@@ -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);
......
......@@ -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)) {
......
......@@ -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);
......
......@@ -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);
}
......@@ -17,10 +17,6 @@ protected:
virtual void decorateMenu(QMenu *menu);
virtual void buildButtons();
private slots:
void destroyGroup();
private:
DelegateButton *mDestroyGroupButton;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment