Results 1 to 8 of 8

Thread: How can I support page up/page down on QTextEdit

  1. #1
    Join Date
    Feb 2008
    Posts
    49
    Thanks
    2
    Thanked 4 Times in 1 Post

    Question 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

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How can I support page up/page down on QTextEdit

    Quote Originally Posted by wesley View Post
    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.

    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?
    J-P Nurmi

  3. #3
    Join Date
    Feb 2008
    Posts
    49
    Thanks
    2
    Thanked 4 Times in 1 Post

    Default Re: How can I support page up/page down on QTextEdit

    Quote Originally Posted by jpn View Post
    QTextEdit supports them by default. See http://doc.trolltech.com/4.3/qtexted...y-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?
    Last edited by wesley; 29th February 2008 at 07:13.

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How can I support page up/page down on QTextEdit

    Quote Originally Posted by wesley View Post
    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..
    J-P Nurmi

  5. #5
    Join Date
    Feb 2008
    Posts
    49
    Thanks
    2
    Thanked 4 Times in 1 Post

    Default Re: How can I support page up/page down on QTextEdit

    Quote Originally Posted by jpn View Post
    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,
    Qt Code:
    1. QScrollBar *vbar = detailTextEdit->verticalScrollBar();
    2. if (vbar)
    3. {
    4. switch (event->key())
    5. {
    6. case Qt::Key_Backward:
    7. vbar->triggerAction(QAbstractSlider::SliderPageStepSub);
    8. break;
    9. case Qt::Key_Forward:
    10. vbar->triggerAction(QAbstractSlider::SliderPageStepAdd);
    11. break;
    12. }
    13. }
    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. ^_^

  6. #6
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How can I support page up/page down on QTextEdit

    Quote Originally Posted by wesley View Post
    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?
    Qt Code:
    1. ./app -style plastique
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

  7. #7
    Join Date
    Feb 2008
    Posts
    49
    Thanks
    2
    Thanked 4 Times in 1 Post

    Default Re: How can I support page up/page down on QTextEdit

    Sounds weird. Does this happen if you run the application with other style?
    Qt Code:
    1. ./app -style plastique
    To copy to clipboard, switch view to plain text mode 
    [/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.

  8. #8
    Join Date
    Sep 2010
    Posts
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Maemo/MeeGo

    Default Re: How can I support page up/page down on QTextEdit

    do you solve this problem now?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.