QListView , how to resize to the best fit size?
i implemented a new class which inherits QL开发者_运维百科istView , and now i want to modify sizeHint() to calculate the best width for my new listviewer.
First thought is to hook up the insert of model , retrieve max length , but how to ? Or is there any better suggestions ?
Many thanks.
Views should resize based on space allocated by parent layouts and available screen space. After they are sized they should trim/clip text from the model , this way you can easily switch models and use the same view on any screen. If you size the view based on data from the model , there is no guarantee that the view will fit in the available screen space.
精彩评论