Important: Please read the Qt Code of Conduct -

Realize QPlainTextEdit PageUp/Down in code?

  • Hi, everyOne!
    I have 2 PushButtons and a QPlainTextEdit. When clicking the 2 buttons, I want the QPlainTextEdit to pageup/down.
    Is it possible?

  • Moderators

    You can trigger a page up/down action like this:

    connect(buttonUp, &QPushButton::clicked,
            [=]{ textEdit->verticalScrollBar()->triggerAction(QAbstractSlider::SliderPageStepSub); });
    connect(buttonDown, &QPushButton::clicked,
            [=]{ textEdit->verticalScrollBar()->triggerAction(QAbstractSlider::SliderPageStepAdd); });

Log in to reply