Results 1 to 5 of 5

Thread: QTableView->resizeColumnsToContents()

  1. #1
    Join Date
    May 2011
    Location
    Transylvania
    Posts
    7
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows

    Lightbulb QTableView->resizeColumnsToContents()

    Hi,
    how can I found the real, whole (partly not visible) size of a QTableView after a QTableView->resizeColumnsToContents(). I want to resize the parent of it to make the width of the QTableView to be visible without scrollbar. I do not need the current size with scrollbar! Thanks for any idea, Attila

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: QTableView->resizeColumnsToContents()

    Add all the columnWidth() and vertical header width in the QTableView, and then set this calculated size to the QTreeWidget.

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QTableView->resizeColumnsToContents()

    ...and be prepared for the situation where your table is wider than the screen or simply crowds out anything around it.

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

    Default Re: QTableView->resizeColumnsToContents()

    QAbstractScrollArea::maximumViewportSize() is a useful method. Especially if you substract the value from the width of the scroll area widget.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    May 2011
    Location
    Transylvania
    Posts
    7
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QTableView->resizeColumnsToContents()

    Thanks for ideas, I have to try out! Attila

Similar Threads

  1. QTableView and QLineEdit OUTSIDE of QTableView, like Excel
    By JoZCaVaLLo in forum Qt Programming
    Replies: 10
    Last Post: 13th May 2011, 13:20
  2. QTableWidget resizeColumnsToContents for whole table?
    By lalesculiviu in forum Qt Programming
    Replies: 1
    Last Post: 2nd March 2010, 00:08
  3. Replies: 2
    Last Post: 26th November 2009, 04:45
  4. QTableView
    By dragon in forum Qt Programming
    Replies: 0
    Last Post: 22nd September 2008, 16:53
  5. QTableView - Add Row
    By maxpower in forum Qt Programming
    Replies: 1
    Last Post: 24th November 2006, 18:18

Tags for this Thread

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.