设计应用程序与Qt [英] Design Application with Qt

查看:188
本文介绍了设计应用程序与Qt的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须实现一个图形用户界面设计。选择的框架是Qt。

I have to implement a graphical user interface design. The framework of choice is Qt.

在执行一些工作后,一些困难和问题出现了。主要的是,有一些花式设计元素与渐变,一种3D效果,阴影等。

After some work on the implementation a few difficulties and questions turned out. The main point is that there are some fancy design elements with gradients, kind of 3D effects, shadows and so on.

目前使用的方法 - 我真的不非常喜欢的是使用图形设计的位图作为各种小部件的背景。根据元素的布局和可伸缩性,这具有一些非常讨厌的缺点。这种方法产生一个相当静态的用户界面,很难维护和适应。

The currently used approach - which I really don't like very much - is to use the bitmaps from the graphic design as Backgrounds of various widgets. This has some very nasty drawbacks according to the placement of the elements and to scalability. This approach generates a fairly static user interface, that is difficult to maintain and adapt.

我希望它能够在运行时动态生成所有的图形元素,使用尽可能多的默认工具从Qt尽可能。但我只是不知道如何实现这样复杂的视觉效果。作为示例,您可以假设以下图像。

I would appreciate it to generate all the graphical elements dynamically at runtime using as many default tools from Qt as possible. But I just don't know how to implements such complex visual effects. As an example you can assume the following image.

问题:
合理的方法如何获得类似下面的结果。 (我不想要精确的解决方案,只是一些指针,一般方法和最佳做法。)

Question: How would an reasonable approach look like to get results like that below. (I don't want exact solutions, just some pointers, general approaches and best practices.)

推荐答案

关闭使用自定义小部件和在paint事件中构建效果。这里有一个示例:显示自定义LED小部件。这里还有一些关于自定义绘画的幻灯片,以及在paint命令的小部件中使用SVG图片: http://saim.pub.ro /ITNQ/L5_Slides_v01.pdf 。在paint命令中使用SVG使它更容易,而不是使用固定的BMP图形文件,因为你可以使用布局引擎。

You'd be best off using custom widgets and building the effect in the paint event. There's an example here: showing a custom LED widget. There's also some slides here about custom painting and using SVG images within the paint command for widgets: http://saim.pub.ro/ITNQ/L5_Slides_v01.pdf. Using SVGs within the paint command makes it a bit easier instead of using fixed BMP graphics files, as you can use the layout engine then.

这篇关于设计应用程序与Qt的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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