Commit 0c0f9e15 authored by Claudio Valerio's avatar Claudio Valerio

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

parent 6a1e6b62
......@@ -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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment