I'am playing with QGraphics and I encounter a problem with the following code.
It is simply a red circle in a scene. Its dimension can be scaled with the "factor" variable.
The view is scaled in order the circle has always the same size on the screen.
When factor is 10 I can click the circle, but when factor is 1 It is as the shape was the boundingRect.
I don't understand this behavior, is there is limit in item size ?
Thanks a lot,
float dim = 5e-3;
float scale = 20000;
float factor = 1.;
int main(int argc, char *argv)
QApplication app(argc, argv);
dim = dim * factor;
scale = scale / factor;
QGraphicsView *view = new QGraphicsView; QGraphicsScene *scene = new QGraphicsScene; QRectF rect = QRectF(-dim, -dim, 2*dim, 2*dim); QGraphicsEllipseItem *item = new QGraphicsEllipseItem(rect, 0); item->setBrush(QBrush(Qt::red)); item->setFlag(QGraphicsItem::ItemIsSelectable, true); item->setFlag(QGraphicsItem::ItemIsMovable, true); scene->addItem(item); view->scale(scale, scale); view->setRenderHints(QPainter::Antialiasing); view->setScene(scene); view->show(); return app.exec();