On May 14, 2013, at 9:17 AM, Mojmír Svoboda <mojmir.svob...@warhorsestudios.cz> 
wrote:

> Hello,
> 
> my problem is simple: when an user press ctrl+end to scroll to the end
> of the table then there is an implicit horizontal scroll to the right.
> My users requested few times already to disable that behaviour.
> 
> I subclassed QTableView as i did not found any other way (sorry if i
> missed something obvious), but as soon as i tried to override moveCursor
> i started to fail because of internals like d->visualCursor or d->spans.
> Some of them seem trivial to bypass (like d->root, d->visualRow etc)
> some of them not (d->spans).
> 

Hi,

Perhaps you could simply return the desired sibling for the index returned by 
the base class implementation. Consider the following pseudo-example:

QModelIndex MyTableView::moveCursor(action, modifiers)
{
    QModelIndex index = QTableView::moveCursor(action, modifiers);
    if (action == MoveEnd && modifiers & Control)
        index = index.sibling(index.row(), currentIndex().column()); // keep 
the column intact
    return index;
}

--
J-P Nurmi

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to