- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
当我浏览 Qt 的源代码时,我没有发现它实际上是如何绘制 GUI 组件的,但我知道它使用 OpenGL。
我想知道像 Qt 这样的 GUI 库如何绘制其 GUI 组件(例如:QPushButton、QWidget)?
任何人都可以帮助我提出一个基本想法吗?
最佳答案
在 Qt 项目站点中:
Qt is painting QtWidgets using QPainter, which uses (usually) the raster engine to draw the content. It is not using native OS calls, apart from few exceptions (file dialog, for example, which can be drawn either natively or using QtWidgets).
QtQuick is painted using scenegraph, so OpenGL. Also, no native OS calls here.
I think you either misunderstood (there are several meanings of the word “native” in computing) the stackoverflow post, or your information source is wrong.
OK, then to be clear: by “native” I’ve meant using native OS controlls, like wxWidgets library does: asking the OS to draw native scroll bar, or combo box, etc. Qt does not do this. It paints all the widgets itself, and only tries to mimick the looks of the OS it is running on.
But obviously, some kind of native OS calling is happening deep inside, in order to actually draw some pixels on the screen, and open native window container. But that is usually not important at all to high level UI developers.
You have a clear choice whether the widget should be drawn by the CPU or the GPU: widgets can use different painting methods (native, raster, OpenGL, for more see here! [qt-project.org]), and the user has choice which one should be utilised. Most people do not use that, though, because the default settings work well.
谢谢。
关于c++ - Qt 如何绘制它的 GUI 组件(基本思路)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24584189/
我有以下场景:有 1 个包含书籍的表和两对包含销售订单和采购订单交易的表 (HD/IT),这些交易通过销售订单 ID 连接。表结构如下: CREATE TABLE `books` ( `id` i
我是一名优秀的程序员,十分优秀!