(several qdockWidget) QWidget::repaint: Recursive repaint detected kernel\qwidget.cpp: 5557



  • I need your help please!

    I have 8 dockwidget in my Qmainwindow without a centralwidget, when I try to move, float, and undock dockwidget that contains a 3D view, the program crash with segmentation fault!

    I remain at your disposal for more information, thanks a lot!

    SUB_WIN_3D_VIEW.cpp  
    /* -----------------------
     * ----------------------- */
    
    #include "sub_win_3dview.h"
    #include <QtWidgets/QAction>
    #include <iostream>
    #include <QDesktopServices>
    
    SUB_WIN_3D_VIEW::SUB_WIN_3D_VIEW(Mainwindow const& p) : QDockWidget(),mainwindow_ins(p)
    {
        ui.setupUi(this);
        this->setWindowTitle("3D view");
        // Initiate the 3D scene
        view.defaultFrameGraph()->setClearColor(QColor("#FFC0CBD9")); // light blue
        widget = QWidget::createWindowContainer(&view);
        view.renderSettings()->pickingSettings()->setPickMethod(Qt3DRender::QPickingSettings::TrianglePicking);  
        // Initiate the root entity (all the other entities of the scene should
        // inherit it to be part of the 3D scene
        rootEntity = new Qt3DCore::QEntity;
        input = new Qt3DInput::QInputAspect;
        view.setRootEntity(rootEntity);
        view.registerAspect(input);
    
        // Get the default camera entity from view
        cameraEntity = view.camera();
        // Set Z the be the vertical axis
        cameraEntity->setUpVector(QVector3D(0, 0, 1));
        // Initiate the camera controller
        MyOrbitCameraController *camController = new MyOrbitCameraController(rootEntity);
        camController->setCamera(cameraEntity);
        camController->setLookSpeed(-300);
        camController->setLinearSpeed(12);
    
        // Initiate the light entity with its components below
        lightEntity = new Qt3DCore::QEntity(rootEntity);
    
        Qt3DRender::QPointLight *lightPoint = new Qt3DRender::QPointLight(lightEntity);
        lightPoint->setColor("white");
        lightPoint->setIntensity(1);
    
        Qt3DCore::QTransform *lightTransform = new Qt3DCore::QTransform(lightEntity);
        lightTransform->setTranslation(QVector3D(20, 20, 20));
    
        lightEntity->addComponent(lightPoint);
        lightEntity->addComponent(lightTransform);
    
        // Initiate the modifier of the scene
        modifier = new SceneModifier(rootEntity, cameraEntity);
        modifier->pb_sl_reset();
    
        view3d->widget->setMinimumSize(QSize(200, 100));
        QSizePolicy view3d_siz(QSizePolicy::Expanding, QSizePolicy::Expanding);
        widget->setSizePolicy(view3d_siz);
    
        // Add the widget to a layout attached to the UI
        ui.verticalLayout_2->addWidget(widget);
        modifier->pb_sl_loadModel("simple");
        connect(ui.Reload, SIGNAL(clicked(bool)),this, SLOT(reload_clicked()));
        connect(ui.btn_CubeMiddle, SIGNAL(clicked(bool)),this, SLOT(cubeMiddle_clicked()));
        connect(ui.btn_ObjUp, SIGNAL(clicked(bool)),this, SLOT(objUp_clicked()));
        connect(ui.btn_ObjLeft, SIGNAL(clicked(bool)),this, SLOT(objLeft_clicked()));
        connect(ui.btn_ObjRight, SIGNAL(clicked(bool)),this, SLOT(objRight_clicked()));
        connect(ui.btn_ShowAxis, SIGNAL(clicked(bool)),this, SLOT(showAxis_clicked()));}
    SUB_WIN_3D_VIEW::~SUB_WIN_3D_VIEW()
    {
    
    }
    
    
    void SUB_WIN_3D_VIEW::reload_clicked()
    {
        // Reload's button simply load the same model again
        modifier->pb_sl_loadModel("simple");
    }
    
    void SUB_WIN_3D_VIEW::cubeMiddle_clicked()
    {
        modifier->pb_sl_cameraMiddle();
    }
    
    void SUB_WIN_3D_VIEW::objUp_clicked()
    {
        modifier->pb_sl_cameraUp();
    }
    
    void SUB_WIN_3D_VIEW::objLeft_clicked()
    {
        modifier->pb_sl_cameraLeft();
    }
    
    void SUB_WIN_3D_VIEW::objRight_clicked()
    {
        modifier->pb_sl_cameraRight();
    }
    
    void SUB_WIN_3D_VIEW::showAxis_clicked()
    {
        modifier->pb_sl_enableRef(ui.btn_ShowAxis->isChecked());
    }
    
    
    
    #include "moc_sub_win_3dview.cpp"
    
    

    Errors:

    In file ....\include/QtCore/../../src/corelib/global/qglobal.h, line 770: Out of memory
    Invalid parameter passed to C runtime function.
    Invalid parameter passed to C runtime function.
    QWidget::repaint: Recursive repaint detected

    createDIB: CreateDIBSection failed.
    Invalid parameter passed to C runtime function.
    Invalid parameter passed to C runtime function.
    QWaitCondition: Destroyed while threads are still waiting


  • Moderators

    @halima
    what are the contents of the qdockwidgets? Custom widgets?
    It seems you are calling repaint() (directly or indirectly) inside a paintEvent()?



  • @raven-worx in my dockwidgets i have a 3D view primarily, qml for custom widget , and o lot of other widgets.
    i don't use the paintEvent()


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Can you determine exactly which of these docks triggers the crash ?
    What content does it have ?



  • @SGaist Hi SGaist thank you for reply.
    the dockwidget containing a 3D view . Because when i disable it i don't have this problem .


  • Lifetime Qt Champion

    What kind of 3D view is it ?



  • I solved the problem by modifying the qml code, before it was like that :

    file.h
     QQuickWidget *m_quickWidget_gauge_2;
        QObject *object_gauge_2 ;
        QQuickWidget *m_quickWidget_gauge_3;
        QObject *object_gauge_3 ;
        QQuickWidget *m_quickWidget_gauge_4;
        QObject *object_gauge_4 ;
    
    file.cpp
    //QQuickWidget : actuator number 1
        m_quickWidget_gauge_1 = new QQuickWidget(this) ;
        m_quickWidget_gauge_1->setSource(QUrl("qrc:/Resources/res/gauge.qml"));
        m_quickWidget_gauge_1->setResizeMode(QQuickWidget::SizeRootObjectToView);
        m_quickWidget_gauge_1->setMinimumHeight(30);
        m_quickWidget_gauge_1->setMinimumWidth(150);
        m_quickWidget_gauge_1->setAttribute(Qt::WA_AlwaysStackOnTop);
        m_quickWidget_gauge_1->setClearColor(Qt::transparent);
        ui.horizontalLayout_al_1->addWidget(m_quickWidget_gauge_1, 1, Qt::AlignTop);
        //QQuickWidget : actuator number 2
        m_quickWidget_gauge_2 = new QQuickWidget(this) ;
        m_quickWidget_gauge_2->setSource(QUrl("qrc:/Resources/res/gauge.qml"));
        m_quickWidget_gauge_2->setResizeMode(QQuickWidget::SizeRootObjectToView);
        m_quickWidget_gauge_2->setMinimumHeight(30);
        m_quickWidget_gauge_2->setMinimumWidth(150);
        m_quickWidget_gauge_2->setAttribute(Qt::WA_AlwaysStackOnTop);
        m_quickWidget_gauge_2->setClearColor(Qt::transparent);
        ui.horizontalLayout_al_2->addWidget(m_quickWidget_gauge_2, 1, Qt::AlignTop);
        //QQuickWidget : actuator number 3
    [....]
    

    I made these changes and it works!!

    file.h 
     QQuickView *m_qmlview_gauge_1;
     QQuickView *m_qmlview_gauge_2;
     QQuickView *m_qmlview_gauge_3;
    
    file.cpp
      m_qmlview_gauge_1 = new QQuickView(QUrl("qrc:/Resources/res/qml/actuator_gauge.qml"));
        m_qmlview_gauge_1->setColor(QColor(Qt::white));
        QWidget *container = QWidget::createWindowContainer(m_qmlview_gauge_1);
        container->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Expanding);
        ui.verticalLayout_11->addWidget(container);
    
        m_qmlview_gauge_2 = new QQuickView(QUrl("qrc:/Resources/res/qml/actuator_gauge.qml"));
        m_qmlview_gauge_2->setColor(QColor(Qt::white));
        QWidget *container_1 = QWidget::createWindowContainer(m_qmlview_gauge_2);
        container_1->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Expanding);
        ui.verticalLayout_12->addWidget(container_1);
    
        m_qmlview_gauge_3 = new QQuickView(QUrl("qrc:/Resources/res/qml/actuator_gauge.qml"));
        m_qmlview_gauge_3->setColor(QColor(Qt::white));
        QWidget *container_2 = QWidget::createWindowContainer(m_qmlview_gauge_3);
        container_2->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Expanding);
        ui.verticalLayout_13->addWidget(container_2);
    

    i still not understand why the old code cause this crash, it worked well before !!


  • Lifetime Qt Champion

    Did you change something in between ? Qt version ? Windows version ? Video driver version ?



  • @SGaist I updated the graphic driver.
    Please can you tell me if there is nothing wrrong in my code because sometimes the problem is reproduced :(
    should i delete this variables in the destructor?

    QQuickView *m_qmlview_gauge_1;
    QQuickView *m_qmlview_gauge_2;
    QQuickView *m_qmlview_gauge_3;
    

  • Lifetime Qt Champion

    Then you should consider downgrading the video driver.

    AFAIK, you don't need to delete them as the container takes ownership of the window you pass to it. See QWidget::createWindowContainer.



  • @SGaist
    it's the graphics driver that did that. Thank you.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.