#include <QtGui>// --------------------------------int main(int argc, char** argv){ QApplication app(argc, argv); QWidget wgt; QWidget* pwgt2 = new QWidget(&wgt); QPalette pal2; pal2.setBrush(pwgt2->backgroundRole(), QBrush(QPixmap("stone.jpg"))); pwgt2->setPalette(pal2); pwgt2->resize(100, 100); pwgt2->move(75, 75); pwgt2->setAutoFillBackground(true); wgt.resize(200, 200); wgt.show(); return app.exec();}
QPalette* pal2 = new QPalette(); pal2->setBrush(pwgt2->backgroundRole(), QBrush(QPixmap("stone.jpg")));
#include <QtGui/QApplication>#include <QtGui>int main(int argc, char** argv){ QApplication app(argc, argv); QPixmap pixmap; qDebug() << "By relative path. Is load: " << pixmap.load("myFile.jpg"); qDebug() << "By absolute path. Is load: " << pixmap.load("C:\\MyDir\\myFile.jpg"); return app.exec();}
QApplication::applicationDirPath ()