|
|
@ -24,6 +24,9 @@ |
|
|
|
#include <QApplication> |
|
|
|
#include <QApplication> |
|
|
|
#include <QDomElement> |
|
|
|
#include <QDomElement> |
|
|
|
#include <QWebFrame> |
|
|
|
#include <QWebFrame> |
|
|
|
|
|
|
|
#include <QTextDocument> |
|
|
|
|
|
|
|
#include <QTextBlock> |
|
|
|
|
|
|
|
#include <QTextCursor> |
|
|
|
|
|
|
|
|
|
|
|
#include "UBTeacherGuideWidgetsTools.h" |
|
|
|
#include "UBTeacherGuideWidgetsTools.h" |
|
|
|
|
|
|
|
|
|
|
@ -190,10 +193,11 @@ void UBTGAdaptableText::onTextChanged() |
|
|
|
mIsUpdatingSize = true; |
|
|
|
mIsUpdatingSize = true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(documentSize < mMinimumHeight) |
|
|
|
if(documentSize < mMinimumHeight){ |
|
|
|
setFixedHeight(mMinimumHeight); |
|
|
|
setFixedHeight(mMinimumHeight); |
|
|
|
else |
|
|
|
}else{ |
|
|
|
setFixedHeight(documentSize+mBottomMargin); |
|
|
|
setFixedHeight(documentSize+mBottomMargin); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
updateGeometry(); |
|
|
|
updateGeometry(); |
|
|
|
//to trig a resize on the tree widget item
|
|
|
|
//to trig a resize on the tree widget item
|
|
|
@ -245,6 +249,7 @@ void UBTGAdaptableText::managePlaceholder(bool focus){ |
|
|
|
setTextColor(QColor(Qt::black)); |
|
|
|
setTextColor(QColor(Qt::black)); |
|
|
|
setPlainText(""); |
|
|
|
setPlainText(""); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
setCursorToTheEnd(); |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
if(toPlainText().isEmpty()){ |
|
|
|
if(toPlainText().isEmpty()){ |
|
|
|
setTextColor(QColor(Qt::lightGray)); |
|
|
|
setTextColor(QColor(Qt::lightGray)); |
|
|
@ -253,6 +258,16 @@ void UBTGAdaptableText::managePlaceholder(bool focus){ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBTGAdaptableText::setCursorToTheEnd(){ |
|
|
|
|
|
|
|
QTextDocument* doc = document(); |
|
|
|
|
|
|
|
if(NULL != doc){ |
|
|
|
|
|
|
|
QTextBlock block = doc->lastBlock(); |
|
|
|
|
|
|
|
QTextCursor cursor(doc); |
|
|
|
|
|
|
|
cursor.setPosition(block.position() + block.length() - 1); |
|
|
|
|
|
|
|
setTextCursor(cursor); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/***************************************************************************
|
|
|
|
/***************************************************************************
|
|
|
|
* class UBTGDraggableWeb * |
|
|
|
* class UBTGDraggableWeb * |
|
|
|
***************************************************************************/ |
|
|
|
***************************************************************************/ |
|
|
|