Results 1 to 6 of 6

Thread: Interview reload problem

  1. #1

    Default Interview reload problem

    Hello!

    I am using Interview with a QTreeView view and my own model. Some lines of the data the model works on change frequently without any user input.
    I told the data-object to emit a signal which is conneted to a function in the model. This function checks which lines have changed and emits the dataChanged signal.

    The signal is emitted without any problems but the view seems not to recognize this. I have to minimize and maximize the window so that the changes apply (I think this causes a reload of every line, doesn't it?).

    Adding new lines works fine. When I add a new line, the refresh described above also happens. (All the other lines are refreshed when i add one single new line)

    Thank you!

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Interview reload problem

    How do you change the data? do you use QAbstractItemModel::setData() for that? Either way, could we see the code?

  3. #3

    Default Re: Interview reload problem

    I just change the sourceData without emitting setData() function.
    If I understood the manual correctly, the only thing you have to do when data is changed is emitting dataChanged() for the area of the change. ( http://doc.trolltech.com/4.3/qabstra...l.html#setData ) "Note that the dataChanged() signal must be emitted explicitly when reimplementing this function."

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Interview reload problem

    Quote Originally Posted by tiptop View Post
    If I understood the manual correctly, the only thing you have to do when data is changed is emitting dataChanged() for the area of the change.
    Yes, that's correct. But if the data is changed by an outside source, you can do that through setData(). Either way could you show us the method you use for modifying the model?

  5. #5

    Default Re: Interview reload problem

    Well, there's nothing to show. I just use the assignment operator change the data. As I implemented my own Model, i cannot use the setData() of a base class because its implementation does nothing but returning false.
    It does afaik absolutely not change anything to use a setData function which does exactly the same as two other lines in my own function.
    I double checked whether the data is really set and whether the signal is really emitted - it is.
    The problem seems to be in the view.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Interview reload problem

    Quote Originally Posted by tiptop View Post
    I just use the assignment operator change the data.
    Hmm... what about the signal emition? Can we see the code?

    As I implemented my own Model, i cannot use the setData() of a base class because its implementation does nothing but returning false.
    I didn't say anything about the base class. I meant you should implement setData() for your model and use it to operate on it.

    The problem seems to be in the view.
    Unless you have subclassed the view and broken something there it should work. Otherwise the problem is within your model.

Similar Threads

  1. Replies: 16
    Last Post: 7th March 2006, 15:57

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.