#include "mainwindow.h"#include <QApplication>#include <QHBoxLayout>#include <QVBoxLayout>#include <QPushButton>#include <QLabel>#include <QPixmap>int main( int argc, char **argv ){ QApplication a(argc,argv); QWidget w; QHBoxLayout *hl=new QHBoxLayout; QLabel *label=new QLabel; QPixmap pixmap(":/new/prefix1/puke"); pixmap.copy(pixmap.rect().x(),pixmap.rect().y(),80,80); hl->addWidget(label); label->setPixmap(pixmap); w.setLayout(hl); w.show(); return a.exec();}
//网上查了下是用copy函数 可是这样运行后 还是显示的整张图片啊 该怎么写?