Commit 1afbc194 authored by Claudio Valerio's avatar Claudio Valerio

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

parent 29a36c46
......@@ -534,12 +534,7 @@ Here we determines cases when items should to get mouse press event at pressing
case UBGraphicsTriangle::Type:
case UBGraphicsCompass::Type:
case UBGraphicsCache::Type:
return true;
case UBGraphicsDelegateFrame::Type:
case QGraphicsSvgItem::Type:
return true;
case DelegateButton::Type:
return true;
......@@ -1233,7 +1228,6 @@ void UBBoardView::mouseReleaseEvent (QMouseEvent *event)
{
if (isUBItem(movingItem) &&
DelegateButton::Type != movingItem->type() &&
QGraphicsSvgItem::Type != movingItem->type() &&
UBGraphicsDelegateFrame::Type != movingItem->type() &&
UBGraphicsCache::Type != movingItem->type() &&
QGraphicsWebView::Type != movingItem->type() && // for W3C widgets as Tools.
......@@ -1250,7 +1244,14 @@ void UBBoardView::mouseReleaseEvent (QMouseEvent *event)
if (movingItem->isSelected())
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)
{
if ((change == QGraphicsItem::ItemEnabledChange)
......
......@@ -91,6 +91,9 @@ public:
virtual void setSourceUrl(const QUrl &pSourceUrl);
void setSelected(bool selected);
public slots:
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 newValue = value;
......
......@@ -92,6 +92,8 @@ class UBGraphicsTextItem : public QGraphicsTextItem, public UBItem, public UBRes
virtual void setUuid(const QUuid &pUuid);
void setHtml(const QString &text);
void setSelected(bool selected);
signals:
void textUndoCommandAdded(UBGraphicsTextItem *textItem);
......
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