Results 1 to 2 of 2

Thread: QGraphicsProxywidget / delegate control focus confusion

  1. #1
    Join Date
    Sep 2013
    Posts
    4
    Qt products
    Qt5
    Platforms
    Windows

    Default QGraphicsProxywidget / delegate control focus confusion

    Hi,

    I've got a QTreeview in a QGraphicsScene (inside a qgraphicsproxywidget), with various delegates to display various controls (checkboxes, comboboxes, spinboxes lineedits etc). After a fair amount of effort I pretty much have all the delegate controls working in a reasonable manner.

    The only outstanding problem seems to be that for controls like QSpinBoxes, or QLineEdits, if I'm editing them (i.e the control is visible), and then click somewhere on the scene (outside the QGraphicsProxyWidget), then click back in the QGraphicsProxyWidget then my program crashes with an access violation (usually in QGraphicsScene::inputMethodQuery(Qt::InputMethodQu ery query), specfically in the line QVariant value = d->focusItem->inputMethodQuery(query)).

    I can see that QAbstractItemView::commitData is called when the QGraphicsProxywidget loses focus in this way and model is updated correctly. I think whats happening is that the proxywidget stores the delegate control as it's focusWidget and try's to restore it when it regains focus (but by that time it's been destroyed).

    I'd be happy if I could just get it to behave as if I had clicked somewhere outside the treeview on the proxywidget.

    Any Ideas?

    Thanks,

    Jamie

  2. #2
    Join Date
    Sep 2013
    Posts
    4
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QGraphicsProxywidget / delegate control focus confusion

    calling ClearFocus on the editor controls in the delegate's setModelData seems to prevent the crash.

Similar Threads

  1. Replies: 10
    Last Post: 10th August 2012, 15:51
  2. How to control the color of the focus rectangle
    By Berryblue031 in forum Qt Programming
    Replies: 2
    Last Post: 21st June 2012, 13:55
  3. How to set focus on control
    By sq_vasya in forum Qt Programming
    Replies: 3
    Last Post: 8th November 2010, 20:06
  4. Replies: 2
    Last Post: 8th October 2010, 07:03
  5. Replies: 8
    Last Post: 9th July 2010, 00:37

Tags for this Thread

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.