PDA

View Full Version : How to obtain the layout of the windows of a tab widget?



SkripT
22nd March 2006, 10:09
Hi all, in my app I have a QTabWidget that conatins 6 windows. Each of these windows is a QListViews of icons (as I show on the image attached). I want to set the margins of each window because as you can see the listwidgets are nearly 'touching' the window and looks bad. I've tried obtaininig the layout of the list widgets with QWidget::layout() but it crashes. Another solution could be inserting the list widgets in a QFrame and setting the margins of the layout of this frame. The problem is that could be useful for me if everytime that I call to QTabWidget::widget(i) it returns directly a QListWidget * not a QFrame *. Anybody knows how could I do it?

Thanks.

jpn
22nd March 2006, 10:16
Have you tried to set viewport margins for the list widget?
QAbstractScrollArea::setViewportMargins() (http://doc.trolltech.com/4.1/qabstractscrollarea.html#setViewportMargins)

SkripT
22nd March 2006, 10:22
Have you tried to set viewport margins for the list widget?
QAbstractScrollArea::setViewportMargins() (http://doc.trolltech.com/4.1/qabstractscrollarea.html#setViewportMargins)

Thanks jpn, but I missed to say that I tried it too but nothing happened. Moreover it's a protected method and I prefer not to subclass QListWidget if it's possible

jpn
22nd March 2006, 10:32
How about QListView::setSpacing() then? It adds space between items too, though..

SkripT
22nd March 2006, 11:16
How about QListView::setSpacing() then? It adds space between items too, though..

Now got it working!!! thanks jpn. I didn't set the spacing because in old versions of Qt when I activate an option of the list (I don't remeber which of one) it disabled the spacing. But now seems like it's fixed :D