Design Application with Qt

 ̄綄美尐妖づ 提交于 2019-12-03 14:59:52

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 5 offers stylesheets to customize the look of your UI.

Specifically, if you want to stamp a texture onto buttons, have a look at this example. It shows how to use borders to specify areas that should not be stretched.

Another solution is using Qt Style Sheets which allows you to customize your widgets. Check the examples: Qt Style Sheets Examples | QtWidgets 5.3 | Documentation | Qt Project

Here's styles for QPushButton which looks "similar" like button on image. But it may be sufficent for your requiments.

background-color: qradialgradient(spread:pad, cx:0.499807, cy:0.489, radius:0.5, fx:0.499, fy:0.488909, stop:0.0795455 rgba(0, 147, 185, 255), stop:1 rgba(30, 30, 30, 255));
border: 5px solid black;
border-radius: 15px;
Mitch

For a detailed walkthrough of how to do something similiar to this in QML, see this answer. If you're familiar with QPainter, you could port it to widgets with C++.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!