Results 1 to 3 of 3

Thread: QtCharts delayed legend repaint

  1. #1
    Join Date
    Jul 2018
    Posts
    9
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default QtCharts delayed legend repaint

    I'm trying to move the line legend to a new location and then use the grab() routine to save an image to disk. My saved image has the legend in the previous location because of a delay in rendering. Calling processEvents() is not helping me in this case. Any advice?

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,163
    Thanks
    296
    Thanked 856 Times in 843 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QtCharts delayed legend repaint

    Maybe try using a single-shot QTimer to delay the grab? My understanding (possibly incorrect) is that QTimer will fire only after the event queue is empty. Alternatively, try using QWidget::render() instead of grab(). I think grab() makes a copy of the on-screen pixels, whereas render() actually redraws the widget into the image.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    Jul 2018
    Posts
    9
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QtCharts delayed legend repaint

    Quote Originally Posted by d_stranz View Post
    Maybe try using a single-shot QTimer to delay the grab? My understanding (possibly incorrect) is that QTimer will fire only after the event queue is empty. Alternatively, try using QWidget::render() instead of grab(). I think grab() makes a copy of the on-screen pixels, whereas render() actually redraws the widget into the image.
    Unfortunately, the QWidget::render() did not fix the problem. Same issue. The single-shot QTimer I feel would fix my problem in most cases. However, if the user is setting a large dataset I'm not guaranteed the timer has enough milliseconds on it to account for that. Any other ideas? Thanks for the suggestions by the way, I had not tried those.

Similar Threads

  1. QTCharts not found after installing them
    By calin2110 in forum Qt Tools
    Replies: 5
    Last Post: 14th May 2021, 17:56
  2. QtCharts doesnt show lineseries
    By Flavio Mesquita in forum Qt Programming
    Replies: 1
    Last Post: 12th June 2018, 21:46
  3. Multiple colors QLineSeries in QtCharts
    By cmartinezdemorentin in forum Qt Programming
    Replies: 2
    Last Post: 23rd March 2017, 17:04
  4. qwt vs qtcharts
    By hassinoss in forum Qwt
    Replies: 1
    Last Post: 13th January 2017, 07:50
  5. Replies: 4
    Last Post: 17th October 2010, 23:30

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.