Hi There,
just playing around with Qtableview.
What I want to do is insert a new row, scroll to it, and show it selected.
I have a working insert with the following code connected to a button
private void insert()
{
String Nr="999";
model.insertRow(model.rowCount());
model.setData(model.index(model.rowCount()-1,0), Integer.parseInt(Nr));
}
private void insert()
{
String Nr="999";
model.insertRow(model.rowCount());
model.setData(model.index(model.rowCount()-1,0), Integer.parseInt(Nr));
}
To copy to clipboard, switch view to plain text mode
I achieved to scroll down the view by doing:
insertButton.clicked.connect(view, "scrollToBottom()");
insertButton.clicked.connect(view, "scrollToBottom()");
To copy to clipboard, switch view to plain text mode
But I can't accomplish to select the inserted row automaticly.
Tried view.selectrow in my insert routine and fumbled with a selectionmodel but all failed in the end
with a NullPointerException.
I' am aware this is a very basic question and tried my best to squeeze the answer out of google, but
nothing got me on track, so any hint would be greatly appreciated.
Thanks
Bookmarks