How can I support page up/page down on QTextEdit
I am using Qtopia4.3.2
question 1:
How can I support page up/page down on QTextEdit?
I found that page up/down is a Qt3 function, how can I support it on Qt4?
question 2:
The first or last line in one page would be cut off by the border of the QTextEdit, how can I enhancement?
Thanks very much
Re: How can I support page up/page down on QTextEdit
Quote:
Originally Posted by
wesley
How can I support page up/page down on QTextEdit?
QTextEdit supports them by default. See http://doc.trolltech.com/4.3/qtexted...y-key-bindings.
Quote:
The first or last line in one page would be cut off by the border of the QTextEdit, how can I enhancement?
Are you using layouts?
Re: How can I support page up/page down on QTextEdit
Quote:
Originally Posted by
jpn
How can I page up / down myself, I mean that if I want to use "+"/"-" key to page down/up, how can i do ? Is there a API to call ?
Quote:
Are you using layouts?
sorry, I don't understand what your mean.
I layout the QTextEdit into a window widget. Is this the problem?
Re: How can I support page up/page down on QTextEdit
Quote:
Originally Posted by
wesley
How can I page up / down myself, I mean that if I want to use "+"/"-" key to page down/up, how can i do ? Is there a API to call ?
Ahh, that's what you meant. I believe you can catch the corresponding key event yourself and then send a fake event with pageup/pagedown key to QTextEdit (unfortunately I can't see any public API for this).
Quote:
sorry, I don't understand what your mean.
I layout the QTextEdit into a window widget. Is this the problem?
Could you by any chance provide a screenshot of the problem. I'm not sure if I follow either.. :)
Re: How can I support page up/page down on QTextEdit
Quote:
Originally Posted by
jpn
Ahh, that's what you meant. I believe you can catch the corresponding key event yourself and then send a fake event with pageup/pagedown key to QTextEdit (unfortunately I can't see any public API for this).
ahh, I found out a solution for this, share with you, see below,
Code:
QScrollBar *vbar
= detailTextEdit
->verticalScrollBar
();
if (vbar)
{
switch (event->key())
{
case Qt::Key_Backward:
break;
case Qt::Key_Forward:
break;
}
}
Is this solution sound good?
Quote:
Could you by any chance provide a screenshot of the problem. I'm not sure if I follow either.. :)
I am meaning that the top of the letters in the first line of a text edit will be cut off by the top of view port of text edit, the bottom of the letters in the last line of a text edit will be cut off by the bottom of view port of text edit.
Sorry, I am poor in englist. ^_^
Re: How can I support page up/page down on QTextEdit
Quote:
Originally Posted by
wesley
Is this solution sound good?
Looks much better than my workaround suggestion. :)
Quote:
I am meaning that the top of the letters in the first line of a text edit will be cut off by the top of view port of text edit, the bottom of the letters in the last line of a text edit will be cut off by the bottom of view port of text edit.
Sounds weird. Does this happen if you run the application with other style?
Code:
./app -style plastique
Re: How can I support page up/page down on QTextEdit
Sounds weird. Does this happen if you run the application with other style?
Code:
./app -style plastique
[/QUOTE]
I meant that if the height of text edit can not be divided exactly by the height of one line(string), then the top /bottom of the string will be cut off by the top/bottom
of text edit's view port.
Re: How can I support page up/page down on QTextEdit
do you solve this problem now?:)