Results 1 to 2 of 2

Thread: QDeclarativItem::update() does not work

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2012
    Posts
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default QDeclarativItem::update() does not work

    Hello everybody.

    I want to write a simple QML item that extends QDeclarativeItem and represents a sector (http://en.wikipedia.org/wiki/Circular_sector).

    Several properties are defined in my class
    Qt Code:
    1. Q_PROPERTY( QColor color READ color WRITE setColor )
    2. Q_PROPERTY( double width READ width WRITE setWidth )
    3. Q_PROPERTY( double height READ height WRITE setHeight )
    4. Q_PROPERTY( double startAngle READ startAngle WRITE setStartAngle )
    5. Q_PROPERTY( double spanAngle READ spanAngle WRITE setSpanAngle )
    6. Q_PROPERTY( double opacity READ opacity WRITE setOpacity )
    To copy to clipboard, switch view to plain text mode 

    Each of them has its own setter and getter.

    I suggest item should be updated when "spanAngle" property is modified by calling "setSpanAngle" method. Therefore I put update() invocation in it:
    Qt Code:
    1. void setSpanAngle( double spanAngle )
    2. {
    3. mSpanAngle = spanAngle;
    4. update( 0, 0, mWidth, mHeight ); // UPDATE HERE
    5. }
    To copy to clipboard, switch view to plain text mode 
    In fact, update does not occur when setSpanAngle is called. But if I resize parent window it updates. (see video http://www.sendspace.com/file/gq9dn4)

    Does anyone knows the reason of such behavior?

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

    Default Re: QDeclarativItem::update() does not work

    What if you just call update() without any parameters? Also how did you define boundingRect() for your item?
    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.


Similar Threads

  1. QFileSystemModel - Incremental update/pre-emptive update
    By johnnyturbo3 in forum Qt Programming
    Replies: 0
    Last Post: 2nd September 2011, 13:56
  2. Replies: 1
    Last Post: 13th July 2011, 11:35
  3. Replies: 0
    Last Post: 12th July 2011, 08:20
  4. QWidget::update does not work!
    By sapali in forum Qt Programming
    Replies: 8
    Last Post: 17th March 2011, 16:56
  5. Replies: 2
    Last Post: 29th September 2010, 17:44

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.