PDA

View Full Version : why there is no update on maximize? [QTableWidget]



macias
30th July 2007, 13:36
Hello,

Application -> MDI window (maximized to the size of the app) -> qtablewidget.

My aim: keep the current cell in the view when the user resize application (scrollToItem does not work, please keep it out of the discussion -- I would like to focus on one issue per thread).

My solution:
* override resizeEvent
* use scrollbars to scroll the table

It works really, really fine... except when the application is maximized. Of course even then there is resize event but somehow the content is not scrolled properly. It is scrolled (i.e. there is scroll call), ok, but the visual effect is not correct (cell is out of the view).
When I then "manually" call my method to maintain cell in the view (via direct call from menu), table is scrolled and I can see the active cell.

So why on resize is an update and it works but on maximize (which is some kind of resize) there is an update too but this one does not work.
For me it almost look like:
maximize = resize + extra size adjustment

And this extra something change the size of the app but the resize event is not called. Or maybe in maximize event the visual update should be treated specially?

My method of keeping the current cell visible (in the view):
QScrollBar *scrollbar = table->verticalScrollBar();
scrollbar->setValue(currentRow());
For my needs it is more than ok -- except for this maximize problem.

Any help is appreciated! :-)

have a nice day, bye

PS. Dead-ends -- changeEvent is not propagated to qtablewidget, I can call my method from the window level on ChangeEvent but it does not change a thing.

jpn
7th August 2007, 08:39
changeEvent is not propagated to qtablewidget

What about the corresponding QMdiSubWindow, does it receive a change event?

macias
7th August 2007, 16:01
What about the corresponding QMdiSubWindow, does it receive a change event?

Well, I can pass it manually.

However, till now I could not solve this issue, however I found out a workaround. Switch scrollbars to per pixel scrolling instead of per row + in my reimplementation of resizeEvent I call the inherited resizeEvent twice.
Strange, a bit ugly, but works.

I think that the correct solution cannot be done without fixing some kind of bug, or a glitch in Qt itself. I already reported this problem to Trolltech.

have a nice day, bye