简体   繁体   English

Qt中的大尺寸图标文件会占用大量内存吗?

[英]Does large size icon file take up large memory in Qt?

I use it in the following way with a .qrc file. 我通过.qrc文件以以下方式使用它。

QAction* action = new QAction(QIcon(":/Resources/clear.png"), tr("&Clear"), this);

If clear.png is large like 128x128 pixels, does it take up large memory compared with small size file? 如果clear.png很大(如128x128像素),那么与小尺寸文件相比,它占用的内存大吗? Thanks. 谢谢。

You'd have to go through the Qt source code to figure it out exactly, but we can give a worst-case-scenario upper-bound pretty easily: an uncompressed 128x128 bitmap with 32-bit pixels would take up (128*128*4) bytes of RAM, or 64KB. 您必须遍历Qt源代码才能准确地找到它,但是我们可以很容易地给出最坏情况的上限:一个带有32位像素的未经压缩的128x128位图会占用(128 * 128 * 4)RAM字节,即64KB。 Add a bit more for overhead, and it's probably safe to say that the QIcon object created by the above code uses up less than 100KB of RAM. 再增加一些开销,可以肯定地说,上述代码创建的QIcon对象使用的RAM不足100KB。 Whether that's "large" or not depends on your personal definition of "large". 是否为“大”取决于您对“大”的个人定义。 :) :)

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

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