selection take care about two special classes text and media item. Fixed issue: 30

preferencesAboutTextFull
Claudio Valerio 12 years ago
parent 29a36c46ab
commit 1afbc194fe
  1. 15
      src/board/UBBoardView.cpp
  2. 12
      src/domain/UBGraphicsMediaItem.cpp
  3. 3
      src/domain/UBGraphicsMediaItem.h
  4. 9
      src/domain/UBGraphicsTextItem.cpp
  5. 2
      src/domain/UBGraphicsTextItem.h

@ -534,12 +534,7 @@ Here we determines cases when items should to get mouse press event at pressing
case UBGraphicsTriangle::Type: case UBGraphicsTriangle::Type:
case UBGraphicsCompass::Type: case UBGraphicsCompass::Type:
case UBGraphicsCache::Type: case UBGraphicsCache::Type:
return true;
case UBGraphicsDelegateFrame::Type: case UBGraphicsDelegateFrame::Type:
case QGraphicsSvgItem::Type:
return true;
case DelegateButton::Type: case DelegateButton::Type:
return true; return true;
@ -1233,7 +1228,6 @@ void UBBoardView::mouseReleaseEvent (QMouseEvent *event)
{ {
if (isUBItem(movingItem) && if (isUBItem(movingItem) &&
DelegateButton::Type != movingItem->type() && DelegateButton::Type != movingItem->type() &&
QGraphicsSvgItem::Type != movingItem->type() &&
UBGraphicsDelegateFrame::Type != movingItem->type() && UBGraphicsDelegateFrame::Type != movingItem->type() &&
UBGraphicsCache::Type != movingItem->type() && UBGraphicsCache::Type != movingItem->type() &&
QGraphicsWebView::Type != movingItem->type() && // for W3C widgets as Tools. QGraphicsWebView::Type != movingItem->type() && // for W3C widgets as Tools.
@ -1250,7 +1244,14 @@ void UBBoardView::mouseReleaseEvent (QMouseEvent *event)
if (movingItem->isSelected()) if (movingItem->isSelected())
bReleaseIsNeed = true; bReleaseIsNeed = true;
movingItem->setSelected(true); UBGraphicsTextItem* textItem = dynamic_cast<UBGraphicsTextItem*>(movingItem);
UBGraphicsMediaItem* movieItem = dynamic_cast<UBGraphicsMediaItem*>(movingItem);
if(textItem)
textItem->setSelected(true);
else if(movieItem)
movieItem->setSelected(true);
else
movingItem->setSelected(true);
} }
} }

@ -121,6 +121,18 @@ UBGraphicsMediaItem::~UBGraphicsMediaItem()
} }
void UBGraphicsMediaItem::setSelected(bool selected)
{
if(selected){
Delegate()->createControls();
if (mediaType_Audio == mMediaType)
Delegate()->frame()->setOperationMode(UBGraphicsDelegateFrame::ResizingHorizontally);
else
Delegate()->frame()->setOperationMode(UBGraphicsDelegateFrame::Resizing);
}
UBGraphicsProxyWidget::setSelected(selected);
}
QVariant UBGraphicsMediaItem::itemChange(GraphicsItemChange change, const QVariant &value) QVariant UBGraphicsMediaItem::itemChange(GraphicsItemChange change, const QVariant &value)
{ {
if ((change == QGraphicsItem::ItemEnabledChange) if ((change == QGraphicsItem::ItemEnabledChange)

@ -91,6 +91,9 @@ public:
virtual void setSourceUrl(const QUrl &pSourceUrl); virtual void setSourceUrl(const QUrl &pSourceUrl);
void setSelected(bool selected);
public slots: public slots:
void toggleMute(); void toggleMute();

@ -77,6 +77,15 @@ UBGraphicsTextItem::~UBGraphicsTextItem()
{ {
} }
void UBGraphicsTextItem::setSelected(bool selected)
{
if(selected){
Delegate()->createControls();
Delegate()->frame()->setOperationMode(UBGraphicsDelegateFrame::Resizing);
}
QGraphicsTextItem::setSelected(selected);
}
QVariant UBGraphicsTextItem::itemChange(GraphicsItemChange change, const QVariant &value) QVariant UBGraphicsTextItem::itemChange(GraphicsItemChange change, const QVariant &value)
{ {
QVariant newValue = value; QVariant newValue = value;

@ -92,6 +92,8 @@ class UBGraphicsTextItem : public QGraphicsTextItem, public UBItem, public UBRes
virtual void setUuid(const QUuid &pUuid); virtual void setUuid(const QUuid &pUuid);
void setHtml(const QString &text); void setHtml(const QString &text);
void setSelected(bool selected);
signals: signals:
void textUndoCommandAdded(UBGraphicsTextItem *textItem); void textUndoCommandAdded(UBGraphicsTextItem *textItem);

Loading…
Cancel
Save