Qt托盘图标拖放 [英] Qt Tray Icon Drag and Drop

查看:66
本文介绍了Qt托盘图标拖放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道是否可以使用Qt使用带有托盘图标的拖放操作?

Does anyone know if it is possible to use drag and drop with a tray icon using Qt?

推荐答案

我一直在做一些研究,这是我想出的:

I've been doing some research and here is what I have come up with:

QSystemTrayIcon无法显式处理拖放事件.但是,有一种基于Spifftastic托盘图标定位方法的解决方法.

A QSystemTrayIcon cannot explicitly handle a drag/drop event. However there is a workaround based on the Spifftastic tray icon location method.

  1. 您创建了一个唯一的彩色图标并将其放置为简短的图标并对其进行截图.
  2. 鉴于您知道颜色图标的顺序,您可以在屏幕截图中搜索并找到特定图标的位置.
  3. 放置了一个透明小部件在图标上,并用作放下目标.

我尚未详细介绍该手术的一些细节,但这就是要点.所有事物都认为这是一种骇人听闻的方法,但是鉴于没有其他方法可以做到这一点,我认为这是可以接受的.

I have yet to work at a few of the finer details of the operation but that is the gist of it. All things considered it is a hacky way of things but given that there are no other ways to do this I think it is acceptable.

蓬松的应用程序(用C#编写)使用Spifftastic方法找到任务栏图标.我假设有关透明窗口的部分是它们如何完成此工作的,但我尚未对其进行反编译和检查.

Fluffy App (written in C#) uses the Spifftastic method to locate the tray icon. I'm assuming the part about the transparent window is how they accomplish that but I have yet to decompile and examine their system.

这篇关于Qt托盘图标拖放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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