Results 1 to 6 of 6

Thread: problem to use the QItemDelegate

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2012
    Posts
    3
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Question problem to use the QItemDelegate

    Hi,
    I have a problem to use the QItemDelegate:

    I have a QTableView and an QAbstractTableModel associated.
    Inside some cells of the table I set a custom ItemDelegate using a combobox.

    Sometimes when I select quickly a field of the combobox , the setModelData method of the delegate is not called and the corresponding cell remains empty.

    Conversely, If I select a field in the combobox slowly this problem does not occur.

    Someone can help me??

    Thank you and sorry for my bad english.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: problem to use the QItemDelegate

    How do you "select quickly"?
    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. #3
    Join Date
    Jul 2012
    Posts
    3
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: problem to use the QItemDelegate

    Maybe is necessary a clarification:

    the problem is appears when I tried to show the combobox at first click on cell of table;
    in standard condition instead, I need to two clicks for show the combobox:

    one click for the focus on the cell
    the second one for show the combobox

    To enable the display of the combobox with a single click, each time that I click on a cell, I call the method openPersistentEditor(),
    passing the QModelIndex given by click event.
    obviously when I click on another cell, I close the persistent editor preceding opened and so forth.

    The interactions to do "quickly" and that show an problem are the following:

    1) the first click on the cell for shows of the combobox;
    2) the second click for expands the combobox
    3) the third click for selects an item of the combobox (generally the second element)

    When I lost focus on the cell, sometimes (3/10 in average) leaves the cell selection resulting empty

    If I do this interactions "slowly" the problem doesn't happens.

    with "quick selection" i meant: hitting three times the mouse button in rapid succession, as fast as I can
    with "slow selection" i meant: as the quick one, but leaving half a second between clicks

    NB: If I remove the "ONE CLICK" function the problem doesn't happens.


    Thanks
    Diego.

  4. #4
    Join Date
    Oct 2011
    Posts
    27
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: problem to use the QItemDelegate

    hi,

    why not using QAbstractItemView::setItemDelegate ?

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: problem to use the QItemDelegate

    Quote Originally Posted by mashi View Post
    To enable the display of the combobox with a single click, each time that I click on a cell, I call the method openPersistentEditor()
    And why not QAbstractItemView::edit()?
    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.


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

    mashi (25th July 2012)

  7. #6
    Join Date
    Jul 2012
    Posts
    3
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: problem to use the QItemDelegate

    thanks a lot, with QAbstractItemView::edit() i have resolve my problem!!

Similar Threads

  1. Problem with QItemDelegate
    By chandan in forum Newbie
    Replies: 9
    Last Post: 15th April 2010, 15:04
  2. SQL and QItemDelegate problem
    By vieraci in forum Qt Programming
    Replies: 4
    Last Post: 31st May 2009, 01:07
  3. pyqt custom QItemDelegate problem
    By spohle in forum Qt Programming
    Replies: 0
    Last Post: 31st January 2009, 01:48
  4. QComboBox+QItemDelegate+QDateTimeEdit Problem
    By bangqianchen in forum Qt Programming
    Replies: 2
    Last Post: 15th September 2008, 10:14
  5. QItemDelegate problem
    By WinchellChung in forum Newbie
    Replies: 2
    Last Post: 5th December 2007, 16:16

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
  •  
Qt is a trademark of The Qt Company.