Results 1 to 2 of 2

Thread: Best Practices: QAbstractItemModel font metrics computations

  1. #1
    Join Date
    Jun 2008
    Location
    Boulder, Colorado, USA
    Posts
    70
    Thanks
    16
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Best Practices: QAbstractItemModel font metrics computations

    Question about Best Practices in relation to QAbstractItemModel font metrics-based computations:

    I was surprised to see that Item View MODEL implementations are supposed to generate presentation-oriented data, e.g. SizeHint (-Role) from the data() method. We also need to use font metrics to generate QPixmaps for the DisplayRole.

    I'm now registering a sample QWidget with one of our QAbstractItemModel implementations to make font and font metrics available to that implementation's geometry computations. This doesn't feel like the right direction.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Best Practices: QAbstractItemModel font metrics computations

    These presentation-oriented roles are for the default item delegate. You are free to implement your own delegate that controls all aspects of the presentation without accessing the model.

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.