Trolltech Home | Qt-jambi-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-jambi-interest Archive, August 2006
Stuck QTableView


Message 1 in thread

Hi,

I have found a workable sollution to my problem.  But as usual, there is 
always a problem to solve.  My current one is: is there any way to force 
QTableView to resize and only use the required amount of space, instead of 
being scrollable.  

I have disabled the scrollbars but if I add too many rows, the additional rows 
disappear.  Is there a way to make QTableView resize to always show it's 
content.  Basically a way to disable QAbstractScrollArea from doing what it 
does and act as a plain QWidget?  

Failling the above is there a way to find the internal size of QTableView, 
i.e. how much space it needs to display everything.  I have looked thought 
the documentation and have found no way.  

Any help will be greatly appreciated as I have no idea what to do.  I will 
post the finished classes if anyone is interested.  

David


Message 2 in thread

David Naylor wrote:
> Hi,
> 
> I have found a workable sollution to my problem.  But as usual, there is 
> always a problem to solve.  My current one is: is there any way to force 
> QTableView to resize and only use the required amount of space, instead of 
> being scrollable.  

> I have disabled the scrollbars but if I add too many rows, the additional rows 
> disappear.  Is there a way to make QTableView resize to always show it's 
> content.  Basically a way to disable QAbstractScrollArea from doing what it 
> does and act as a plain QWidget?  
> 
> Failling the above is there a way to find the internal size of QTableView, 
> i.e. how much space it needs to display everything.  I have looked thought 
> the documentation and have found no way.  


Hi David,

I believe you'll get the proper size if you ask for its sizeHint(). If 
not, you could at least  iterate over all the rows and add up their 
height. If you have constant row height, this should be trivial.

-
Gunnar