简体   繁体   English

Qt截图分享应用程序 - 如何选择屏幕区域

[英]Qt Screenshot sharing app - How to select the area of a screen

I am trying to code an app in Qt for capturing and then sharing the screenshots. 我正在尝试在Qt中编写应用程序以捕获然后共享屏幕截图。 For now my application captures the screenshot, shows a preview and saves it. 现在,我的应用程序捕获屏幕截图,显示预览并保存。 I am yet to do the upload part. 我还没有上传部分。 but before that I would like to be able to select the area of the screen of which the screenshot needs to be captured. 但在此之前,我希望能够选择需要捕获屏幕截图的屏幕区域。

I tried searching and I couldn't find any helpful articles or documents in Qt. 我尝试搜索,在Qt中找不到任何有用的文章或文件。 So can anyone help me? 所以有人可以帮助我吗?

PS: The idea is to create a similar app like lightshot and several other similar tools. PS:想法是创建一个类似的应用程序,如lightshot和其他几个类似的工具。

Thanks in advance 提前致谢

There are two methods that you can use for this: - 您可以使用两种方法: -

1) Capture an image of the screen and then display that, full screen to the user, essentially allowing the user to crop the image. 1)捕获屏幕图像,然后向用户显示全屏,基本上允许用户裁剪图像。

2) A more commonly used method is to create a full-screen, topmost window that has no title bar and is transparent. 2)一种更常用的方法是创建一个没有标题栏且透明的全屏最顶层窗口。 This allows the user to drag out an area, which you can draw an outline to represent the area the user requires. 这允许用户拖出一个区域,您可以绘制轮廓以表示用户需要的区域。

I recommend the 2nd method and creating a transparent window is simply a matter of changing the window flags, as you can see here . 我推荐的第二个方法,创造一个透明的窗口,是简单地改变窗口标志的问题,因为你可以看到在这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM