QDockWidget - QGlWidget - 当小部件从停靠栏拖出时无效可绘制
我的应用程序中有一个 QDockWidget 对象,其中包含一个 QWidget 对象。当我的应用程序运行时,一切看起来都很好。然而,当我从 QDockWidget 中移动该小部件(将其从 Dock 小部件中拖出)时,我突然在控制台上收到这 10 行警告消息:
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();
}
我该如何解决这个问题?。
我在这里看到了类似的问题:QScrollArea 中的 QGLWidget 说“无效的可绘制”,并且根据该帖子,我尝试删除我的小部件中的所有 setFixedSize()
函数,并将其替换为 setMinimumSize()
函数,但是但这并没有解决问题。有类似经历吗?你是怎么解决的?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如下所示更改您的 Dockwidget 属性并尝试
如果这不起作用,请将您的 Dockwidget 属性更改为可调整大小,然后尝试。
Change your Dockwidget property as given below and try
If that doesn't work as well, change your Dockwidget property to resizable and then try.