Qt::ItemIgnoresTransformations flag and selectable area
Hi,
if I set Qt::ItemIgnoresTransformations flag to true for a qgraphicsitem viewed in Qt 4.3.1, whenever the qgraphicsview's view matrix is changed, the selectable area of the item becomes proportionless to its pixels on the screen. (e.g. the user can not select the item from the area covering its pixels on the viewport, in zooming case, the selectable area becomes so small). Is this the expected behavior from setting Qt::ItemIgnoresTransformations flag to true in qgraphicsitem class?
Thanks
Re: Qt::ItemIgnoresTransformations flag and selectable area
Could you provide a minimal compilable example reproducing the problem?
Re: Qt::ItemIgnoresTransformations flag and selectable area
Code:
//////RectItem.h
#include <QGraphicsRectItem>
#include <QGraphicsSceneContextMenuEvent>
#include <QStyleOptionGraphicsItem>
#include <QPainter>
#include <QGraphicsScene>
#include <QWidget>
#include <QMenu>
{
public:
~RectItem();
};
/////////////its corresponding cpp file
#include "RectItem.h"
{
menu.addAction("Menu");
}
RectItem::~RectItem()
{}
QRectF RectItem
::boundingRect() const {
}
{
}
{
menu.exec(event->screenPos());
}
Now, the latter code resides in a class, which holds a qgraphicsview in its ui:
Code:
RectItem
* item
=new RectItem
(QRectF(0,
0,
50,
50));
scene->addItem(item);
item->setPos(0,0);
item->setZValue(1);
item->show();
ui.graphicsView->setScene(scene);
ui.
graphicsView->setSceneRect
(QRectF(-100,
-100,
200,
200));
ui.graphicsView->scale(0.2,0.2);
The context menu works only in a smaller space of the rectangle. The selectable area is not the rectangle seen on the screen.
Thanks in advance
Re: Qt::ItemIgnoresTransformations flag and selectable area
This indeed could be a bug. Did you check the task-tracker for similar entries?