Fixed an issue in the teacherbar

preferencesAboutTextFull
shibakaneki 13 years ago
parent ca29e0d5e3
commit 84abba1f77
  1. 23
      src/gui/UBTeacherBarWidget.cpp
  2. 2
      src/gui/UBTeacherBarWidget.h

@ -24,7 +24,6 @@ UBTeacherBarWidget::UBTeacherBarWidget(QWidget *parent, const char *name):UBDock
, mpTitleLabel(NULL) , mpTitleLabel(NULL)
, mpDurationLabel(NULL) , mpDurationLabel(NULL)
, mpTitle(NULL) , mpTitle(NULL)
, mpAction1(NULL)
, mpMediaLabel(NULL) , mpMediaLabel(NULL)
, mpDropMediaZone(NULL) , mpDropMediaZone(NULL)
, mpContainer(NULL) , mpContainer(NULL)
@ -185,10 +184,6 @@ UBTeacherBarWidget::~UBTeacherBarWidget()
delete mpActionLayout; delete mpActionLayout;
mpActionLayout = NULL; mpActionLayout = NULL;
} }
if(NULL != mpAction1){
delete mpAction1;
mpAction1 = NULL;
}
if(NULL != mpActionLabel){ if(NULL != mpActionLabel){
delete mpActionLabel; delete mpActionLabel;
mpActionLabel = NULL; mpActionLabel = NULL;
@ -297,6 +292,7 @@ void UBTeacherBarWidget::saveContent()
void UBTeacherBarWidget::loadContent() void UBTeacherBarWidget::loadContent()
{ {
clearWidgetLists();
sTeacherBarInfos nextInfos = UBPersistenceManager::persistenceManager()->getTeacherBarInfos(UBApplication::boardController->activeDocument(), UBApplication::boardController->activeSceneIndex()); sTeacherBarInfos nextInfos = UBPersistenceManager::persistenceManager()->getTeacherBarInfos(UBApplication::boardController->activeDocument(), UBApplication::boardController->activeSceneIndex());
// Title // Title
mpTitle->setText(nextInfos.title); mpTitle->setText(nextInfos.title);
@ -360,6 +356,23 @@ void UBTeacherBarWidget::onLinkButton()
mpLinks->addWidget(pUrl); mpLinks->addWidget(pUrl);
} }
void UBTeacherBarWidget::clearWidgetLists()
{
if(NULL != mpActions){
for(int i=0; i<mActionList.size(); i++){
mpActions->removeWidget(mActionList.at(i));
}
mActionList.clear();
}
if(NULL != mpLinks){
for(int i=0; i<mUrlList.size(); i++){
mpLinks->removeWidget(mUrlList.at(i));
}
mUrlList.clear();
}
}
// --------------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------------
UBTeacherStudentAction::UBTeacherStudentAction(QWidget *parent, const char *name):QWidget(parent) UBTeacherStudentAction::UBTeacherStudentAction(QWidget *parent, const char *name):QWidget(parent)
, mpText(NULL) , mpText(NULL)

@ -93,13 +93,13 @@ private slots:
void onLinkButton(); void onLinkButton();
private: private:
void clearWidgetLists();
QVBoxLayout* mpLayout; QVBoxLayout* mpLayout;
QHBoxLayout* mpTitleLayout; QHBoxLayout* mpTitleLayout;
QHBoxLayout* mpDurationLayout; QHBoxLayout* mpDurationLayout;
QLabel* mpTitleLabel; QLabel* mpTitleLabel;
QLabel* mpDurationLabel; QLabel* mpDurationLabel;
QLineEdit* mpTitle; QLineEdit* mpTitle;
UBTeacherStudentAction* mpAction1;
QLabel* mpMediaLabel; QLabel* mpMediaLabel;
UBTeacherBarDropMediaZone* mpDropMediaZone; UBTeacherBarDropMediaZone* mpDropMediaZone;
QWidget* mpContainer; QWidget* mpContainer;

Loading…
Cancel
Save