
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,
QScrollBar *vbar
= detailTextEdit
->verticalScrollBar
();
if (vbar)
{
switch (event->key())
{
case Qt::Key_Backward:
break;
case Qt::Key_Forward:
break;
}
}
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;
}
}
To copy to clipboard, switch view to plain text mode
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. ^_^
Bookmarks