Results 1 to 12 of 12

Thread: Editable QComboBox with QItemDelegate

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2008
    Posts
    14
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Editable QComboBox with QItemDelegate

    Well, as I posted on the first post it's a slot which calls
    Qt Code:
    1. emit commitData(qobject_cast<QWidget *>(sender()));
    To copy to clipboard, switch view to plain text mode 

    EDIT : Yes, it's a slot
    Coding for Actionaz 3

  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: Editable QComboBox with QItemDelegate

    Yeah, but it doesn't make much sense, as the line edit is not the editor.

  3. #3
    Join Date
    Jul 2008
    Posts
    14
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Editable QComboBox with QItemDelegate

    Huh, that is true

    Ok, I will look how to use the event filter.
    Coding for Actionaz 3

  4. #4
    Join Date
    Jul 2008
    Posts
    14
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Editable QComboBox with QItemDelegate

    It is probably a noobish question, but how do I installEventFilter within createEditor, because since createEditor is const, calling myLineEdit->installEventFilter(this) produces an error...

    I doesn't know why it is so complicated to put a simple QComboBox into a cell

    Anyway, I tested with having persistent editors : it seems to work, but the method of showing an editor when needed is much better...
    Coding for Actionaz 3

  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: Editable QComboBox with QItemDelegate

    You have to cheat using const_cast(). You can take a look at the implementation of QItemDelegate and the factory class it uses to see how it is internally implemented. With all the event filters and stuff.

  6. #6
    Join Date
    Jul 2008
    Posts
    14
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Editable QComboBox with QItemDelegate

    I will look at it, thanks
    Coding for Actionaz 3

  7. #7
    Join Date
    Dec 2008
    Location
    Irkutsk, Russia
    Posts
    5
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Editable QComboBox with QItemDelegate

    Excuse me, may be it's easy, but what is CustomRoles?

  8. #8
    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: Editable QComboBox with QItemDelegate

    Quote Originally Posted by faraslacks View Post
    Excuse me, may be it's easy, but what is CustomRoles?
    [WIKI=QAbstractItemModel#Custom_item_roles]Custom item roles in ItemViews[/WIKI]

Similar Threads

  1. QComboBox drop list button events
    By maird in forum Qt Programming
    Replies: 5
    Last Post: 20th October 2007, 19:25

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