Details
-
Bug
-
Resolution: Out of scope
-
P2: Important
-
4.6.2
-
None
Description
If you add tabs after the show event QGraphicsScene::isActive() is wrong.
If you call bugReport.addTabs() before bugReport.show() it works as expected.
main.h
#include <QtGui> class BugReport : public QWidget { Q_OBJECT public: BugReport(QWidget *parent); void addTabs(); private: QTabWidget *m_pTabWidget; QGraphicsScene *m_pGraphicsScene; private slots: void checkActive(); };
main.cpp
#include "main.h" BugReport::BugReport(QWidget *parent) : QWidget(parent) { QBoxLayout *pLayout = new QVBoxLayout; QPushButton *pButton = new QPushButton(tr("Check Active!")); connect(pButton, SIGNAL(clicked(bool)), SLOT(checkActive())); pLayout->addWidget(pButton); m_pTabWidget = new QTabWidget; pLayout->addWidget(m_pTabWidget); m_pGraphicsScene = new QGraphicsScene(); setLayout(pLayout); } void BugReport::addTabs() { m_pTabWidget->addTab(new QWidget(), "dummy"); m_pTabWidget->addTab(new QGraphicsView(m_pGraphicsScene), "view"); } void BugReport::checkActive() { QMessageBox::information(this, tr("QGraphicsScene::isActive()"), tr("QGraphicsScene::isActive() = %1").arg(m_pGraphicsScene->isActive())); } int main(int argc, char *argv[]) { QApplication app(argc, argv); BugReport bugReport(0); bugReport.show(); bugReport.addTabs(); return app.exec(); }