Results 1 to 2 of 2

Thread: Painting on QML Element

  1. #1
    Join Date
    Nov 2011
    Location
    Bangalore
    Posts
    26
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60

    Default Painting on QML Element

    Hi all......
    I am looking for a solution for my problem...But i didn't any solution yet..Please help me out...

    I have created my own QML element and i am able to implement it inside a class... I will be setting some properties of this QML element from my C++ class... That is working fine... But i need to make some drawings on the QML element which i cannot do in the QML file directly... So i need to implement PaintEvent in my class to do that... I tried to implement PaintEvent, but i am unable draw over my QML element... Hope you understand my problem... Please give me a solution.....


    Thank u...

  2. #2
    Join Date
    Oct 2011
    Posts
    35
    Thanked 9 Times in 3 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Painting on QML Element

    If you want to do custom drawing on a QML element, you will need to ensure that your corresponding C++ class derives from QDeclarativeItem and override the virtual paint() method. http://get.qt.nokia.com/training/QtQ...ntegration.pdf has an exact code example for what you're looking for (in particular, check out slides 10-21 that show how to draw an Ellipse in your C++-based QML element).

    Note that QDeclarativeItem will be replaced in Qt 5, so some porting effort will be required if you decide to migrate later.

Similar Threads

  1. Replies: 9
    Last Post: 23rd April 2012, 13:53
  2. Get element in Qgridlayout
    By dieter in forum Newbie
    Replies: 1
    Last Post: 12th February 2012, 09:51
  3. [QML] Video element
    By grezly in forum Qt Programming
    Replies: 1
    Last Post: 6th April 2011, 17:26
  4. Remove element of xml
    By VitaliBR in forum Newbie
    Replies: 17
    Last Post: 16th February 2011, 13:28
  5. Help with QML Pathview element
    By chetu1984 in forum Newbie
    Replies: 0
    Last Post: 7th February 2011, 04:49

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.