如何在QMessageBox中显示图标?

我有一个关于盒子,我正试图在里面显示一个图标。 这是我的代码:
QMessageBox about_box(this);

about_box.setText("...");
about_box.setIconPixmap(QPixmap("qrc:/images/logo.png"));
about_box.setParent(this);

about_box.exec();
这是我的资源文件:
<RCC>
    <qresource prefix="/images">
        <file>logo.png</file>
    </qresource>
</RCC>
    
已邀请:
你不需要
qrc
前缀:
about_box.setIconPixmap(QPixmap(":/images/logo.png"));
    
你需要这个功能 编辑:我没有看到OP已经使用过这个。 你确定在编译时你正在运行qmake(以及rcc)吗?     

要回复问题请先登录注册