QDockWidget - QGlWidget - invalid drawable when widget is dragged out from the dock

967 Views Asked by At

I have a QDockWidget object in my application, which contains a QWidget object inside it. When my application runs, everything seems fine. However when I moved the widget from the QDockWidget (dragged it out from the Dock widget), I suddenly got these 10 lines of warning message on my console:

2011-10-23 21:06:22.296 PerformanceVisualization[42898:903] invalid drawable
2011-10-23 21:06:22.298 PerformanceVisualization[42898:903] invalid drawable
2011-10-23 21:06:22.299 PerformanceVisualization[42898:903] invalid drawable
2011-10-23 21:06:22.300 PerformanceVisualization[42898:903] invalid drawable
2011-10-23 21:06:22.300 PerformanceVisualization[42898:903] invalid drawable
2011-10-23 21:06:22.301 PerformanceVisualization[42898:903] invalid drawable
2011-10-23 21:06:22.302 PerformanceVisualization[42898:903] invalid drawable
2011-10-23 21:06:22.303 PerformanceVisualization[42898:903] invalid drawable
2011-10-23 21:06:22.304 PerformanceVisualization[42898:903] invalid drawable
2011-10-23 21:06:22.304 PerformanceVisualization[42898:903] invalid drawable

My main function is as follow:

int main(int argc, char *argv[])
{
    srand(1);
    QApplication app(argc, argv);
    PerformanceModule *performanceModuleWidget = new PerformanceModule();// a QWidget object
    QMainWindow window;

    QDockWidget *performanceDockWidget = new QDockWidget(QObject::tr("Performance Visualization"), &window);
    performanceDockWidget->setWindowTitle("Performance Visualization Dock");
    performanceDockWidget->setAllowedAreas(Qt::LeftDockWidgetArea);
    performanceDockWidget->setWidget(performanceModuleWidget);

    //performanceDockWidget->show();

    window.addDockWidget(Qt::LeftDockWidgetArea, performanceDockWidget);
    //window.menuBar()->addAction(performanceDockWidget->toggleViewAction());
    //performanceDockWidget->hide(); // explicitly hidden
    window.show();

    return app.exec();
}

How can I solve this problem?.
I saw a similar question here : QGLWidget in QScrollArea says "invalid drawable", and based on that post, I tried to remove all the setFixedSize() function inside my widget and replace them with setMinimumSize() function, but that did not solve the problem. Any similar experience?. How did you solve it?

1

There are 1 best solutions below

0
On

Change your Dockwidget property as given below and try

 performanceDockWidget->setAllowedAreas(Qt::AllDockWidgetAreas)

If that doesn't work as well, change your Dockwidget property to resizable and then try.