From 0c0f9e15a6e921887e1e6ddfcaee0d0ef1ad2ae2 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Fri, 28 Sep 2012 10:16:38 +0200 Subject: [PATCH 1/4] added a check to verify is the focus is already there when the widget it appears --- src/gui/UBTeacherGuideWidgetsTools.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/gui/UBTeacherGuideWidgetsTools.cpp b/src/gui/UBTeacherGuideWidgetsTools.cpp index db2d8bf7..587bc817 100644 --- a/src/gui/UBTeacherGuideWidgetsTools.cpp +++ b/src/gui/UBTeacherGuideWidgetsTools.cpp @@ -164,7 +164,7 @@ void UBTGAdaptableText::keyReleaseEvent(QKeyEvent* e) void UBTGAdaptableText::showEvent(QShowEvent* e) { Q_UNUSED(e); - if(!mIsUpdatingSize && mHasPlaceHolder && toPlainText().isEmpty() && !isReadOnly()){ + if(!mIsUpdatingSize && !hasFocus() && mHasPlaceHolder && toPlainText().isEmpty() && !isReadOnly()){ setTextColor(QColor(Qt::lightGray)); setPlainText(mPlaceHolderText); } @@ -193,7 +193,8 @@ void UBTGAdaptableText::onTextChanged() if(documentSize < mMinimumHeight){ setFixedHeight(mMinimumHeight); - }else{ + } + else{ setFixedHeight(documentSize+mBottomMargin); } @@ -237,12 +238,14 @@ void UBTGAdaptableText::focusInEvent(QFocusEvent* e) QTextEdit::focusInEvent(e); } -void UBTGAdaptableText::focusOutEvent(QFocusEvent* e){ +void UBTGAdaptableText::focusOutEvent(QFocusEvent* e) +{ managePlaceholder(false); QTextEdit::focusOutEvent(e); } -void UBTGAdaptableText::managePlaceholder(bool focus){ +void UBTGAdaptableText::managePlaceholder(bool focus) +{ if(focus){ if(toPlainText() == mPlaceHolderText){ setTextColor(QColor(Qt::black)); @@ -258,7 +261,8 @@ void UBTGAdaptableText::managePlaceholder(bool focus){ } } -void UBTGAdaptableText::setCursorToTheEnd(){ +void UBTGAdaptableText::setCursorToTheEnd() +{ QTextDocument* doc = document(); if(NULL != doc){ QTextBlock block = doc->lastBlock(); From b67edcf505deb7d3a7f448a2d93fbc4f30a05e78 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Fri, 28 Sep 2012 10:50:34 +0200 Subject: [PATCH 2/4] fixed issue of focus on title page --- src/gui/UBTeacherGuideWidget.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/UBTeacherGuideWidget.cpp b/src/gui/UBTeacherGuideWidget.cpp index a56fe901..561156be 100644 --- a/src/gui/UBTeacherGuideWidget.cpp +++ b/src/gui/UBTeacherGuideWidget.cpp @@ -679,7 +679,9 @@ UBTeacherGuidePageZeroWidget::UBTeacherGuidePageZeroWidget(QWidget* parent, cons mpLayout->addWidget(mpPageNumberLabel); mpScrollArea = new QScrollArea(); + mpScrollArea->setFocusPolicy(Qt::NoFocus); mpContainerWidget = new QWidget(); + mpContainerWidget->setFocusPolicy(Qt::NoFocus); mpContainerWidgetLayout = new QVBoxLayout(); mpLayout->addWidget(mpScrollArea); From c72b6dc69ba89134700a6333a043b59bf4b99c15 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Fri, 28 Sep 2012 11:30:12 +0200 Subject: [PATCH 3/4] fixed background on preview widget for task items --- src/gui/UBTeacherGuideWidget.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/UBTeacherGuideWidget.cpp b/src/gui/UBTeacherGuideWidget.cpp index 561156be..656118c4 100644 --- a/src/gui/UBTeacherGuideWidget.cpp +++ b/src/gui/UBTeacherGuideWidget.cpp @@ -551,9 +551,9 @@ void UBTeacherGuidePresentationWidget::showData( QVector data else if (element->name == "comment") mpComment->showText(element->attributes.value("value")); else if (element->name == "action") { - QTreeWidgetItem* newWidgetItem = new QTreeWidgetItem( mpRootWidgetItem); + QTreeWidgetItem* newWidgetItem = new QTreeWidgetItem(mpRootWidgetItem); 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 ? "blue" : "green"; UBTGAdaptableText* textWidget = new UBTGAdaptableText(newWidgetItem, 0); textWidget->bottomMargin(14); From 5a434ba6672ded85f359c3d6a69cfb2fa79232a8 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Fri, 28 Sep 2012 12:09:23 +0200 Subject: [PATCH 4/4] fixed issue related to translation loading --- src/core/UBApplication.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/core/UBApplication.cpp b/src/core/UBApplication.cpp index a2043121..580ef897 100644 --- a/src/core/UBApplication.cpp +++ b/src/core/UBApplication.cpp @@ -216,14 +216,17 @@ QString UBApplication::checkLanguageAvailabilityForSankore(QString &language) void UBApplication::setupTranslators(QStringList args) { - QString forcedLanguage; + QString forcedLanguage(""); if(args.contains("-lang")) forcedLanguage=args.at(args.indexOf("-lang") + 1); - else{ - QString setLanguage = UBSettings::settings()->appPreferredLanguage->get().toString(); - if(!setLanguage.isEmpty()) - forcedLanguage = setLanguage; - } +// TODO claudio: this has been commented because some of the translation seem to be loaded at this time +// especially tools name. This is a workaround and we have to be able to load settings without +// impacting the translations +// else{ +// QString setLanguage = UBSettings::settings()->appPreferredLanguage->get().toString(); +// if(!setLanguage.isEmpty()) +// forcedLanguage = setLanguage; +// } QString language(""); @@ -242,7 +245,6 @@ void UBApplication::setupTranslators(QStringList args) else{ mApplicationTranslator = new QTranslator(this); mQtGuiTranslator = new QTranslator(this); - mApplicationTranslator->load(UBPlatformUtils::translationPath(QString("sankore_"),language)); installTranslator(mApplicationTranslator); @@ -256,7 +258,6 @@ void UBApplication::setupTranslators(QStringList args) } if(!qtGuiTranslationPath.isEmpty()){ - qDebug() << "qtGuiTranslationPath " << qtGuiTranslationPath; mQtGuiTranslator->load(qtGuiTranslationPath); installTranslator(mQtGuiTranslator); }