Results 1 to 4 of 4

Thread: Model-View-Delegate

  1. #1
    Join Date
    May 2010
    Posts
    5
    Thanks
    1
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Model-View-Delegate

    I try to use model-view-delegate in table view. QSlider are QCheckBox are used. But I have next problems:

    1. To activate widget on table you need double-click on this, only after you may change the value
    2. When you click on check box - it is become checked, but label doesn't change (Checked and "No" label same time)
    3. When you use slider, you see old position of slider


    All problems tested under various versions of Qt (RH54 - Qt 3.x, Fedora 12 - Qt 4.6, Ubuntu 8.10 - Qt 4.4, Ubuntu 9.04 - Qt 4.6 but they are all under GNOME)

    Do you have same problems on KDE or windows?
    Is this by design or my error?
    Are there any ways to fix this?

    In attachments minimal qt project reproducing problems
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by hotdox; 11th May 2010 at 10:19.

  2. #2
    Join Date
    Feb 2007
    Location
    Wroclaw, Poland
    Posts
    72
    Thanks
    6
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Model-View-Delegate

    Ad.1 Try to look on EditTriggers in QAbstractView. Unfortunately - I couldn't find trigger which will allow view to react on every click/selection - first you need to select cell.
    Ad.2 and 3. Text and old slider position vanishes when location lost focus, which means data from delegate has been saved and control recreated. It looks like some update/redraw problems.

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

    hotdox (11th May 2010)

  4. #3
    Join Date
    May 2010
    Posts
    5
    Thanks
    1
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Model-View-Delegate

    Quote Originally Posted by T4ng10r View Post
    Ad.1 Try to look on EditTriggers in QAbstractView. Unfortunately - I couldn't find trigger which will allow view to react on every click/selection - first you need to select cell.
    This helps thanks, set QAbstractItemView::CurrentChanged|QAbstractItemView::SelectedClicked in designer
    Last edited by hotdox; 11th May 2010 at 12:10.

  5. #4
    Join Date
    May 2010
    Posts
    5
    Thanks
    1
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Model-View-Delegate

    # 3 Fixed
    using
    Qt Code:
    1. slider->setAutoFillBackground(true);
    To copy to clipboard, switch view to plain text mode 

    # 2 Fixed
    using subclassing from QCheckBox and one slot to update text connected with QCheckBox::stateChanged
    But It fixes consequences, not reasons

Similar Threads

  1. Replies: 0
    Last Post: 21st April 2010, 12:23
  2. Custom Model? Custom View? Custom Delegate?
    By Doug Broadwell in forum Newbie
    Replies: 4
    Last Post: 11th February 2010, 20:23
  3. Replies: 1
    Last Post: 1st February 2010, 18:42
  4. QSql Model-View: How to keep view in sync with model
    By schall_l in forum Qt Programming
    Replies: 1
    Last Post: 22nd December 2008, 23:31
  5. Model View - Delegate - setIndexWidget
    By starcontrol in forum Qt Programming
    Replies: 16
    Last Post: 2nd April 2008, 14:30

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.