|
|
@ -105,6 +105,7 @@ UBTeacherGuideEditionWidget::UBTeacherGuideEditionWidget(QWidget *parent, const |
|
|
|
mpLayout->addWidget(mpSeparator); |
|
|
|
mpLayout->addWidget(mpSeparator); |
|
|
|
|
|
|
|
|
|
|
|
mpTreeWidget = new QTreeWidget(this); |
|
|
|
mpTreeWidget = new QTreeWidget(this); |
|
|
|
|
|
|
|
mpTreeWidget->setStyleSheet("selection-background-color:transparent; padding-bottom:5px; padding-top:5px;"); |
|
|
|
mpLayout->addWidget(mpTreeWidget); |
|
|
|
mpLayout->addWidget(mpTreeWidget); |
|
|
|
|
|
|
|
|
|
|
|
mpRootWidgetItem = mpTreeWidget->invisibleRootItem(); |
|
|
|
mpRootWidgetItem = mpTreeWidget->invisibleRootItem(); |
|
|
@ -118,6 +119,7 @@ UBTeacherGuideEditionWidget::UBTeacherGuideEditionWidget(QWidget *parent, const |
|
|
|
mpTreeWidget->header()->setResizeMode(0, QHeaderView::Stretch); |
|
|
|
mpTreeWidget->header()->setResizeMode(0, QHeaderView::Stretch); |
|
|
|
mpTreeWidget->header()->setResizeMode(1, QHeaderView::Fixed); |
|
|
|
mpTreeWidget->header()->setResizeMode(1, QHeaderView::Fixed); |
|
|
|
mpTreeWidget->header()->setDefaultSectionSize(18); |
|
|
|
mpTreeWidget->header()->setDefaultSectionSize(18); |
|
|
|
|
|
|
|
mpTreeWidget->setSelectionMode(QAbstractItemView::NoSelection); |
|
|
|
|
|
|
|
|
|
|
|
connect(mpTreeWidget, SIGNAL(itemClicked(QTreeWidgetItem*,int)), this, SLOT(onAddItemClicked(QTreeWidgetItem*,int))); |
|
|
|
connect(mpTreeWidget, SIGNAL(itemClicked(QTreeWidgetItem*,int)), this, SLOT(onAddItemClicked(QTreeWidgetItem*,int))); |
|
|
|
connect(UBApplication::boardController, SIGNAL(activeSceneChanged()), this, SLOT(onActiveSceneChanged())); |
|
|
|
connect(UBApplication::boardController, SIGNAL(activeSceneChanged()), this, SLOT(onActiveSceneChanged())); |
|
|
@ -215,16 +217,13 @@ QVector<tIDataStorage*> UBTeacherGuideEditionWidget::save(int pageIndex) |
|
|
|
children << getChildrenList(mpAddALinkItem); |
|
|
|
children << getChildrenList(mpAddALinkItem); |
|
|
|
|
|
|
|
|
|
|
|
foreach(QTreeWidgetItem* widgetItem, children) { |
|
|
|
foreach(QTreeWidgetItem* widgetItem, children) { |
|
|
|
tUBGEElementNode* node = |
|
|
|
tUBGEElementNode* node = dynamic_cast<iUBTGSaveData*>(mpTreeWidget->itemWidget( widgetItem, 0))->saveData(); |
|
|
|
dynamic_cast<iUBTGSaveData*>(mpTreeWidget->itemWidget( |
|
|
|
|
|
|
|
widgetItem, 0))->saveData(); |
|
|
|
|
|
|
|
if (node) { |
|
|
|
if (node) { |
|
|
|
data = new tIDataStorage(); |
|
|
|
data = new tIDataStorage(); |
|
|
|
data->name = node->name; |
|
|
|
data->name = node->name; |
|
|
|
data->type = eElementType_UNIQUE; |
|
|
|
data->type = eElementType_UNIQUE; |
|
|
|
foreach(QString currentKey, node->attributes.keys()) |
|
|
|
foreach(QString currentKey, node->attributes.keys()) |
|
|
|
data->attributes.insert(currentKey, |
|
|
|
data->attributes.insert(currentKey, node->attributes.value(currentKey)); |
|
|
|
node->attributes.value(currentKey)); |
|
|
|
|
|
|
|
result << data; |
|
|
|
result << data; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -293,9 +292,7 @@ QVector<tUBGEElementNode*> UBTeacherGuideEditionWidget::getData() |
|
|
|
children << getChildrenList(mpAddALinkItem); |
|
|
|
children << getChildrenList(mpAddALinkItem); |
|
|
|
result << getPageAndCommentData(); |
|
|
|
result << getPageAndCommentData(); |
|
|
|
foreach(QTreeWidgetItem* widgetItem, children) { |
|
|
|
foreach(QTreeWidgetItem* widgetItem, children) { |
|
|
|
tUBGEElementNode* node = |
|
|
|
tUBGEElementNode* node = dynamic_cast<iUBTGSaveData*>(mpTreeWidget->itemWidget( widgetItem, 0))->saveData(); |
|
|
|
dynamic_cast<iUBTGSaveData*>(mpTreeWidget->itemWidget( |
|
|
|
|
|
|
|
widgetItem, 0))->saveData(); |
|
|
|
|
|
|
|
if (node) |
|
|
|
if (node) |
|
|
|
result << node; |
|
|
|
result << node; |
|
|
|
} |
|
|
|
} |
|
|
@ -346,14 +343,13 @@ void UBTeacherGuideEditionWidget::onAddItemClicked(QTreeWidgetItem* widget, int |
|
|
|
widget->setExpanded(false); |
|
|
|
widget->setExpanded(false); |
|
|
|
widget->setExpanded(true); |
|
|
|
widget->setExpanded(true); |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (column == 1 |
|
|
|
} |
|
|
|
&& addSubItemWidgetType == eUBTGAddSubItemWidgetType_None) { |
|
|
|
else if (column == 1 && addSubItemWidgetType == eUBTGAddSubItemWidgetType_None) { |
|
|
|
UBTGMediaWidget* media = dynamic_cast<UBTGMediaWidget*>(mpTreeWidget->itemWidget(widget, 0)); |
|
|
|
UBTGMediaWidget* media = dynamic_cast<UBTGMediaWidget*>(mpTreeWidget->itemWidget(widget, 0)); |
|
|
|
if (media) |
|
|
|
if (media) |
|
|
|
media->removeSource(); |
|
|
|
media->removeSource(); |
|
|
|
int index = mpTreeWidget->currentIndex().row(); |
|
|
|
int index = mpTreeWidget->currentIndex().row(); |
|
|
|
QTreeWidgetItem* toBeDeletedWidgetItem = widget->parent()->takeChild( |
|
|
|
QTreeWidgetItem* toBeDeletedWidgetItem = widget->parent()->takeChild(index); |
|
|
|
index); |
|
|
|
|
|
|
|
delete toBeDeletedWidgetItem; |
|
|
|
delete toBeDeletedWidgetItem; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -447,12 +443,14 @@ UBTeacherGuidePresentationWidget::UBTeacherGuidePresentationWidget(QWidget *pare |
|
|
|
mpLayout->addWidget(mpTreeWidget); |
|
|
|
mpLayout->addWidget(mpTreeWidget); |
|
|
|
|
|
|
|
|
|
|
|
mpRootWidgetItem = mpTreeWidget->invisibleRootItem(); |
|
|
|
mpRootWidgetItem = mpTreeWidget->invisibleRootItem(); |
|
|
|
|
|
|
|
mpTreeWidget->setSelectionMode(QAbstractItemView::NoSelection); |
|
|
|
mpTreeWidget->setDragEnabled(true); |
|
|
|
mpTreeWidget->setDragEnabled(true); |
|
|
|
mpTreeWidget->setRootIsDecorated(false); |
|
|
|
mpTreeWidget->setRootIsDecorated(false); |
|
|
|
mpTreeWidget->setIndentation(0); |
|
|
|
mpTreeWidget->setIndentation(0); |
|
|
|
mpTreeWidget->setDropIndicatorShown(false); |
|
|
|
mpTreeWidget->setDropIndicatorShown(false); |
|
|
|
mpTreeWidget->header()->close(); |
|
|
|
mpTreeWidget->header()->close(); |
|
|
|
mpTreeWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); |
|
|
|
mpTreeWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); |
|
|
|
|
|
|
|
mpTreeWidget->setStyleSheet("selection-background-color:transparent; padding-bottom:5px; padding-top:5px; "); |
|
|
|
connect(mpTreeWidget, SIGNAL(itemClicked(QTreeWidgetItem*,int)), this, SLOT(onAddItemClicked(QTreeWidgetItem*,int))); |
|
|
|
connect(mpTreeWidget, SIGNAL(itemClicked(QTreeWidgetItem*,int)), this, SLOT(onAddItemClicked(QTreeWidgetItem*,int))); |
|
|
|
connect(UBApplication::boardController, SIGNAL(activeSceneChanged()), this, SLOT(onActiveSceneChanged())); |
|
|
|
connect(UBApplication::boardController, SIGNAL(activeSceneChanged()), this, SLOT(onActiveSceneChanged())); |
|
|
|
} |
|
|
|
} |
|
|
@ -529,8 +527,7 @@ void UBTeacherGuidePresentationWidget::showData( QVector<tUBGEElementNode*> data |
|
|
|
newWidgetItem->setText(0, element->attributes.value("task")); |
|
|
|
newWidgetItem->setText(0, element->attributes.value("task")); |
|
|
|
newWidgetItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); |
|
|
|
newWidgetItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); |
|
|
|
QString colorString = element->attributes.value("owner").toInt() == 0 ? "red" : "green"; |
|
|
|
QString colorString = element->attributes.value("owner").toInt() == 0 ? "red" : "green"; |
|
|
|
UBTGAdaptableText* textWidget = new UBTGAdaptableText(newWidgetItem, |
|
|
|
UBTGAdaptableText* textWidget = new UBTGAdaptableText(newWidgetItem, 0); |
|
|
|
0); |
|
|
|
|
|
|
|
textWidget->bottomMargin(14); |
|
|
|
textWidget->bottomMargin(14); |
|
|
|
textWidget->setStyleSheet( "QWidget {background: #EEEEEE; border:none; color:" + colorString + ";}"); |
|
|
|
textWidget->setStyleSheet( "QWidget {background: #EEEEEE; border:none; color:" + colorString + ";}"); |
|
|
|
textWidget->showText(element->attributes.value("task")); |
|
|
|
textWidget->showText(element->attributes.value("task")); |
|
|
|