Unsolved Stop autoscrolling of QScrollArea
-
Hello folks,
I have been trying to insert more than 50-100 item from the top in QScrollarea layout, but the strange thing happens, it scrolls fastly upward automatically. I need a solution to stop this automatic scrolling on inserting widgets in it... Can anybody help? -
You can set the vertical slider position to what you want to scroll using setSliderPosition .
http://doc.qt.io/archives/qt-4.8/qabstractscrollarea.html#verticalScrollBar
-
@Ratzz
Actually, when we insert from the top, slider position is already 0 & resetting it to 0 won't work -
@Viki_Dev
Can you show what are you trying to do? -
@Ratzz
Ok I am sending you details in a file, plz guide
[0_1524807757205_QtLazyLoading.rar](Uploading 100%) -
@Viki_Dev
Where is the file? -
this is loaded on clicking - pageup
this is loaded on clicking - pagedownmiddle items are not loaded, the are loaded as scrolling, but when scrolling from bottom to top, scrollarea moves automatically up. it should not do so..
-
Can you show what you do in "page up" and "page down" ?
-
@Ratzz
There is a timer which calls a updateMainArea method which refreshes these 600 items in every 10ms, on page up & page down, I am just changing start & end index, due to which items are getting loaded from top/bottom as required & also increased as index changedvoid Widget::on_upButton_clicked()
{
clearScrollView();
m_iStartIndex = 0;
m_iEndIndex = m_iNumberOfVisibleRecord;
}void Widget::on_downButton_clicked()
{
clearScrollView();
m_iStartIndex = MAX_RECORD_COUNT-m_iNumberOfVisibleRecord;
m_iEndIndex = MAX_RECORD_COUNT;
updateMainArea();
ui->scrollArea->verticalScrollBar()->setValue(ui->scrollArea->verticalScrollBar()->maximum());
}Is there a way I can pass you this project.. ? I am new to this website...
-
Hi,
Out of curiosity, why not use a QTableView for that ?
-
@SGaist lots of implementation have been done already, it not good to change now
-
@Viki_Dev said in Stop autoscrolling of QScrollArea:
Is there a way I can pass you this project
Hi,
doesn't the Upload File option work when you edit a post (see image)? -
@Diracsbracket [0_1525958935598_QtLazyLoading.rar](Uploading 100%)
No its saying, not have enough rights.. -
@Viki_Dev said in Stop autoscrolling of QScrollArea:
not have enough rights
That's odd...
As a workaround, you could also use some temporary storage and pass the link.
For example, https://expirebox.com/. Files will only be available for download for 2 days though. There are plenty of other possibilities out there it seems.