Results 1 to 5 of 5

Thread: QVBarModelMapper update chart on model change

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2016
    Posts
    3
    Qt products
    Qt5

    Default QVBarModelMapper update chart on model change

    Hi,

    I am using QVBarModelMapper to show a BarChart. I provided my own implementation of QAbstractTableModel.
    But the BarChart does not update, when the data in the TableModel changes and dataChanged() is emitted.
    What do I have to do to automatically update the BarChart, when the model changes?

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QVBarModelMapper update chart on model change

    Could be a bug in the mapper class.
    I assume you have verfied that the model works correctly? E.g. using a QTableView?

    Cheers,
    _

  3. #3
    Join Date
    Nov 2016
    Posts
    3
    Qt products
    Qt5

    Default Re: QVBarModelMapper update chart on model change

    Yes, i use a TableView to show the data, and it gets updated properly

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QVBarModelMapper update chart on model change

    Hmm, you probably need to debug this then.

    From the code it looks like the dataChanged signal is properly connected
    https://code.woboq.org/qt5/qtcharts/...tractItemModel

    Cheers,
    _

  5. #5
    Join Date
    Nov 2016
    Posts
    3
    Qt products
    Qt5

    Default Re: QVBarModelMapper update chart on model change

    It works now. I called emitted the dataChanged method on the wrong part of the data set. However, the table was updated correctly so I dont know why that worked.
    Thanks for your help!

Similar Threads

  1. Replies: 1
    Last Post: 21st June 2016, 23:32
  2. Replies: 4
    Last Post: 21st October 2013, 21:24
  3. Do I need update model in QT UI thread?
    By ysilent in forum Newbie
    Replies: 3
    Last Post: 23rd March 2012, 10:59
  4. how to update a tree view model
    By chow in forum Qt Programming
    Replies: 8
    Last Post: 26th March 2009, 15:27
  5. Error building chart model/view example
    By brcain in forum Qt Programming
    Replies: 5
    Last Post: 25th August 2006, 23:37

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.