|
|
@ -73,6 +73,7 @@ bool UBGraphicsMediaItemDelegate::mousePressEvent(QGraphicsSceneMouseEvent *even |
|
|
|
{ |
|
|
|
{ |
|
|
|
Q_UNUSED(event); |
|
|
|
Q_UNUSED(event); |
|
|
|
mToolBarItem->show(); |
|
|
|
mToolBarItem->show(); |
|
|
|
|
|
|
|
positionHandles(); |
|
|
|
|
|
|
|
|
|
|
|
if (mToolBarShowTimer) |
|
|
|
if (mToolBarShowTimer) |
|
|
|
mToolBarShowTimer->start(); |
|
|
|
mToolBarShowTimer->start(); |
|
|
@ -119,20 +120,16 @@ void UBGraphicsMediaItemDelegate::buildButtons() |
|
|
|
connect(mMuteButton, SIGNAL(clicked(bool)), mToolBarShowTimer, SLOT(start())); |
|
|
|
connect(mMuteButton, SIGNAL(clicked(bool)), mToolBarShowTimer, SLOT(start())); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// UBGraphicsMediaItem *audioItem = dynamic_cast<UBGraphicsMediaItem*>(mDelegated);
|
|
|
|
|
|
|
|
// if (audioItem)
|
|
|
|
positionHandles(); |
|
|
|
// {
|
|
|
|
|
|
|
|
// if (audioItem->getMediaType() == UBGraphicsMediaItem::mediaType_Audio)
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
positionHandles(); |
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
UBGraphicsMediaItemDelegate::~UBGraphicsMediaItemDelegate() |
|
|
|
UBGraphicsMediaItemDelegate::~UBGraphicsMediaItemDelegate() |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (mToolBarShowTimer) |
|
|
|
if (mToolBarShowTimer){ |
|
|
|
delete mToolBarShowTimer; |
|
|
|
delete mToolBarShowTimer; |
|
|
|
|
|
|
|
mToolBarShowTimer = NULL; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBGraphicsMediaItemDelegate::positionHandles() |
|
|
|
void UBGraphicsMediaItemDelegate::positionHandles() |
|
|
@ -144,32 +141,20 @@ void UBGraphicsMediaItemDelegate::positionHandles() |
|
|
|
{ |
|
|
|
{ |
|
|
|
QRectF toolBarRect = mToolBarItem->rect(); |
|
|
|
QRectF toolBarRect = mToolBarItem->rect(); |
|
|
|
|
|
|
|
|
|
|
|
mToolBarItem->setPos(0, delegated()->boundingRect().height()-mToolBarItem->rect().height()); |
|
|
|
mToolBarItem->setPos(0, mediaItem->boundingRect().height()-mToolBarItem->rect().height()); |
|
|
|
|
|
|
|
|
|
|
|
toolBarRect.setWidth(delegated()->boundingRect().width()); |
|
|
|
toolBarRect.setWidth(mediaItem->boundingRect().width()); |
|
|
|
mToolBarItem->show(); |
|
|
|
mToolBarItem->show(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mToolBarItem->setRect(toolBarRect); |
|
|
|
mToolBarItem->setRect(toolBarRect); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int toolBarMinimumWidth = 0; |
|
|
|
int toolBarButtons= 0; |
|
|
|
int mediaItemWidth = mToolBarItem->boundingRect().width(); |
|
|
|
|
|
|
|
foreach (DelegateButton* button, mToolBarButtons) |
|
|
|
foreach (DelegateButton* button, mToolBarButtons) |
|
|
|
{ |
|
|
|
toolBarButtons += button->boundingRect().width() + mToolBarItem->getElementsPadding(); |
|
|
|
mediaItemWidth -= button->boundingRect().width() + mToolBarItem->getElementsPadding(); |
|
|
|
|
|
|
|
toolBarMinimumWidth += button->boundingRect().width() + mToolBarItem->getElementsPadding(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
toolBarMinimumWidth += mToolBarItem->boundingRect().height(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QWidget* pAudioWidget = delegated()->widget(); |
|
|
|
|
|
|
|
if (pAudioWidget) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
pAudioWidget->setMinimumSize(toolBarMinimumWidth + (int)mMediaControl->lcdAreaSize().width() + (int)mMediaControl->rect().height(),26); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QRectF mediaItemRect = mMediaControl->rect(); |
|
|
|
QRectF mediaItemRect = mMediaControl->rect(); |
|
|
|
mediaItemRect.setWidth(mediaItemWidth); |
|
|
|
mediaItemRect.setWidth(mediaItem->boundingRect().width() - toolBarButtons); |
|
|
|
mediaItemRect.setHeight(mToolBarItem->boundingRect().height()); |
|
|
|
mediaItemRect.setHeight(mToolBarItem->boundingRect().height()); |
|
|
|
mMediaControl->setRect(mediaItemRect); |
|
|
|
mMediaControl->setRect(mediaItemRect); |
|
|
|
|
|
|
|
|
|
|
|