2

I have QLPreviewView and I need to check if the preview is loaded in n seconds after assigning QLPreviewItem. QLPreviewView and QLPreviewItem don't have any events for loading and any fields to check it, so I came with checking view hierarchy. It works pretty good with my few test cases, but ofc hierarchy can be changed in new versions of mac OS. Another solution could be working with field displayState. It's always nil when preview isn't loaded, but it can be nil when preview is loaded (for example for folder preview which doesn't have state). So even if we have displayState equal to nil, we still need to check if file can own any preview state at all, i.e. this solution depends on concrete mac OS version too.

Is there any tricks which are better then observing view hierarchy? Or may be is there any alternatives to QLPreviews?

  • What's a case where the file exists but doesn't load? – Morten J Dec 31 '18 at 16:03
  • @MortenJ I don't know such a case but some files need a long time to load. For example large text files. Some users can be confused by constantly spinning preloader. – Nikolai Galiullin Jan 03 '19 at 11:59
  • Any solution for that? There is a function canPreview() for QLPreviewController. But I can not access it in MacOS – davidev Mar 26 '20 at 10:33

0 Answers0