unstable but fresh changes multiple selection and grouping

preferencesAboutTextFull
Ivan Ilyin 13 years ago
parent eb83f2722f
commit f4fffe47ce
  1. 5
      src/board/UBBoardView.cpp
  2. 1
      src/board/UBBoardView.h
  3. 2
      src/domain/UBGraphicsItemDelegate.h
  4. 1
      src/domain/UBGraphicsScene.cpp
  5. 6
      src/domain/UBGraphicsWidgetItem.cpp
  6. 2
      src/domain/UBGraphicsWidgetItem.h
  7. 6
      src/domain/ubgraphicsgroupcontaineritem.cpp
  8. 2
      src/domain/ubgraphicsgroupcontaineritem.h
  9. 17
      src/domain/ubgraphicsgroupcontaineritemdelegate.cpp
  10. 4
      src/domain/ubgraphicsgroupcontaineritemdelegate.h

@ -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;
};

Loading…
Cancel
Save