2011-10-23 55 views
0

我的應用程序中有一個QDockWidget對象,其中包含一個QWidget對象。當我的應用程序運行時,一切都很好。然而,當我從QDockWidget移動微件(從Dock小部件拖出來),我突然接到這10條線警告消息我的控制檯上:QDockWidget - QGlWidget - 從窗口中拖出小部件時無效的可繪製

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 

我的主要功能如下:

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(); 
} 

我該如何解決這個問題?
我在這裏看到了一個類似的問題:QGLWidget in QScrollArea says "invalid drawable",並基於該帖子,我試圖刪除我的小部件中的所有setFixedSize()函數,並將其替換爲setMinimumSize()函數,但這並沒有解決問題。任何類似的經歷?你是如何解決它的?

回答

0

變化如下,並嘗試

performanceDockWidget->setAllowedAreas(Qt::AllDockWidgetAreas) 

如果不工作,以及,你Dockwidget屬性更改爲調整大小,然後嘗試你Dockwidget財產。

相關問題