Results 1 to 5 of 5

Thread: Using most of QItemDelegate

  1. #1
    Join Date
    Aug 2008
    Location
    Iowa, USA
    Posts
    21
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Using most of QItemDelegate

    QItemDelegate does almost all that I want it to. It's paint just doesn't display html correctly. But the rest of the paint method is amazing and is something I want to use. How do I go about using all of it's paint method besides the part where is prints text?

    I've already tried giving it QModelIndex() instead of the real index, then just doing my custom painting of a QTextDocument, but then it doesn't display background colors correctly. Is there some way for me to use all of QItemDelegate::paint besides the part where it prints out text?

    Bonus Points! Is there something that exists already to print out html that also handles special cases (selected, out of focus, exc) so I don't also have to handle all of that myself?

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

    Default Re: Using most of QItemDelegate

    As for painting, there is at least one implementation of the delegate that does that available on the forum. As for handling events, you have to do it yourself or bug Trolltech to make QTextControl class public

  3. #3
    Join Date
    Aug 2008
    Location
    Iowa, USA
    Posts
    21
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Using most of QItemDelegate

    I've checked the forums (QItemDelegate html), but I was unable to find anything besides the library that you built. I'd have to buy that, which wouldn't fly over so well with the bosses.

    Do I just have to figure out all the special cases and handle them by myself? Is there some chart that exists that I can use as a cheat sheet for all the different states I might need to care about?

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

    Default Re: Using most of QItemDelegate

    Quote Originally Posted by joshuajcarson View Post
    I've checked the forums (QItemDelegate html), but I was unable to find anything besides the library that you built. I'd have to buy that, which wouldn't fly over so well with the bosses.
    Naaa.... there is a rich text delegate here somewhere. Try looking for "rich text delegate". Or rip out QTextControl as I suggested earlier. You'll need to rewrite its P-IMPL, but it should take no more than few hours of work.

  5. #5
    Join Date
    Aug 2008
    Location
    Iowa, USA
    Posts
    21
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Using most of QItemDelegate

    There is a very easy way to use more of QItemDelegate I've found.

    Most of the functionality that I wanted was already broken up and just waiting for me to use it. They are the protected methods like drawBackground and drawFocus. I just called them and handled drawing everything else. It works exactly as I'd expect it to. I really should be checking out Qt Assistant more often and seeing all that Qt has already given me to work with.

Similar Threads

  1. Help needed with QItemDelegate
    By cyberboy in forum Qt Programming
    Replies: 3
    Last Post: 9th July 2008, 18:21
  2. QItemDelegate
    By cyberboy in forum Qt Programming
    Replies: 10
    Last Post: 27th June 2008, 17:41
  3. Completer on QItemDelegate
    By gemidjy in forum Qt Programming
    Replies: 6
    Last Post: 31st March 2008, 10:29
  4. Return a pointer from a QItemdelegate
    By SailinShoes in forum Qt Programming
    Replies: 5
    Last Post: 12th March 2008, 20:07
  5. premature call to setmodeldata with QItemDelegate
    By placebo in forum Qt Programming
    Replies: 1
    Last Post: 25th November 2007, 17:39

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.