QLabel背景图片平铺 急该怎么解决

QLabel背景图片平铺 急急急
问题很奇怪啊!!高手请进

int main(int argc, char *argv[])
{
  QApplication a(argc, argv);
#if 0
  MyWidget w;  //自定义的类
  w.show();
#else
  QLabel *w = new QLabel;
  QPalette palette;
  palette.setBrush(w->backgroundRole(), QBrush(QPixmap("E:\\Qt\\Demo\\BaseUi\\images\\sec\\SkanBack_Min.png")));
  w->setPalette(palette);
  w->setFixedSize(200,109);
  w->show(); //可以正确平铺QLabel
#endif
  return a.exec();
}


但是如果用类MyWidget 封装一下就不行了
构造函数

Widget::Widget(QWidget *parent)
    : QWidget(parent)
{
  QLabel *w = new QLabel(this);
  QPalette palette;
  palette.setBrush(w->backgroundRole(), QBrush(QPixmap("E:\\Qt\\Demo\\BaseUi\\images\\sec\\SkanBack_Min.png")));
  w->setFixedSize(200,109);
  w->setPalette(palette);
  //w->show();
}
为什么封装到类中就不行了呢

------解决方案--------------------

label_ = new QLabel(this);

    QHBoxLayout *layout = new QHBoxLayout(this);
    layout->addWidget(label_);

    QPalette palette;
    palette.setBrush(QPalette::Background,
                     QPixmap("cat.jpg"));
    label_->setPalette(palette);
    label_->setAutoFillBackground(true);

    QPixmap A("cat.jpg");
    qDebug() << A.isNull();

    label_->setText("hahaha");

    setLayout(layout);


不知道是不是你要的效果