Create a window in qt with shape from an image

c++, qt, user-interface

Solution

After a long search , myself found a good solution , check out this ..

#include <QtGui>
 class  myMainWindow:public QMainWindow
 {
 public:
     myMainWindow():QMainWindow()
     {
    setMask((new QPixmap("saturn.png"))->mask());


    QPalette* palette = new QPalette();
    palette->setBrush(QPalette::Background,QBrush(QPixmap("saturn.png")));
    setPalette(*palette);   

    setWindowFlags(Qt::FramelessWindowHint);     
    QWidget *centralWidget = new QWidget(this);
    QGridLayout *layout = new QGridLayout();

    centralWidget->setLayout(layout);

    QPushButton* button1 = new QPushButton("Button 1");
    button1->setFixedSize(80,50);

    layout->addWidget(button1,0,0); 

    setCentralWidget(centralWidget);

     };
     ~myMainWindow(){};
 };

int main(int argc, char **argv)
{
    QApplication app(argc, argv);
    myMainWindow *window = new myMainWindow();    

    window->resize(600, 316);          
    window->show();
    return app.exec();
}

Problem

Can some one explain me how to make a window in qt according to the shape of some object in an image , for example i have an image of a tree , using that i need to create a window in the shape of a tree ..

Original source