设置QuickLook插件的窗口大小 [英] Set windows size of QuickLook Plugin

查看:1010
本文介绍了设置QuickLook插件的窗口大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在建立一个QuickLook插件。我想改变当用户点击空格键时弹出的窗口的宽度。



我已经读过,在项目的info.plist文件中有两个键,其中height和width是可自定义的。即使我改变这些值,我无法获得预览窗口的大小到我想要的。



我不知道还有什么可以尝试。任何想法?



谢谢!

解决方案

一点点这个。我没有尝试以下任何建议,所以没有人能得到他们的希望。我假设你正在使用生成器回调:

  OSStatus(* GeneratePreviewForURL)(
void * thisInterface,
QLPreviewRequestRef preview,
CFURLRef url,
CFStringRef contentTypeUTI,
CFDictionaryRef options
);

在其他任何操作之前,您可以手动检查选项字典参数并验证 kQLPreviewPropertyWidthKey kQLPreviewPropertyHeightKey 键确实映射到所需的参考每个属性,Apple QuickLook编程指南:









$ b b


请注意,此属性是一个提示;快速查看可能会为某些类型的预览自动设置宽度
。该值必须为
封装在CFNumber对象中。


编辑:



运行<$ c $表示方式灵活,您可以尝试查找预览类型,其中QuickLook尊重您的大小提示, c> nm 在QuickLook框架二进制显示一些未记录的 kQLPreviewProperty - 常量以及上述宽度和高度键。引起了我的注意的是 kQLPreviewPropertyAutoSizeKey 。回想苹果关于忽略提示以自动设置大小的说法 ,这可能很重要?遵循 QuickLook.framework / Headers / QLBase.h 中的约定,您可以尝试声明

  extern const CFStringRef kQLPreviewPropertyAutoSizeKey;然后,您可以尝试在选项中将CFNumber 0与该属性键相关联。


$ b <
字典。还有其他未记录的注释键,例如 kQLPreviewPropertyAttributesKey



回到您提到的Info.plist,Apple 这些键 QLPreviewWidth QLPreviewHeight


数字给快速查看
预览的宽度(以磅为单位)的提示。 它使用这些值,如果生成器花费太长时间,
产生预览。
(已添加强调)


这是有人在你的生成器中调用sleep()的可怕建议。但我很难为为什么苹果会使下面的大小提示依赖于发电机延迟。 (?)



编辑:还要注意,上面的语句说Info.plist提示必须用点(不是像素) a href =http://graphicdesign.stackexchange.com/questions/199/point-vs-pixel-what-is-the-difference>单位,具体取决于用户的屏幕分辨率。


I'm building a QuickLook plugin. I want to change the width of the windows that pops up when user hits the spacebar.

I've read there are two keys in the info.plist file of the project where height and width are customisable. Even if I change those values I can't get the size of the preview windows to my desired one.

I don't know what else to try. Any idea?

Thanks!

解决方案

Thought I'd dig a little on this. I have not tried any of the following suggestions, so nobody get their hopes up. I'll assume you're using the generator callback:

OSStatus (*GeneratePreviewForURL)(
    void *thisInterface,
    QLPreviewRequestRef preview,
    CFURLRef url,
    CFStringRef contentTypeUTI,
    CFDictionaryRef options
);

Before anything else, you might manually check the options dictionary argument and verify that the kQLPreviewPropertyWidthKey and kQLPreviewPropertyHeightKey keys are indeed mapped to the desired CFNumber values.

Referring to each of these properties, the Apple QuickLook programming guide says:

Note that this property is a hint; Quick Look might set the width automatically for some types of previews. The value must be encapsulated in a CFNumber object.

(Edit: If your preview representation is flexible, you might try finding a preview type for which QuickLook honors your size hints, as per the statement above. Just a thought.)

Running nm on the QuickLook framework binary revealed some undocumented kQLPreviewProperty-- constants as well as the aforementioned width and height keys. One that caught my attention was kQLPreviewPropertyAutoSizeKey. Recalling Apple's statement about ignoring the hints to set the size automatically, this might be significant? Following the convention in QuickLook.framework/Headers/QLBase.h, you might try declaring

extern const CFStringRef kQLPreviewPropertyAutoSizeKey;

Then you could try associating a CFNumber 0 with that property key in the options dictionary. There are other undocumented keys of note, such as kQLPreviewPropertyAttributesKey.

Back to the Info.plist you mentioned, Apple says about those keys QLPreviewWidth and QLPreviewHeight:

This number gives Quick Look a hint for the width (in points) of previews. It uses these values if the generator takes too long to produce the preview. (emphasis added)

This is where someone makes the terrible suggestion of calling sleep() in your generator. But I'm perplexed as to why Apple would make following the size hints dependent on the generator latency. (?)

Edit: Also note the above statement says the Info.plist hints must be expressed in points (not pixels), a unit dependent on the user's screen resolution.

这篇关于设置QuickLook插件的窗口大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆