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. QXcbConnection: XCB error: 8 (BadMatch),
Qt 6.11 is out! See what's new in the release blog

QXcbConnection: XCB error: 8 (BadMatch),

Scheduled Pinned Locked Moved Solved General and Desktop
18 Posts 2 Posters 18.7k Views 1 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi,

    Can you explain how you set a texture on your QLabel ?

    By the way, why not use QCamera and QCameraViewfinder since you are working with a camera?

    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
    • gfxxG Offline
      gfxxG Offline
      gfxx
      wrote on last edited by gfxx
      #3
      #include "mainwindow.h"
      #include "ui_mainwindow.h"
      
      #include "glwidg.h"
      #include <QThread>
      #include <QtConcurrent/QtConcurrent>
      #include <QtConcurrent/QtConcurrentRun>
      #include <QFuture>
      #include <QFutureWatcher>
      #include <QtWidgets>
      #include <QtWidgets/QAction>
      #include <QtWidgets/QWidget>
      #include <QtWidgets/QWidgetAction>
      #include <QtWidgetsDepends>
      #include <QtWidgetsVersion>
      #include <QTableWidget>
      #include <QTableWidgetItem>
      #include <QTableWidgetSelectionRange>
      #include <QTableView>
      #include <opencv/cv.h>
      #include <opencv/highgui.h>
      #include <iostream>
      #include <math.h>
      #include <stdio.h>
      #include <opencv2/opencv.hpp>
      #include <opencv2/imgproc/imgproc.hpp>
      #include <opencv2/highgui/highgui.hpp>
      #include <opencv2/core/core.hpp>
      #include <sstream>
      #include <string.h>
      #include <GL/glu.h>
      #include <GL/glut.h>
      #include <GL/freeglut.h>
      #include <QtOpenGL/QGLWidget>
      #include <QtOpenGL/QGLBuffer>
      #include <QtOpenGL/QtOpenGL>
      #include <QTime>
      #include <QTimer>
      #include <QDebug>
      
      
      QImage camera000;
      GLuint texture[1];
      QImage GL_formatt;
      QImage qform;
      QImage qform1;
      int cambio1 = 0;
      
      cv::Mat imma2;
      cv::Mat imma3;
      
      IplImage* frame0;
      
      
      int play = 0;
      
      
      
      
      glwidg::glwidg(QWidget *parent) :
          QGLWidget(parent)
      
      {
      
          this->setAttribute(Qt::WA_DeleteOnClose); //// SI INIZIALIZZ AIL BUFFER E LE DIMENSIONI DI CATTURA
      
          QGLWidget(QGLFormat(QGL::DirectRendering));
          setMaximumSize(480,360);//(352,288);
      
          initializeGL();
      
          paintGL();
      
      
      }
      
      
      
      
      
      
      void glwidg::resizeGL(int w, int h)
      {
      
          makeCurrent();
          glViewport(0, 0, w, h);
          glMatrixMode(GL_PROJECTION);
          glLoadIdentity();
          gluOrtho2D(0, w, 0, h); // set origin to bottom left corner
          glMatrixMode(GL_MODELVIEW);
          glLoadIdentity();
      
      }
      
      
      void glwidg::initializeGL()
      {
          makeCurrent();
          glClearDepth(2000.0);
          glDisable(GL_TEXTURE_2D);
          glDisable(GL_DEPTH_TEST);
          glDisable(GL_COLOR_MATERIAL);
          glEnable(GL_BLEND);
          glEnable(GL_POLYGON_SMOOTH);
          glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
          glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
          qglClearColor(Qt::white);
      
      }
      
      void glwidg::paintGL()
      {
          makeCurrent();
      
      
          glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
          qglColor(Qt::white);
      
      
          glutInitDisplayMode(GLUT_SINGLE | GLUT_RGBA);
          glMatrixMode(GL_MODELVIEW); /*+*/
          glEnable(GL_DEPTH_TEST);
      
          if (cambio1 == 0)
          {
              qform1.load("/home/kc1/Qt/KC-C/RIS/control2_106.png");
              qq1frame = qform1.scaled(this->size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
          }
          else
          {
              qq1frame = qform1.scaled(this->size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
          }
      
      
      
          qqframe = qq1frame.mirrored(false, true);
      
          if(!qqframe.isNull())
          {
              qqframe = qqframe.scaled(this->size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
             // glDrawPixels(qqframe.width(), qqframe.height(), GL_RGBA, GL_UNSIGNED_BYTE, qqframe.bits());
      
              // or do 2D texture mapping
              glMatrixMode(GL_MODELVIEW); /**/
              glEnable(GL_DEPTH_TEST);
              glMatrixMode(GL_PROJECTION);
              glLoadIdentity();
              gluOrtho2D(0,qqframe.width(),qqframe.height(),0);
              glMatrixMode(GL_MODELVIEW);
              //glDisable(GL_DEPTH_TEST);
              glLoadIdentity();
              glEnable(GL_TEXTURE_2D);
              glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
              glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
              glTexImage2D( GL_TEXTURE_2D, 0, 4, qqframe.width(), qqframe.height(), 0, GL_BGRA, GL_UNSIGNED_BYTE, qqframe.bits() );
              glBegin(GL_QUADS);
              glTexCoord2f(0,0); glVertex2f(0,qqframe.height());
              glTexCoord2f(0,1); glVertex2f(0,0);
              glTexCoord2f(1,1); glVertex2f(qqframe.width(),0);
              glTexCoord2f(1,0); glVertex2f(qqframe.width(),qqframe.height());
              glEnd();
              glDisable(GL_TEXTURE_2D);
              // .... end
      
             // qDebug() << ("ho disegnato??");
              glDisable(GL_DEPTH_TEST);
      
      
              glFlush();
      
           }
      
          if(qqframe.isNull())
          {
              glClear(GL_COLOR_BUFFER_BIT);
              qglColor(Qt::white);
          }
      
      }
      
      
      
      void glwidg::donextcam()
      {
      
          makeCurrent();
      
      }
      
      
      void glwidg::imma_orig_r1(QImage qi1)
      {
          cambio1 = 1;
          qform1 = qi1;
          glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
          updateGL();
      
      }
      
      void glwidg::stopcam1(bool st1)
      {
          if (st1)
          {
              cambio1 = 0;
              glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
              updateGL();
          }
          else
          {
              cambio1 = 1;
          }
      }
      

      Because Gstream nor recognize mi BA81 camera???

      Sorry but you suggsdest me that beckground of QT camera is Gstream ... And I reply you tha GStream is not supported by my system for BA81 so I must use the old method of include v4l.cpp file in my filegrabcamera.cpp and use camerabuffer for convert matrix in right rgb format ....

      By the way I not understand XBC error:8 and not find any info about it.
      Thanks for any suggst.

      Regards
      Giorgio

      bkt

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

        How am I supposed to relate this question to that other thread since you don't even mention it in the first place ?

        Also, your code doesn't use any QLabel and you seem to load your images from your hard drive so it gets a bit confusing to find the relation with your camera.

        So the question is: are you seeing this message since you added that custom QGLWidget ?

        There seems to also be OpenCV in the mix, are you using it to get images from the camera ?

        As for that XCB error 8, there's for example this bug that mentions it and that has been fixed since then.

        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
        1
        • gfxxG Offline
          gfxxG Offline
          gfxx
          wrote on last edited by gfxx
          #5

          the mechanism:

          1-qthread with opencv grab from camera...+ v4l.cpp integrted in it for right converting of image....(opencv meke some logical operation on image matrix)
          2-matrix2Qimage functon
          3-Qimage send to glwidg that use paint event to refresh QImage and convertitin the right dimension (i these way you can use opengl too and you can send multiple image if you wont...)
          4-in gui qlabel show qimqge or multiple tranformation from opengl if you want.....

          I show glwidg because opencv part use noting of qt part.... only matrix2qimage funcon...... glwidg use painter event ....other part of gui is right tested without glwidg....

          Thnks for your help

          Regards Giorgio

          bkt

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

            Do you mean that you show the image twice ? Once with a QLabel and once with your QGLWidget ?

            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
            • gfxxG Offline
              gfxxG Offline
              gfxx
              wrote on last edited by gfxx
              #7

              Real Real Sorry.... no QLabel exist..... GLwidg and opencv calculation is my old application vision system... now I rewamp it in my new interface ... to do that I have copy and paste .ui an .h .cpp file .... I see now that not exist QLabel that now is my custom widget GLwidg.....

              I must correct these:

              the mechanism:

              1-qthread with opencv grab from camera...+ v4l.cpp integrted in it for right converting of image....(opencv meke some logical operation on image matrix)
              2-matrix2Qimage functon
              3-Qimage send to glwidg that use paint event to refresh QImage and convertitin the right dimension (i these way you can use opengl too and you can send multiple image if you wont...) and show image in gui [stop here]
              /// not exist ///4-in gui qlabel show qimqge or multiple tranformation from opengl if you want...../

              Any how .....the error is still before the thread that creates the images begin to convey to glwidgt few frames .... I have a button to activate or not the Qthread with opencv capture .... The error occurs just start my application ... reading the link you gave me the error appears to be related to a window that does not open .... I put in /.../ all the code that launches messages or popup windows .... but XBC error remains .....

              Please can someone explain to me what does QXcb ??

              Regards
              Giorgio

              bkt

              1 Reply Last reply
              0
              • gfxxG Offline
                gfxxG Offline
                gfxx
                wrote on last edited by
                #8

                ok I understand how not works ..... my app is quite large and not can control all in any situation ....

                fortunately today I needed to launch a command from my interface .... I made a mistake and the machinery driven by the interface has returned an error to me properly .... just that the pop-up window notifying the error is not seen .. ... so I could verify that the notification window is broken somewhere ...but to some resources it is not available (it could be a font, an icon, an associated variable ... I do not know .... )

                mystery solved ... almost ... now I have to see what that is hidden to the system.

                regards
                Giorgio

                bkt

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

                  Check whether you have any path that might be relative in your code.

                  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
                  • gfxxG Offline
                    gfxxG Offline
                    gfxx
                    wrote on last edited by
                    #10

                    Strange these error .... Finally I found these ....

                    As I said the problem is a Qdialog ... these dialog is only a Waiting charge dialog with a circular progress bar .... first of insert my openCvWidget the code to start it was:

                    m_dia2 = new Dia2(this);
                                m_dia2->setAttribute(Qt::WA_DeleteOnClose, true);
                                m_dia2->setWindowFlags(Qt::Widget | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
                                m_dia2->setAttribute(Qt::WA_NoSystemBackground, true);
                                m_dia2->setAttribute(Qt::WA_TranslucentBackground, true);
                                m_dia2->AutoBmecdia2Value(AutoCount);
                                m_dia2->Stepbmecdia2Value(WaitingStep);
                                m_dia2->show();
                    

                    but now with "this" flag I Obtain QXcbConnection:XCB error 8 ......
                    for solve the error now the code is:

                    m_dia2 = new Dia2();
                                m_dia2->setAttribute(Qt::WA_DeleteOnClose, true);
                                m_dia2->setWindowFlags(Qt::Widget | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
                                m_dia2->setAttribute(Qt::WA_NoSystemBackground, true);
                                m_dia2->setAttribute(Qt::WA_TranslucentBackground, true);
                                m_dia2->AutoBmecdia2Value(AutoCount);
                                m_dia2->Stepbmecdia2Value(WaitingStep);
                                m_dia2->show();
                    

                    in these way the dialog can exist when myapp is close and not found other solution to close these dialog when my app close .... Why firt to add a new code I can use:

                    m_dia2 = new Dia2(this);
                    

                    and after only:

                    m_dia2 = new Dia2();
                    

                    ???

                    regards
                    Giorgio

                    bkt

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

                      From what widget are you calling this code ?

                      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
                      • gfxxG Offline
                        gfxxG Offline
                        gfxx
                        wrote on last edited by
                        #12

                        from void in MainWindow .....

                        regards
                        Giorgio

                        bkt

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

                          void is a type, do you mean in a slot from MainWindow ?

                          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
                          • gfxxG Offline
                            gfxxG Offline
                            gfxx
                            wrote on last edited by
                            #14

                            I call it in c++ style some time from mainwindow slot sometime from qthread with connect signal slot but nevertimre directly every time calling it inside a mainwindows slot....

                            regards
                            giorgio

                            bkt

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

                              How did you connect the signal from that QThread ?

                              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
                              • gfxxG Offline
                                gfxxG Offline
                                gfxx
                                wrote on last edited by
                                #16

                                i have a slot in mainwindow that start qhread ... inside that slot I have a list of:

                                connect(mythread, SIGNAL(mysignal1(Qimage)), this, SLOT(mainwindosslot(QImage)), Qt::DirectConnection);
                                

                                for example....

                                Ragards
                                Giorgio

                                bkt

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

                                  Why are you forcing a direct connection ?

                                  This means that the slot will be called in the context of the thread managed by QThread which is not the GUI thread thus you are doing GUI related stuff from another thread which is not allowed.

                                  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
                                  1
                                  • gfxxG Offline
                                    gfxxG Offline
                                    gfxx
                                    wrote on last edited by
                                    #18

                                    @SGaist ... you are in right .... tanks.

                                    regards
                                    miki

                                    bkt

                                    1 Reply Last reply
                                    0

                                    • Login

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