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();