From e93410f1370619d20f6794c129e3fa0e77a0a706 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Fri, 6 Jan 2012 12:51:27 +0100 Subject: [PATCH] resolved issue --- src/gui/UBTeacherBarWidget.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/gui/UBTeacherBarWidget.cpp b/src/gui/UBTeacherBarWidget.cpp index 84eed6b0..f4e14883 100644 --- a/src/gui/UBTeacherBarWidget.cpp +++ b/src/gui/UBTeacherBarWidget.cpp @@ -366,10 +366,10 @@ void UBTeacherBarWidget::loadContent() mpPreview->setDuration(eDuration_ThreeQuarter); } mpPreview->setComments(mpComments->document()->toPlainText()); + mpPreview->mediaViewer()->cleanMedia(); + mpPreview->mediaViewer()->loadMedia(nextInfos.medias); } - // this is always done becasue it allows to clean the media on - // changing the page - mpPreview->mediaViewer()->loadMedia(nextInfos.medias); + } bool UBTeacherBarWidget::isEmpty() @@ -848,10 +848,18 @@ UBTeacherBarPreviewMedia::~UBTeacherBarPreviewMedia() } +void UBTeacherBarPreviewMedia::cleanMedia() +{ + foreach(QWidget* eachWidget, mWidgetList.keys()){ + delete eachWidget; + eachWidget = NULL; + } + mWidgetList.clear(); +} + void UBTeacherBarPreviewMedia::loadMedia(QStringList pMedias) { - mWidgetList.clear(); foreach(QString eachString, pMedias){ if(!eachString.isEmpty()){ QString mimeType = UBFileSystemUtils::mimeTypeFromFileName(eachString);