here is my code
ICON.qrc
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file>images/accept.png</file>
</qresource>
</RCC>
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file>images/accept.png</file>
</qresource>
</RCC>
To copy to clipboard, switch view to plain text mode
main.cpp
#include <QApplication>
#include<QIcon>
#include<QPushButton>
#include<QAction>
int main( int argc, char** argv )
{
QIcon w
("/images/accept.png");
a.addAction(b);
a.show();
return app.exec();
}
#include <QApplication>
#include<QIcon>
#include<QPushButton>
#include<QAction>
int main( int argc, char** argv )
{
QApplication app( argc, argv );
QIcon w("/images/accept.png");
QPushButton a;
QAction *b=new QAction(w,QString("Icon"),0);
a.addAction(b);
a.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
empty2.pro
SOURCES += \
main.cpp \
buttondialog.cpp
HEADERS += \
buttondialog.h
RESOURCES += \
ICON.qrc
SOURCES += \
main.cpp \
buttondialog.cpp
HEADERS += \
buttondialog.h
RESOURCES += \
ICON.qrc
To copy to clipboard, switch view to plain text mode
When I build the project,Qt Creator shows†[release/qrc_ICON.cpp] Error 1:File not foundâ€.
I don’t know why.
Bookmarks