Results 1 to 5 of 5

Thread: changing column width of QTableWidget

  1. #1
    Join Date
    Mar 2007
    Posts
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default changing column width of QTableWidget

    Hello everyone! I'm new to QT and using QT 4.4.2. I wonder why I can't change the width of columns in QTableWidget. I'm trying to do it like this:

    ui.setupUi((QMainWindow *)this);
    ui.tableWidget->horizontalHeaderItem(3)->setSizeHint(QSize(1000, 100));
    QSize sh = ui.tableWidget->horizontalHeaderItem(3)->sizeHint();

    The height of the row does really change to 100. The horisontal sizeHint is set to 1000, but the width doesn't change. Can someone help me, pls? Is there another way to change column width?

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,716
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: changing column width of QTableWidget


  3. #3
    Join Date
    Mar 2007
    Posts
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: changing column width of QTableWidget

    This is a QTableVew method, not QTableWidget.

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,716
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: changing column width of QTableWidget


  5. #5
    Join Date
    Mar 2007
    Posts
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: changing column width of QTableWidget

    Oh, I see. Wasn't attentive enough

Similar Threads

  1. QTableWidget stretch a column other than the last one
    By roleroz in forum Qt Programming
    Replies: 6
    Last Post: 4th February 2015, 07:35
  2. Replies: 6
    Last Post: 13th October 2006, 15:40
  3. QTable column stretchable with minimum Width
    By sunil.thaha in forum Qt Programming
    Replies: 0
    Last Post: 24th April 2006, 14:17
  4. QTableWidget column and row sizes
    By Arthur in forum Qt Programming
    Replies: 4
    Last Post: 27th January 2006, 12:03
  5. How to obtain the width of a QTableWidget?
    By Giel Peters in forum Qt Programming
    Replies: 3
    Last Post: 9th January 2006, 23:34

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.