Details
-
Bug
-
Resolution: Out of scope
-
P3: Somewhat important
-
4.7.3
-
Qt: Qt SDK 1.1.1, Qt Creator 2.2.0
OS: Microsoft Windows 7 Professional 32bit
CPU: Intel Core2Duo CPU
Description
Any QGraphicsTextItems in those tabs which are not the first tab of QTabWidget, cannot get focus although the tab is current tab of QTabWidget.
But the QGraphicsTextItem in the first tab of QTabWidget can get focus. i.e. a focus frame (dotted box) appears around the QGraphicsTextItem.
Those QGraphicsTextItems which cannot get focus can get focus only after the main window is minimized and then maximized. i.e. After that, a focus frame appears around it.
The minimal source code is below and attached:
#include <QtGui/QApplication>
#include <QTabWidget>
#include <QGraphicsView>
#include <QGraphicsScene>
#include <QGraphicsTextItem>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QTabWidget * t = new QTabWidget();
QGraphicsView * v1 = new QGraphicsView(t);
QGraphicsView * v2 = new QGraphicsView(t);
QGraphicsScene * s1 = new QGraphicsScene(v1);
QGraphicsScene * s2 = new QGraphicsScene(v2);
QGraphicsTextItem * i1;
QGraphicsTextItem * i2;
t->show();
v1->setScene(s1);
v2->setScene(s2);
t->addTab(v1, "view1");
t->setCurrentWidget(v1);
i1 = s1->addText("Text1");
i1->setFlags(QGraphicsItem::ItemIsFocusable);
i1->setTextInteractionFlags(Qt::TextEditorInteraction);
i1->setEnabled(true);
i1->setFocus();
t->addTab(v2, "view2");
t->setCurrentWidget(v2);
i2 = s2->addText("Text2");
i2->setFlags(QGraphicsItem::ItemIsFocusable);
i2->setTextInteractionFlags(Qt::TextEditorInteraction);
i2->setEnabled(true);
i2->setFocus();
return a.exec();
}
This problem happens also in Qt 4.7.0.