Results 1 to 2 of 2

Thread: QTableView queries

  1. #1
    Join Date
    Sep 2009
    Posts
    49
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QTableView queries

    I am using a QTableView and QStandardItemModelto display 3 dimensional floating point arrays.
    Three things I would want to know:

    1. How to disable a cell or make it only readable?
    2. Disable column selection when clicking the headerLabel of particular column?
    3. There are 3 columns for X,Y & Z values. How to set their width so they can take equal horizontal space of tableView width?
    Prashant


    qt-sdk-win-opensource-2009.03.1.exe
    Python 2.6.3
    PyQt-Py2.6-gpl-4.6-1
    Win XP, 32 Bit

  2. #2
    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 queries

    Quote Originally Posted by prashant View Post
    1. How to disable a cell
    Don't return the Qt::ItemIsEnabled flag for it.
    or make it only readable?
    Don't return the Qt::ItemIsEditable flag for it.

    2. Disable column selection when clicking the headerLabel of particular column?
    Probably by reimplementing proper mouse events on QHeaderView.

    3. There are 3 columns for X,Y & Z values. How to set their width so they can take equal horizontal space of tableView width?
    See QHeaderView::setResizeMode.
    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.


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

    prashant (4th November 2009)

Similar Threads

  1. QSqlTableModel, QTableView and complex queries
    By Walter in forum Qt Programming
    Replies: 8
    Last Post: 15th November 2009, 01:20
  2. One Model, Two Views (QTreeView and QTableView)
    By dgarrett97 in forum Newbie
    Replies: 2
    Last Post: 14th September 2009, 18:10
  3. Replies: 2
    Last Post: 7th June 2009, 10:47
  4. A few queries about Model View Programming
    By montylee in forum Qt Programming
    Replies: 46
    Last Post: 2nd March 2009, 08:36
  5. Multi-line messages in QTableView
    By Conel in forum Qt Programming
    Replies: 6
    Last Post: 13th April 2006, 13:49

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.