开发者

QT: further "Plumbing" for Model->View->Delegate

开发者 https://www.devze.com 2023-02-19 05:10 出处:网络
I have a QListView, clearly showing, My model is full of data. My model’开发者_开发百科s ::rowCount() is called and returns a > 0 result. I connected my model to the QListView with “setModel”. I co

I have a QListView, clearly showing, My model is full of data. My model’开发者_开发百科s ::rowCount() is called and returns a > 0 result. I connected my model to the QListView with “setModel”. I connected the delegate to the QListView with “setItemDelegate”.

Yet the “Paint” method on my delegate isn’t called, not once. Not even after resizing the live QListView. Why?

Do I need further “hooking up” of events here? perhaps connecting some slots to signals? I thought the “setModel” and “setDelegate” will take care of that for me. Was I wrong?


I got it. I wasn’t signaling of a model update using the model’s “begin/end” method pairs. I was adding content to the model using my own methods so the model really could not notify the listView there’s content to view which of course resulted in no painting.

0

精彩评论

暂无评论...
验证码 换一张
取 消