Results 1 to 2 of 2

Thread: QTableView does not query all roles for a column

  1. #1
    Join Date
    Sep 2010
    Posts
    62
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QTableView does not query all roles for a column

    Hello,

    For all but one (column 2) QTableView columns, the view queries the model for 7 different roles - 8,6,7,9,10,1,0. That is OK.
    For one column (column 2) only one role (0) is queried. See the data() call dump below.

    I can't remember that I did anything special with this column. What could be the cause?

    THX for any hint

    qDebug() << "data " << modelIdx << "role " << role;
    --------------------------------------------------------------------------------
    data QModelIndex(0,0,0x0,MstkCmdModel(0x810d810, name = "MstkCmdModel#a0179e") ) role 8
    data QModelIndex(0,1,0x0,MstkCmdModel(0x810d810, name = "MstkCmdModel#a0179e") ) role 6
    data QModelIndex(0,1,0x0,MstkCmdModel(0x810d810, name = "MstkCmdModel#a0179e") ) role 7
    data QModelIndex(0,1,0x0,MstkCmdModel(0x810d810, name = "MstkCmdModel#a0179e") ) role 9
    data QModelIndex(0,1,0x0,MstkCmdModel(0x810d810, name = "MstkCmdModel#a0179e") ) role 10
    data QModelIndex(0,1,0x0,MstkCmdModel(0x810d810, name = "MstkCmdModel#a0179e") ) role 1
    data QModelIndex(0,1,0x0,MstkCmdModel(0x810d810, name = "MstkCmdModel#a0179e") ) role 0
    data QModelIndex(0,1,0x0,MstkCmdModel(0x810d810, name = "MstkCmdModel#a0179e") ) role 8
    data QModelIndex(0,2,0x0,MstkCmdModel(0x810d810, name = "MstkCmdModel#a0179e") ) role 0
    data QModelIndex(0,3,0x0,MstkCmdModel(0x810d810, name = "MstkCmdModel#a0179e") ) role 6
    data QModelIndex(0,3,0x0,MstkCmdModel(0x810d810, name = "MstkCmdModel#a0179e") ) role 7
    data QModelIndex(0,3,0x0,MstkCmdModel(0x810d810, name = "MstkCmdModel#a0179e") ) role 9
    data QModelIndex(0,3,0x0,MstkCmdModel(0x810d810, name = "MstkCmdModel#a0179e") ) role 10
    data QModelIndex(0,3,0x0,MstkCmdModel(0x810d810, name = "MstkCmdModel#a0179e") ) role 1
    data QModelIndex(0,3,0x0,MstkCmdModel(0x810d810, name = "MstkCmdModel#a0179e") ) role 0
    data QModelIndex(0,3,0x0,MstkCmdModel(0x810d810, name = "MstkCmdModel#a0179e") ) role 8
    Last edited by lotek; 16th February 2011 at 11:48.

  2. #2
    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 does not query all roles for a column

    What is the value of the row 0 col 2 cell? A null QVariant() perhaps? If there is nothing to display then you don't need the font, text alignment, text colour, check state etc.

Similar Threads

  1. how to disbale a column in a QTableView
    By rdjenner in forum Qt Programming
    Replies: 8
    Last Post: 14th August 2019, 15:44
  2. Getting all roles of specified column and/or model
    By NoRulez in forum Qt Programming
    Replies: 0
    Last Post: 29th April 2010, 11:21
  3. QTableView column trouble
    By nategoofs in forum Qt Programming
    Replies: 6
    Last Post: 27th October 2009, 20:14
  4. SQL Query column names
    By rakkar in forum Newbie
    Replies: 1
    Last Post: 9th September 2009, 19:06
  5. Replies: 2
    Last Post: 27th August 2009, 20: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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.