
Originally Posted by
high_flyer
you can set the scroll policy via setVerticalScrollBarPolicy().
Thanks, but this not work:
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
appendHtml(html);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
appendHtml(html);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
To copy to clipboard, switch view to plain text mode
This code doesn't disable scrolling of text. Moreover, scrolling to bottom always.
I found(probably good for me) solution for disable scrolling:
...
volatile bool lock = false;
...
...
volatile bool lock = false;
...
To copy to clipboard, switch view to plain text mode
override virtual function scrollContentsBy of QPlainTextEdit:
void my_plaintextedit::scrollContentsBy(int dx, int dy)
{
if(lock == false)
QPlainTextEdit::scrollContentsBy(dx, dy);
}
void my_plaintextedit::scrollContentsBy(int dx, int dy)
{
if(lock == false)
QPlainTextEdit::scrollContentsBy(dx, dy);
}
To copy to clipboard, switch view to plain text mode
and:
void my_plaintextedit
::append_line(const QString & html
) {
if(mouse_press) //is mouse button pressed in viewport of QPlainTextEdit?
lock = true;
appendHtml(html);
lock = false;
}
void my_plaintextedit::append_line(const QString & html)
{
if(mouse_press) //is mouse button pressed in viewport of QPlainTextEdit?
lock = true;
appendHtml(html);
lock = false;
}
To copy to clipboard, switch view to plain text mode
Bookmarks