#include <QtCore>
#include <QtGui>
int main(int argc, char *argv[])
{
scene.setSceneRect(0, 0, 800, 480);
QGraphicsProxyWidget *w = new QGraphicsProxyWidget;
w->widget()->setGeometry(0,0,100,100); //Makes the pushbutton 100x100
//Creates a polygon of 100x100
p->setPolygon(poly);
//Sets both polygon and proxy widget in the same position.
p->setPos(100,100);
w->setPos(100,100);
//This would look as if the proxy widget has a black border all around it but this does not work.
scene.addItem(w);
scene.addItem(p);
view.show();
return app.exec();
}
#include <QtCore>
#include <QtGui>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QGraphicsScene scene;
scene.setSceneRect(0, 0, 800, 480);
QGraphicsProxyWidget *w = new QGraphicsProxyWidget;
w->setWidget(new QPushButton("Test"));
w->widget()->setGeometry(0,0,100,100); //Makes the pushbutton 100x100
//Creates a polygon of 100x100
QPolygonF poly;
poly << QPointF(-50, -50) << QPointF(50, -50)
<< QPointF(50, 50) << QPointF(-50, 50)
<< QPointF(-50, -50);
QGraphicsPolygonItem *p = new QGraphicsPolygonItem;
p->setPolygon(poly);
//Sets both polygon and proxy widget in the same position.
p->setPos(100,100);
w->setPos(100,100);
//This would look as if the proxy widget has a black border all around it but this does not work.
scene.addItem(w);
scene.addItem(p);
QGraphicsView view(&scene);
view.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks