#include
void TQmlHelper::makeDoc( QQuickTextDocument* doc)
{
jAVA_QMessage("開始");
QTextDocument *document =doc->textDocument();
if(document==NULL)
{
jAVA_QMessage("NULL DOCUMENT");
}
QTextBlock currentBlock = document->begin();
QTextBlock::iterator it;
while( true)
{
for (it = currentBlock.begin(); !(it.atEnd()); )
{
QTextFragment currentFragment = it.fragment();
QTextImageFormat newImageFormat = currentFragment.charFormat().toImageFormat();
if (newImageFormat.isValid()) {
// 為image
jAVA_QMessage(newImageFormat.name());
}
++it;
}
currentBlock = currentBlock.next();
jAVA_QMessage("一循環(huán)");
if(!currentBlock.isValid())
{
break;
}
}
}
Rectangle{
id:sendroot
xxx..
property var offsetBeginX: 20
property var offsetendx: 10
Rectangle{
id: flickable
x:offsetBeginX
anchors.bottom: parent.bottom
width: sendroot.width - btn.width -offsetBeginX-offsetendx
height:edit.focus==true?flick.height:btn.height
color: "transparent"
radius: 5
border.width: 1
border.color: "#cccccc"
clip: true
Flickable{
id:flick
width: parent.width
height: contentHeight>100?100:contentHeight
contentHeight: edit.height
TextArea.flickable: TextArea{
Material.foreground : "#ffffff"
id:edit
padding: 0
width: parent.width
font.pointSize: 14
height: contentHeight>btn.height?contentHeight:btn.height
wrapMode: TextArea.Wrap
textFormat: TextEdit.RichText
text:"Hello~~"
Component.onCompleted: {
edit.insert(edit.length,"");
}
onTextChanged: {
lizi.dodo(20)
}
onFocusChanged: {
if(focus == true)
{
cursorPosition = length
}
}
Lizi{
id:lizi
x:edit.cursorRectangle.x
y:edit.cursorRectangle.y
每秒發(fā)射個(gè)數(shù):10
初始大小:8
大小變化范圍:14
初始生命:1000
生命變化范圍:500
粒子速度:20
角度:0
角度變化范圍:360
}
}
ScrollBar.vertical: ScrollBar{
active: true
pressed: true}
}
}
Ola.Button{
x:flickable.x+flickable.width + offsetendx
anchors.bottom: parent.bottom
id:btn
text:"發(fā)送"
isDefault: true
// font.bold: true
// font.pointSize: 14
height: 40
width: 100
onClicked: {
myapp.jAVA_QMessage(edit.textDocument);
myapp.makeDoc(edit.textDocument);
xxx..
}
}
}