Results 1 to 9 of 9

Thread: QItemDelegate with QTextEdit

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: QItemDelegate with QTextEdit

    Ok, so if I connect the signal the widget I made emits when it looses focus, to the slot setModelData() like this:
    First thing setModelData() is not a slot, so you cannot connect it to a signal.
    Second, you need not call setModelDataa(), view will call it when you editing is finished.

    So I repeat, REMOVE SIGNALS AND SLOTS, YOU DON'T NEED THEM, THEY WERE ADDED FOR SOME OTHER REQUIREMENT, this I mentioned in my earlier two posts.
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

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

    caster89 (25th April 2013)

  3. #2
    Join Date
    Apr 2013
    Posts
    15
    Thanks
    2
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: QItemDelegate with QTextEdit

    Ok, so I had seen the post, but even removing the signals I still couldn't get the model to update when I finished editing, that is why I thought I had to reput the signals. I then realised the problem was that getText() I was returning the QString which did not update, by returning QTextEdit::toPlainText the data is updated.
    Furthermore the reason i got the error when adding Q_OBJECT was that I forgot to delete the moc file, after that I didn't get the error anymore.
    Thank you for your help

Similar Threads

  1. QPushButton and QItemDelegate
    By sawerset in forum Qt Programming
    Replies: 1
    Last Post: 21st May 2009, 22:13
  2. QItemDelegate
    By Alex_123 in forum Qt Programming
    Replies: 1
    Last Post: 12th October 2008, 11:40
  3. Using most of QItemDelegate
    By joshuajcarson in forum Qt Programming
    Replies: 4
    Last Post: 6th October 2008, 16:02
  4. QItemDelegate
    By cyberboy in forum Qt Programming
    Replies: 10
    Last Post: 27th June 2008, 17:41
  5. Replies: 1
    Last Post: 16th February 2007, 07:22

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.