the title is found after reloading the document using the text

preferencesAboutTextFull
Claudio Valerio 12 years ago
parent 9ed62340ac
commit f85bb2d5fa
  1. 9
      src/domain/UBGraphicsScene.cpp
  2. 11
      src/gui/UBTeacherGuideWidget.cpp
  3. 1
      src/gui/UBTeacherGuideWidget.h

@ -1480,15 +1480,18 @@ UBGraphicsTextItem* UBGraphicsScene::textForObjectName(const QString& pString, c
//looking for a previous such item text
for(int i=0; i < mFastAccessItems.count() && !found ; i += 1){
UBGraphicsTextItem* currentItem = dynamic_cast<UBGraphicsTextItem*>(mFastAccessItems.at(i));
if(currentItem && currentItem->objectName() == objectName){
if(currentItem && (currentItem->objectName() == objectName || currentItem->toPlainText() == pString)){
// The second condition is necessary because the object name isn't stored. On reopeining the file we
// need another rule than the objectName
textItem = currentItem;
found=true;
if(currentItem->objectName() != objectName)
textItem->setObjectName(objectName);
}
}
if(!textItem){
textItem = addTextWithFont(pString,QPointF(0,0) ,64,"",true,false);
textItem = addTextWithFont(pString,QPointF(0,0) ,48,"",true,false);
textItem->setObjectName(objectName);
textItem->Delegate()->setCanDuplicate(false);
}
textItem->setPlainText(pString);

@ -829,7 +829,7 @@ void UBTeacherGuidePageZeroWidget::onActiveSceneChanged()
QDateTime updatedDate = documentProxy->lastUpdate();
mpLastModifiedLabel->setText(tr("Updated the:\n") + updatedDate.toString(Qt::SystemLocaleShortDate));
loadData();
UBApplication::boardController->activeScene()->textForObjectName(mpSessionTitle->text());
updateSceneTitle();
}
}
@ -873,6 +873,13 @@ void UBTeacherGuidePageZeroWidget::persistData()
documentProxy->setMetaData(UBSettings::sessionLicence,mpLicenceBox->currentText());
}
void UBTeacherGuidePageZeroWidget::updateSceneTitle()
{
QString sessionTitle = mpSessionTitle->text();
if(!sessionTitle.isEmpty())
UBApplication::boardController->activeScene()->textForObjectName(mpSessionTitle->text());
}
void UBTeacherGuidePageZeroWidget::switchToMode(tUBTGZeroPageMode mode)
{
if(mode == tUBTGZeroPageMode_EDITION){
@ -902,7 +909,7 @@ void UBTeacherGuidePageZeroWidget::switchToMode(tUBTGZeroPageMode mode)
QString inputStyleSheet("QTextEdit { background: transparent; border: none;}");
mpModePushButton->show();
mpSessionTitle->setReadOnly(true);
UBApplication::boardController->activeScene()->textForObjectName(mpSessionTitle->text());
updateSceneTitle();
mpSessionTitle->setStyleSheet(inputStyleSheet);
mpSessionTitle->setTextColor(QColor(Qt::black));
QFont titleFont(QApplication::font().family(),14,1);

@ -135,6 +135,7 @@ private:
void loadData();
void hideEvent(QHideEvent* event);
bool eventFilter(QObject* object, QEvent* event);
void updateSceneTitle();
QVBoxLayout* mpLayout;
QHBoxLayout* mpButtonTitleLayout;

Loading…
Cancel
Save