Results 1 to 5 of 5

Thread: How to obtain the layout of the windows of a tab widget?

  1. #1
    Join Date
    Jan 2006
    Location
    Catalonia
    Posts
    266
    Thanks
    44
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Question How to obtain the layout of the windows of a tab widget?

    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.
    Attached Images Attached Images

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How to obtain the layout of the windows of a tab widget?

    Have you tried to set viewport margins for the list widget?
    QAbstractScrollArea::setViewportMargins()

  3. #3
    Join Date
    Jan 2006
    Location
    Catalonia
    Posts
    266
    Thanks
    44
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to obtain the layout of the windows of a tab widget?

    Quote Originally Posted by jpn
    Have you tried to set viewport margins for the list widget?
    QAbstractScrollArea::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

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How to obtain the layout of the windows of a tab widget?

    How about QListView::setSpacing() then? It adds space between items too, though..

  5. The following user says thank you to jpn for this useful post:

    SkripT (22nd March 2006)

  6. #5
    Join Date
    Jan 2006
    Location
    Catalonia
    Posts
    266
    Thanks
    44
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to obtain the layout of the windows of a tab widget?

    Quote Originally Posted by jpn
    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

Similar Threads

  1. QDockWidget inside another widget in the center?
    By Antebios in forum Qt Programming
    Replies: 1
    Last Post: 16th February 2010, 07:06
  2. changing layout of a widget
    By mikro in forum Qt Programming
    Replies: 10
    Last Post: 4th August 2009, 20:21
  3. Resize widget force layout resizing
    By ^NyAw^ in forum Qt Programming
    Replies: 17
    Last Post: 11th February 2009, 11:27
  4. Widget without window decoration in windows
    By jiveaxe in forum Qt Programming
    Replies: 2
    Last Post: 26th June 2008, 20:25
  5. resizing events of a custom widget in a layout
    By Rooster in forum Qt Programming
    Replies: 7
    Last Post: 16th February 2008, 10:52

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.