added a check to verify is the focus is already there when the widget it appears

preferencesAboutTextFull
Claudio Valerio 12 years ago
parent 6a1e6b6268
commit 0c0f9e15a6
  1. 14
      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();

Loading…
Cancel
Save