Results 1 to 8 of 8

Thread: QAbstractScrollArea::setViewportMargins() not working :(

  1. #1
    Join Date
    Oct 2007
    Location
    India
    Posts
    162
    Thanks
    20
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QAbstractScrollArea::setViewportMargins() not working :(

    I want to add a widget in a QTableView by shifting the viewport a bit down. I tried using QAbstractScrollArea::setViewportMargins() in the constructor of QTableView but it doesn't seem to do anything. Any ideas?

  2. #2
    Join Date
    Oct 2007
    Location
    India
    Posts
    162
    Thanks
    20
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QAbstractScrollArea::setViewportMargins() not working :(

    just found this:
    http://www.qtsoftware.com/developer/...entry&id=94559

    Bug Description: setViewportMargins() has no effect on QTableView, when calling this function it does not visual change to the margins for the QTableView widget.

    Answer:
    QTableView manages the viewport margins itself, this is not something that the user should be able to set.
    so it means i can't change the margins in QTableView?

  3. #3
    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: QAbstractScrollArea::setViewportMargins() not working :(

    Have you tried style sheets?
    J-P Nurmi

  4. #4
    Join Date
    Oct 2007
    Location
    India
    Posts
    162
    Thanks
    20
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QAbstractScrollArea::setViewportMargins() not working :(

    Ya, i am using style sheets but i don't know if by using style sheets i can achieve what i want here.

  5. #5
    Join Date
    Oct 2008
    Location
    Beijing China
    Posts
    77
    Thanks
    21
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QAbstractScrollArea::setViewportMargins() not working :(

    Does setContentsMargins() and getContentsMargins() and contentsRect() work?

  6. #6
    Join Date
    Oct 2007
    Location
    India
    Posts
    162
    Thanks
    20
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QAbstractScrollArea::setViewportMargins() not working :(

    Quote Originally Posted by nifei View Post
    Does setContentsMargins() and getContentsMargins() and contentsRect() work?
    nope. Doesn't seem to work with QTableView.

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QAbstractScrollArea::setViewportMargins() not working :(

    Have you seen if the bug was fixed in newer releases? If not, maybe you can use QTreeView instead?

  8. #8
    Join Date
    Oct 2007
    Location
    India
    Posts
    162
    Thanks
    20
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QAbstractScrollArea::setViewportMargins() not working :(

    doesn't seem to be fixed in the newer version too. I am using a workaround for now. Will see if i can use TreeView.

Similar Threads

  1. QTableView doubleclicked event not working
    By sgmurphy19 in forum Qt Programming
    Replies: 6
    Last Post: 15th March 2009, 10:00
  2. QResource Stopped Working
    By JPNaude in forum Qt Programming
    Replies: 0
    Last Post: 22nd October 2008, 12:26
  3. QDevelop and CTags -> Not working
    By philwinder in forum Qt-based Software
    Replies: 13
    Last Post: 9th May 2008, 21:40
  4. Don't want QTextBrowser to look in working directory
    By magland in forum Qt Programming
    Replies: 1
    Last Post: 20th October 2007, 23:14
  5. GUI thread and Working thread comunication
    By FasTTo in forum Qt Programming
    Replies: 2
    Last Post: 13th September 2007, 15:31

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
  •  
Qt is a trademark of The Qt Company.