PDA

View Full Version : QGraphicsView selection problem when there is large scale factor in view (Linux)



MadBear
3rd January 2011, 13:17
Greetings,
I would like to show QGraphicsScene. The scene bounding rectangle is (0,0,1,1). The problem is that then the selection of items on linux doesn't work correctly. On Windows there are no problems.
To better explain this I have created simple application with QGraphicsView of dimensions (500,500) in a simple QMainWindow:


MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
scena=new QGraphicsScene();
ui->graphicsView->setScene(scena);
ui->graphicsView->scale(500,500);
QGraphicsEllipseItem *it=new QGraphicsEllipseItem();
it->setRect(-0.1,-0.1,0.2,0.2);
it->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
scena->addItem(it);
}


Is there some bug in linux version of qt? I have qt 4.7.

Thank you,
MadBear

HelderC
14th January 2011, 03:42
I tried this code, and works fine:


QGraphicsScene *scena = new QGraphicsScene();
ui->graphicsView->setScene(scena);
ui->graphicsView->scale(500,500);
QGraphicsEllipseItem *it=new QGraphicsEllipseItem();
it->setRect(-0.1,-0.1,0.2,0.2);
it->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
scena->addItem(it);