Window scroll issue for continuous data
-
Hi ,
in mdi window, I am appending data continuously , i want to make scroll bar independent of data, if i stopped appending data to mdi window then this scroll will work properly, otherwise if data is continuously appending , even if we scroll to top, scroll will come to bottom, i tried scroll at bottom and top, but i don't want top or bottom, it should independent. for example Qt creator compile output window scrollbar, give some suggestions to solve this issue. -
What is a mdi window and what data do you add there? Is it like QTextEdit or something?
If so then the behavior is as follows:- if the cursor was at the end when you appended text the cursor will be moved to the end and the view will scroll to it
- if the cursor was not at the end when you appended text the cursor position will not change and the view won't scroll
So if you don't want the view to scroll make sure the cursor is not at the end when you append text.
-
@Chris-Kawa
Yes, I'm appending text only in the mdi window. If I continuously adding data to the mdi window's table model cursor is always at the end, if I scroll also the cursor is not moving because the data is appending very fast to the table model. consider about terminal even though the data is coming fast we can able to scroll the scrollbar and we can see the previous data. Like the scroll bar functionality I need in my application. -
Sorry, I don't understand. So is it a text edit or a table model? Models don't have cursors. What classes do you use? The best would be if you provided a small reproducible code example.
-
@Chris-Kawa Hi..
Ok, we have one model , we are continuously appending data, on that time scroll will be always at bottom, even if we scroll to top , it will come back to bottom, until wee stop appending.
void CustomeTableView::createTabel(QString thText)
{
if(modelList.count()<=25000)
{modelList.append(thText); numRows = modelList.count(); for (int row = 0; row < numRows; row++) { for (int column = 0; column < numColumns; column++) { QStandardItem *item = new QStandardItem(modelList[row]); fsModel->setItem(row, column, item); } } }
}