Thank you very much.... I have tried the way u explained to me.....It is working absolutely fine.
Thank you once again....here is the piece of code for any needy
QDeclarativeComponent component
(engine,
QUrl::fromLocalFile("qml file"));
do{
myObject= component.create();
}while(!component.isReady());
scene.addItem(item);
scene.render(&painter);
pushButton
->setIconSize
(QSize(100,
100));
pushButton->setFlat(true);
pushButton->setIcon(icon);
pushButton->setToolTip(fileName);
QPushButton *pushButton = new QPushButton();
QDeclarativeComponent component(engine, QUrl::fromLocalFile("qml file"));
QObject *myObject;
do{
myObject= component.create();
}while(!component.isReady());
QGraphicsItem* item = qobject_cast<QGraphicsItem*>(myObject);
QGraphicsScene scene;
scene.addItem(item);
QPixmap pixmap(100,100);
QPainter painter(&pixmap);
scene.render(&painter);
QIcon icon(pixmap);
pushButton->setIconSize(QSize(100,100));
pushButton->setFlat(true);
pushButton->setIcon(icon);
pushButton->setToolTip(fileName);
To copy to clipboard, switch view to plain text mode
naag
Bookmarks