zoukankan      html  css  js  c++  java
  • 报错18:28:21: Debugging starts QLayout: Attempting to add QLayout ““ to MainWindow “MainWindow“, which

    18:28:21: Debugging starts
    QLayout: Attempting to add QLayout “” to MainWindow “MainWindow”, which already has a layout

    问题原因:
    If MainWindow is a QMainWindow and you build centralWidget in MainWindow just call setCentralWidget(centralWidget);

    You can’t set a layout on a QMainWindow because it already has one that makes all the work for dock widgets etc.

    QMainWindow 本身已经有一个layout了,不能再设置layout了。
    之所以报错,是因为在QMainWindow中某个成员函数中,使用了:

    QGridLayout *t_gridLayout_map = new QGridLayout(this);
    改进措施:
    QGridLayout *t_gridLayout_map = new QGridLayout();
    去掉this之后,OK!!!
    ————————————————
    版权声明:本文为CSDN博主「老王123456789」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
    原文链接:https://blog.csdn.net/weixin_43577616/article/details/115769477

  • 相关阅读:
    Hash表解题之大数据查找
    数据结构与算法之字典树解题
    oracle存储过程学习
    mq常见问题
    通过反射构造对象
    平衡二叉树
    LinkList源码
    ArrayList源码
    JVM参数调优
    MyBatis源码图
  • 原文地址:https://www.cnblogs.com/laowang001/p/14668354.html
Copyright © 2011-2022 走看看