Results 1 to 4 of 4

Thread: [QTableView] Some cells and column headers not accessible (editable)

  1. #1
    Join Date
    May 2011
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default [QTableView] Some cells and column headers not accessible (editable)

    Hello,
    I have a problem with QTableView and QSqlRelationalTableModel. The problem is that few cells and column headers are not editable. It's even not clickable.
    The following are the conditions:

    Qt Code:
    1. - QSqlRelationalTableMode
    To copy to clipboard, switch view to plain text mode 

    Thanks in advice! I hope I didn't forget anything, but if anything is missing, just ask!

    Edit: Maybe I should post some more information:
    Qt Code:
    1. model = new QSqlRelationalTableModel( tableView );
    2. model->setTable("Protokoll");
    3. proxy = new proxymodel(tableView);
    4.  
    5. // ------
    6.  
    7. model->setRelation(12,QSqlRelation("Status", "ID", "Status"));
    8.  
    9. model->setEditStrategy(QSqlTableModel::OnFieldChange);
    10. tableView->setSelectionMode(QTableView::SingleSelection);
    11. tableView->setSelectionBehavior(QTableView::SelectRows);
    12.  
    13.  
    14. tableView->setEditTriggers(QAbstractItemView::DoubleClicked);
    15. proxy->setSourceModel(model);
    16.  
    17. tableView->setModel(proxy);
    18. tableView->hideColumn(0);
    19. tableView->setItemDelegate(new QSqlRelationalDelegate(this));
    20.  
    21. tableView->setSortingEnabled(true);
    22. model->select();
    To copy to clipboard, switch view to plain text mode 
    Last edited by psychonaut; 5th May 2011 at 11:24.

  2. #2
    Join Date
    Oct 2009
    Posts
    364
    Thanks
    10
    Thanked 37 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: [QTableView] Some cells and column headers not accessible (editable)

    you didn't mention which cells and columns aren't editable.
    what is the db you are trying to connect to?

    Have you looked at: http://doc.qt.nokia.com/latest/sql-r...ablemodel.html

  3. #3
    Join Date
    May 2011
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: [QTableView] Some cells and column headers not accessible (editable)

    My database is SQLITE. I have 12 columns and 4 of them are not editable.
    Starting from left to right - the fourth, the fifth, the sixth and the seventh.

  4. #4
    Join Date
    Oct 2009
    Posts
    364
    Thanks
    10
    Thanked 37 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: [QTableView] Some cells and column headers not accessible (editable)

    so, could there be something common between those 4 columns? Can you list how all fields are defined in the database?

Similar Threads

  1. QTableView column-headers too short ...
    By kerim in forum Newbie
    Replies: 2
    Last Post: 20th April 2011, 09:09
  2. Column Not Editable
    By waynew in forum Qt Programming
    Replies: 1
    Last Post: 1st August 2010, 01:43
  3. Editable QTreeView with expandable cells
    By corrado in forum Qt Programming
    Replies: 0
    Last Post: 19th April 2010, 17:42
  4. QTableView + column span of headers
    By NoRulez in forum Qt Programming
    Replies: 2
    Last Post: 11th November 2009, 14:29
  5. Editable cells in QTableView
    By TheRonin in forum Qt Programming
    Replies: 1
    Last Post: 29th November 2006, 17:39

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.