From 84abba1f77b92eac06b9607e7e12b44d1a5ff868 Mon Sep 17 00:00:00 2001 From: shibakaneki Date: Thu, 5 Jan 2012 15:12:36 +0100 Subject: [PATCH] Fixed an issue in the teacherbar --- src/gui/UBTeacherBarWidget.cpp | 23 ++++++++++++++++++----- src/gui/UBTeacherBarWidget.h | 2 +- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/gui/UBTeacherBarWidget.cpp b/src/gui/UBTeacherBarWidget.cpp index 833e1796..2c41ed50 100644 --- a/src/gui/UBTeacherBarWidget.cpp +++ b/src/gui/UBTeacherBarWidget.cpp @@ -24,7 +24,6 @@ UBTeacherBarWidget::UBTeacherBarWidget(QWidget *parent, const char *name):UBDock , mpTitleLabel(NULL) , mpDurationLabel(NULL) , mpTitle(NULL) - , mpAction1(NULL) , mpMediaLabel(NULL) , mpDropMediaZone(NULL) , mpContainer(NULL) @@ -185,10 +184,6 @@ UBTeacherBarWidget::~UBTeacherBarWidget() delete mpActionLayout; mpActionLayout = NULL; } - if(NULL != mpAction1){ - delete mpAction1; - mpAction1 = NULL; - } if(NULL != mpActionLabel){ delete mpActionLabel; mpActionLabel = NULL; @@ -297,6 +292,7 @@ void UBTeacherBarWidget::saveContent() void UBTeacherBarWidget::loadContent() { + clearWidgetLists(); sTeacherBarInfos nextInfos = UBPersistenceManager::persistenceManager()->getTeacherBarInfos(UBApplication::boardController->activeDocument(), UBApplication::boardController->activeSceneIndex()); // Title mpTitle->setText(nextInfos.title); @@ -360,6 +356,23 @@ void UBTeacherBarWidget::onLinkButton() mpLinks->addWidget(pUrl); } +void UBTeacherBarWidget::clearWidgetLists() +{ + if(NULL != mpActions){ + for(int i=0; iremoveWidget(mActionList.at(i)); + } + mActionList.clear(); + } + + if(NULL != mpLinks){ + for(int i=0; iremoveWidget(mUrlList.at(i)); + } + mUrlList.clear(); + } +} + // --------------------------------------------------------------------------------------------- UBTeacherStudentAction::UBTeacherStudentAction(QWidget *parent, const char *name):QWidget(parent) , mpText(NULL) diff --git a/src/gui/UBTeacherBarWidget.h b/src/gui/UBTeacherBarWidget.h index f59f64ed..07ca9674 100644 --- a/src/gui/UBTeacherBarWidget.h +++ b/src/gui/UBTeacherBarWidget.h @@ -93,13 +93,13 @@ private slots: void onLinkButton(); private: + void clearWidgetLists(); QVBoxLayout* mpLayout; QHBoxLayout* mpTitleLayout; QHBoxLayout* mpDurationLayout; QLabel* mpTitleLabel; QLabel* mpDurationLabel; QLineEdit* mpTitle; - UBTeacherStudentAction* mpAction1; QLabel* mpMediaLabel; UBTeacherBarDropMediaZone* mpDropMediaZone; QWidget* mpContainer;