1 Attachment(s)
How can I implement a text editor which display it's contents from top to bottom?
I try to implement a text editor which display it's contents from top to bottom (like picture shown). Could you give me some suggestions? Thank you!
Re: How can I implement a text editor which display it's contents from top to bottom?
In Qt4.4 you can put a QTextEditor into a QGraphicsScene. Now sure how trivial it is... and how "fast" do you need this, but it's a start :)
Re: How can I implement a text editor which display it's contents from top to bottom?
Re: How can I implement a text editor which display it's contents from top to bottom?
Quote:
Originally Posted by
jpn
I rotate the item,but the secord line appeared on left of first line.How can I make the secorn line displayed on right of the first line?
Re: How can I implement a text editor which display it's contents from top to bottom?
Man, that's weird requirement. :eek: Perhaps you could lay the text by hand with help of QTextLayout.
Re: How can I implement a text editor which display it's contents from top to bottom?
Quote:
Originally Posted by
jpn
Perhaps you could lay the text by hand with help of
QTextLayout.
I tried QTextLayout and got the right alignment.But the Item does not display when I am typing.As soon as I press Enter,the Item displays the line that I just input at one moment.And the textcursor does not flash.I guess it may be the item refresh region is not my layout region.Can you give me some advise?
Code:
//Here is some code in paint
textLayout.beginLayout();
while (1) {
if (!line.isValid())
break;
line.setLineWidth(200);
line.
setPosition(QPoint(0,height
));
height += (int) line.height();
}
myheight+=height;
textLayout.endLayout();
textLayout.
draw(painter,
QPointF(0,myheight
));
Re: How can I implement a text editor which display it's contents from top to bottom?
You'll need to do the blinking cursor yourself with help of a timer.