Results 1 to 4 of 4

Thread: Redraw custom QGraphicsItem on QPushButton click

  1. #1
    Join Date
    Oct 2010
    Posts
    12
    Thanks
    6
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Redraw custom QGraphicsItem on QPushButton click

    I've got lots of widgets grouped in different layouts on my main widget. One of them is QGraphicsView displaying custom QGraphicsItem. Everything works fine, but I need some additional functionality and I want to repaint custom QGraphicsItem on QPushButton click.
    How can I do it?

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Redraw custom QGraphicsItem on QPushButton click

    Use signals and slots.

  3. #3
    Join Date
    Oct 2010
    Posts
    12
    Thanks
    6
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Redraw custom QGraphicsItem on QPushButton click

    And what should I connect?
    I am sure signal is QPushButton::clicked(). But what about slot?
    EDIT: QGraphicsView::updateScene()?

  4. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Redraw custom QGraphicsItem on QPushButton click

    No, you need to define your custom slot which changes the item you want. Qt can't know what you want.

  5. The following user says thank you to Lykurg for this useful post:

    qutron (1st March 2011)

Similar Threads

  1. QPushButton click
    By qutron in forum Newbie
    Replies: 2
    Last Post: 29th November 2010, 14:47
  2. Replies: 7
    Last Post: 26th August 2009, 07:21
  3. Replies: 4
    Last Post: 21st March 2009, 13:51
  4. QPushButton deleting itself on click
    By Cruz in forum Qt Programming
    Replies: 4
    Last Post: 23rd January 2009, 09:18
  5. QPushButton on Shift+Click?
    By vishal.chauhan in forum Qt Programming
    Replies: 3
    Last Post: 9th September 2008, 10:00

Tags for this Thread

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.