我在Windows XP上的Qt中创建了一个程序,现在我在Windows 7上移植了该代码,但是当我编译代码时,.qrc(资源文件)中的图片和图标都没有显示在程序中。这些图片位于头文件和.cpp文件所在的同一文件夹中。
由于
以下是代码:
void MainWindow::on_actionUmer_s_Program_triggered()
{
QMessageBox about;
about.setFont(QFont("Times",13,0,false));
about.setText("<h2>Umer's Program</h2>");
setWindowIcon(QIcon(":/pics/umerfariiq.jpg"));
about.setInformativeText("Copyright ; 2012 Umer Software Inc.\nI wrote this program for fun I am a student of System engineering at UET Peshawar.\nAll thanks to Almighty for giving me the capability to write it\n");
about.setStandardButtons(QMessageBox::Ok);
about.setIconPixmap(QPixmap(":/pics/umergokuup.jpg"));
about.setDefaultButton(QMessageBox::Ok);
about.show();
about.exec();
}
QMAKE
QT + =核心gui
TARGET =评论程序 TEMPLATE = app
SOURCES + = main.cpp \ mainwindow.cpp \ itemdialog.cpp \ commentdialog.cpp
HEADERS + = mainwindow.h \ itemdialog.h \ commentdialog.h
FORMS + = mainwindow.ui \ itemdialog.ui \ commentdialog.ui
资源+ = \ pics.qrc
这是.qrc文件的图片