[Qt-interest] Setting scene and item focus
Cole, Derek
dcole at integrity-apps.com
Mon Apr 25 17:43:22 CEST 2011
Hello,
I have a scene that I have added to a graphics view, like so:
ui->graphicsView->setScene(&scene);
scene.setFocus(Qt::OtherFocusreason);
This is in the constructor of my main form.
I have some functions that will create QGraphicsItems and add them to the scene with scene.addItem(newItem);
in the constructors of my custom QGraphicsItems I am calling this->setFlag(QGraphicsItem::ItemIsFocusable);
However, when I call these two methods, neither returns true:
if(ui->graphicsView->scene()->hasFocus())
qDebug("Scene has focus");
if(ui->graphicsView->scene()->focusItem())
qDebug("Some Item has focus");
What am I doing wrong?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110425/8bdbed86/attachment.html
More information about the Qt-interest-old
mailing list