Results 1 to 3 of 3

Thread: Delegate paint event bug?

  1. #1

    Default Delegate paint event bug?

    hi,

    I make my model view and delegate, I find that every time my mouse enter in/out the view,all items delegate's paint event are called. this is very time consume, because these items are not need to be repaint as i only move my mouse in and out to the view. Is it a bug? Or how to disable these event?

    thanks !

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

    Default Re: Delegate paint event bug?

    Did you enable mouse tracking or did something else non-standard (like asking the widget to accept hover events) on the view or its viewport?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3

    Default Re: Delegate paint event bug?

    No, i have not set mouse tracking, and I can't receive the mouse Move event in MyListView when no button is pressed.

    these code in MyListView constructor:
    Qt Code:
    1. FileClipModel *model = new FileClipModel;
    2. FileClipDelegate *delegate = new FileClipDelegate;
    3. setModel(model);
    4. setItemDelegate(delegate);
    To copy to clipboard, switch view to plain text mode 

    this is delegate paint. It is called when mouse enter in/out whitout button pressed. Every time the mouse enter in/out MyListView , all item color changed!
    Qt Code:
    1. void FileClipDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index)const
    2. {
    3. painter->fillRect(option.rect,QColor(double(qrand())/RAND_MAX*255,double(qrand())/RAND_MAX*255,double(qrand())/RAND_MAX*255));
    4. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Paint in Custom Delegate
    By Nightfox in forum Qt Programming
    Replies: 4
    Last Post: 7th October 2010, 20:54
  2. Delegate doesn't paint properly
    By woodtluk in forum Qt Programming
    Replies: 4
    Last Post: 11th August 2010, 11:43
  3. Timer event & paint event, priority
    By Teuniz in forum Qt Programming
    Replies: 0
    Last Post: 2nd February 2010, 13:33
  4. Paint event function in key press event
    By soumya in forum Qt Programming
    Replies: 6
    Last Post: 2nd February 2010, 12:40
  5. Delegate paint optimisation
    By bunjee in forum Qt Programming
    Replies: 11
    Last Post: 21st April 2008, 19:48

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.