PDA

View Full Version : [QTable] Disable centering of rows on mouseclick



BrainB0ne
27th October 2006, 17:23
Hello :)

I have a question for you, i'm sitting here with a little bit weird problem.

Let me explain...
I have a QTable, what happens now is... if I have row 1 (see screenshot) just half visible on the screen, it will update itself (scroll to the start of row 1) on a click on a cell in that row... So the whole row 1 becomes visible.
All I want to do is disabling this "feature", so if I click on a cell in that row, the scrollbars must stay in place and not move .....

It's really boggling my mind :confused:

Does anybody know what i mean? or could help me solving the struggle? :D

http://img104.imageshack.us/img104/4095/centerrowsmt3.th.jpg (http://img104.imageshack.us/my.php?image=centerrowsmt3.jpg)

jacek
28th October 2006, 18:35
Does it get centered, if you select that row programmatically?

BrainB0ne
29th October 2006, 18:57
Does it get centered, if you select that row programmatically?

You mean by calling the function QTable::selectRow(int row) ?

I will try tomorrow @ work...

This is just a sample screenshot.. For the application i need this I created already a subclass from QTable and reimplemented the selectRow(int row) function and left it empty.. but also then it centers on a mouseclick. :(

jacek
29th October 2006, 19:12
but also then it centers on a mouseclick
My idea is to intercept mouse click with event filter and invoke selectRow() instead.

BrainB0ne
30th October 2006, 13:47
My idea is to intercept mouse click with event filter and invoke selectRow() instead.

Great! I solved it thanx to you...

I reimplemented the viewportMousePressEvent( QMouseEvent *e ) function at my table subclass.. and catched the mouse event, from there i call the functions i need :)