Results 1 to 2 of 2

Thread: event in the paint of the drawEllipse

  1. #1
    Join Date
    Jul 2010
    Posts
    71
    Thanked 8 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default event in the paint of the drawEllipse

    Hello
    I created a Node.
    I want to deal with the event.
    as If the user presses on one of the Node
    then, Out a message Or change the color of the Node.

    in Node.cpp
    Qt Code:
    1. void Node::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *)
    2. {
    3.  
    4. QRadialGradient gradient(-3, -3, 10);
    5. if (option->state & QStyle::State_Sunken) {
    6. gradient.setCenter(4, 4);
    7. gradient.setFocalPoint(4, 4);
    8. gradient.setColorAt(0, Qt::darkBlue);
    9. } else {
    10. gradient.setColorAt(0, Qt::darkBlue);
    11. }
    12. painter->setBrush(gradient);
    13. painter->setPen(QPen(Qt::darkBlue, 0));
    14. painter->drawEllipse(-10, -10, 20, 20);
    15. }
    To copy to clipboard, switch view to plain text mode 

    in MainWindow.cpp
    Qt Code:
    1. Node *node1 = new Node(this);
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jul 2010
    Posts
    71
    Thanked 8 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: event in the paint of the drawEllipse

    Where replies?

Similar Threads

  1. Immediate paint
    By zgulser in forum Qt Programming
    Replies: 11
    Last Post: 15th March 2010, 07:34
  2. something wront about QPainter::drawEllipse
    By cspp in forum Qt Programming
    Replies: 0
    Last Post: 25th November 2009, 05:36
  3. QGraphicsTextItem Paint()
    By goldhappywang in forum Qt Programming
    Replies: 5
    Last Post: 18th September 2009, 15:39
  4. paint
    By xyzt in forum Qt Programming
    Replies: 3
    Last Post: 22nd March 2008, 18:22
  5. QtCanvasPolygon does not paint
    By YuriyRusinov in forum Qt Programming
    Replies: 3
    Last Post: 10th August 2007, 17:56

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.