int m_nVSliderValue = 0;
int m_nHSliderValue = 0;
void Widget::getScrollValue()
{
QScrollBar *vScrollbar = ui.plainTextEdit->verticalScrollBar();
m_nVSliderValue = vScrollbar->sliderPosition();
QScrollBar *hScrollbar = ui.plainTextEdit->horizontalScrollBar();
m_nHSliderValue = hScrollbar->sliderPosition();
}
void Widget::setScrollValue()
{
QScrollBar *vScrollbar = ui.plainTextEdit->verticalScrollBar();
vScrollbar->setSliderPosition(m_nVSliderValue);
QScrollBar *hScrollbar = ui.plainTextEdit->horizontalScrollBar();
hScrollbar->setSliderPosition(m_nHSliderValue);
}
QT 滚动条位置获取以及设置
最新推荐文章于 2024-09-13 16:42:01 发布