Results 1 to 8 of 8

Thread: Adding an editor to the already existing list of QItemEditorFactory

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    517
    Thanks
    21
    Thanked 66 Times in 62 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Adding an editor to the already existing list of QItemEditorFactory

    thats a very good catch! but i dont know how you are able to edit both data types when commenting setDefaultFactory()...anyways, couple of ways to resolve your issue:

    1. using delegate: dont set this factory as default, just call setItemEditorFactory(QItemEditorFactory *) on QStyledItemDelegate, Qt's right hand for drawing views. thus when QVariant::Type is Color, it will create your custom editor, for all other QVariant types, it will use default factory.

    2. derive from QItemEditorFactory, implement createEditor(..) in a way that if type is Color, it will use ColorEditor, otherwise it will call default factory's createEditor(..). next, set this new class as the default editor factory.

    i think second one will work better for you, i.e. without interfering with any delegate.

  2. The following user says thank you to talk2amulya for this useful post:

    schall_l (25th May 2009)

Similar Threads

  1. Adding items to a QGraphicsScene's selection list?
    By mooreaa in forum Qt Programming
    Replies: 2
    Last Post: 1st July 2008, 20:01

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.