Results 1 to 11 of 11

Thread: Refresh problem with QPaintEvent

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #5
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 453 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Refresh problem with QPaintEvent

    Quote Originally Posted by wysota
    I don't know how NightCharts works but it seems to me you should keep instances of "Nightcharts" as members of your class and in the paint event simply call draw() on each of them passing the painter where they should be drawn. Also make sure that each time you modify any of the charts, you call update( ) on the widget.
    @wysota, It looks like the NightCharts is designed to be created every time inside the QPaintEvent, having it as class member will not work. (meaning it is not reusable, no means to reset or clear the data in pie, so no way to write new data, only way out is create a new instance)

    @rawfool
    The problem you see is due to a bug in NightCharts. A member variable double Nightcharts::palpha; is not initialized in the ctor, just initializing it to 0 in the ctor of Nightcharts will fix the problem (unless there are other problems). Good Luck, and also report the bug to the author.

    And reason the NightCharts is creatd every time in the QpaintEvent is creating this random behaviour, as each time the NightCharts object is created double Nightcharts::palpha; takes a random value and a undefined drawing of the pie chart happens
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  2. The following user says thank you to Santosh Reddy for this useful post:

    rawfool (23rd April 2013)

Similar Threads

  1. QComboBox refresh problem
    By waynew in forum Qt Programming
    Replies: 2
    Last Post: 19th April 2011, 12:30
  2. Replies: 2
    Last Post: 14th January 2011, 15:09
  3. QWidget Refresh Problem
    By MarkoSan in forum Qt Programming
    Replies: 2
    Last Post: 15th January 2008, 11:24
  4. QpaintEvent region problem with QPopupmenus
    By Qtkiller in forum Qt Programming
    Replies: 1
    Last Post: 21st September 2007, 09:18
  5. QTableView refresh problem
    By tebessum in forum Qt Programming
    Replies: 3
    Last Post: 29th December 2006, 11:22

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
  •  
Qt is a trademark of The Qt Company.