前言:今天发现QT中加载到资源文件中的文件使用路径加载时,不需要后缀名仍然可以加载成功。上代码

#include "widget.h"
#include "ui_widget.h"
Widget::Widget(QWidget *parent) :
QWidget(parent),
ui(new Ui::Widget)
{
ui->setupUi(this);
ui->label->setPixmap(QPixmap(":/pic/open"));
}
Widget::~Widget()
{
delete ui;
}
运行效果

可以看出仍然可以加载成功。

被折叠的 条评论
为什么被折叠?



