View Full Version : How can I support page up/page down on QTextEdit
wesley
29th February 2008, 05:36
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
jpn
29th February 2008, 06:04
How can I support page up/page down on QTextEdit?
QTextEdit supports them by default. See http://doc.trolltech.com/4.3/qtextedit.html#read-only-key-bindings.
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?
wesley
29th February 2008, 06:07
QTextEdit supports them by default. See http://doc.trolltech.com/4.3/qtextedit.html#read-only-key-bindings.
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 ?
Are you using layouts?
sorry, I don't understand what your mean.
I layout the QTextEdit into a window widget. Is this the problem?
jpn
29th February 2008, 07:03
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).
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.. :)
wesley
29th February 2008, 07:23
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,
QScrollBar *vbar = detailTextEdit->verticalScrollBar();
if (vbar)
{
switch (event->key())
{
case Qt::Key_Backward:
vbar->triggerAction(QAbstractSlider::SliderPageStepSub);
break;
case Qt::Key_Forward:
vbar->triggerAction(QAbstractSlider::SliderPageStepAdd);
break;
}
}
Is this solution sound good?
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. ^_^
jpn
29th February 2008, 07:28
Is this solution sound good?
Looks much better than my workaround suggestion. :)
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?
./app -style plastique
wesley
29th February 2008, 07:39
Sounds weird. Does this happen if you run the application with other style?
./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.
kakashan
14th September 2010, 19:18
do you solve this problem now?:)
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.