Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. (several qdockWidget) QWidget::repaint: Recursive repaint detected kernel\qwidget.cpp: 5557
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved Solved General and Desktop
11 Posts 3 Posters 2.2k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • halimaH Offline
    halimaH Offline
    halima
    wrote on last edited by halima
    #1

    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

    raven-worxR 1 Reply Last reply
    0
    • halimaH halima

      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

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by raven-worx
      #2

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

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      halimaH 1 Reply Last reply
      2
      • raven-worxR raven-worx

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

        halimaH Offline
        halimaH Offline
        halima
        wrote on last edited by
        #3

        @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()

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi and welcome to devnet,

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

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          halimaH 1 Reply Last reply
          2
          • SGaistS SGaist

            Hi and welcome to devnet,

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

            halimaH Offline
            halimaH Offline
            halima
            wrote on last edited by halima
            #5

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

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              What kind of 3D view is it ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • halimaH Offline
                halimaH Offline
                halima
                wrote on last edited by
                #7

                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 !!

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

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

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  halimaH 1 Reply Last reply
                  0
                  • SGaistS SGaist

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

                    halimaH Offline
                    halimaH Offline
                    halima
                    wrote on last edited by halima
                    #9

                    @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;
                    
                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      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.

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      halimaH 1 Reply Last reply
                      0
                      • SGaistS SGaist

                        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.

                        halimaH Offline
                        halimaH Offline
                        halima
                        wrote on last edited by
                        #11

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

                        1 Reply Last reply
                        1

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved