Results 1 to 3 of 3

Thread: QTableView ::setColumnWidth not working?

  1. #1
    Join Date
    Aug 2008
    Posts
    39
    Thanks
    12
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question QTableView ::setColumnWidth not working?

    In my code I declare a QTableView *tableView = new QTableView(), then I procede to call several functions.

    Qt Code:
    1. tableView->verticalHeader->hide()
    2. ...
    3. tableView->setColumnWidth(0, 15);
    4. tableView->setColumnWidth(1, 15);
    5. tableView->setColumnWidth(2, 15);
    6. ...
    To copy to clipboard, switch view to plain text mode 
    The problem is, the tableView doesn't reflect the setColumnWidth! I would think this would work with little to no effort? Do I have to populate the tableView with data first? Seems kinda silly.

  2. #2
    Join Date
    Aug 2006
    Posts
    77
    Thanks
    14
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QTableView ::setColumnWidth not working?

    Hi!

    Have you set the:

    tableView->setColumnCount(3);

    in your code?

  3. The following user says thank you to kemp for this useful post:

    killerwookie99 (5th November 2008)

  4. #3
    Join Date
    Aug 2008
    Posts
    39
    Thanks
    12
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QTableView ::setColumnWidth not working?

    You do have to load the tableview before setting size. Ah well.

Similar Threads

  1. QTableView doubleclicked event not working
    By sgmurphy19 in forum Qt Programming
    Replies: 6
    Last Post: 15th March 2009, 10:00

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.