Results 1 to 5 of 5

Thread: how to color the top edge of a rect

  1. #1
    Join Date
    Feb 2008
    Posts
    102
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question how to color the top edge of a rect

    How can i color the top edge of my custom QGraphicsRectItem......?????
    i perhaps guess reimplementing the paint() event........
    Can i have an example??

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: how to color the top edge of a rect

    There's an example in QGraphicsItem::paint() docs.
    J-P Nurmi

  3. #3
    Join Date
    Feb 2008
    Posts
    102
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question Re: how to color the top edge of a rect

    reimplementing the paint() virtual function, i obtain my behaviour but then i can't set other parameters like the color inside my rect.
    I'd just like to color the top edge of my rect and to leave the building of the other attributes to its parent class.......

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: how to color the top edge of a rect

    Call the base class implementation:
    Qt Code:
    1. void SubClass::function()
    2. {
    3. BaseClass::function(); // <--
    4.  
    5. ... // do something else
    6. }
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

  5. #5
    Join Date
    Feb 2008
    Posts
    102
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Thumbs up Re: how to color the top edge of a rect

    thx.......

Similar Threads

  1. Snap/Dock QDialog to the edge of the screen
    By durbrak in forum Qt Programming
    Replies: 5
    Last Post: 14th December 2006, 04:41

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.