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. Qt graphicsView error signal
Qt 6.11 is out! See what's new in the release blog

Qt graphicsView error signal

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 2.3k Views
  • 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.
  • Macive XiongM Offline
    Macive XiongM Offline
    Macive Xiong
    wrote on last edited by Macive Xiong
    #1

    Hi guys,

    I am trying to draw something on graphicsView, but there are some error signal shows up, it's like:

    qt error signal

    I use Arduino to run the process, the code is like:

    while(y <= 5){
    
           for (float x = voltx; x <= 4.96; x += 0.01){
           Serial.print("y = ");
           Serial.println(y*102.4);
           Serial.print("x = ");
           Serial.println(x*102.4);
           analogWrite(XPin, x * 51.49);
           delay(100);
    
           
           }
           
           y += 0.05;
           Serial.print("y = ");
           Serial.println(y*102.4);
           analogWrite(YPin, y * 51.49);
          
    
           for (float x = 4.95; x >= voltx - 0.01; x -= 0.01){
           Serial.print("y = ");
           Serial.println(y*102.4);
           Serial.print("x = ");
           Serial.println(x*102.4);
           analogWrite(XPin, x * 51.49);
           delay(100);
      
         }
    
           y += 0.05;
           Serial.print("y = ");
           Serial.println(y*102.4);
           analogWrite(YPin, y * 51.49);
          
    

    Input the voltage from 0 to 4.96 volt and transfer it to pixels, but the error signal occur in the region I didn't set for scanning. How is it happened?

    Qt code:

    void MainWindow::updateP(){
        if(!open) return;
    
        QTextStream stream(arduino);
        QString line;
        while(stream.readLineInto(&line)){
            QRegularExpression re("([x,y,p,a,b]) = ([0-9]{1,4})");
            QRegularExpressionMatchIterator i=re.globalMatch(line);
            while(i.hasNext()){
                QRegularExpressionMatch match=i.next();
                if(!match.hasMatch()){
                    qDebug() << "No match!";
                    continue;
                }
                QString xoryorporaorb=match.captured(1);
                QString matched=match.captured(2);
    
                bool ok=false;
                if(xoryorporaorb=="x") x=matched.toFloat(&ok);
                else if(xoryorporaorb=="y") y=matched.toFloat(&ok);
                else if(xoryorporaorb=="p") p=matched.toFloat(&ok);
                else if(xoryorporaorb=="a") a=matched.toFloat(&ok);
                else if(xoryorporaorb=="b") b=matched.toFloat(&ok);
                else continue;
                if(!ok){
                    qDebug() << "Could not convert \"" << matched <<"\" to an integer!";
                    continue;
                }
    
                QBrush whiteBrush(Qt::white);
                QPen whitePen(Qt::white, 1.);
                scene->addEllipse(a, b, 5, 5, whitePen, whiteBrush);
    

    Please give me some suggestion kindly, thanks!

    p.s Funny thing is, this error didn't happen if I use mega2560, it's about the processing time?

    jsulmJ 1 Reply Last reply
    0
    • Macive XiongM Macive Xiong

      Hi guys,

      I am trying to draw something on graphicsView, but there are some error signal shows up, it's like:

      qt error signal

      I use Arduino to run the process, the code is like:

      while(y <= 5){
      
             for (float x = voltx; x <= 4.96; x += 0.01){
             Serial.print("y = ");
             Serial.println(y*102.4);
             Serial.print("x = ");
             Serial.println(x*102.4);
             analogWrite(XPin, x * 51.49);
             delay(100);
      
             
             }
             
             y += 0.05;
             Serial.print("y = ");
             Serial.println(y*102.4);
             analogWrite(YPin, y * 51.49);
            
      
             for (float x = 4.95; x >= voltx - 0.01; x -= 0.01){
             Serial.print("y = ");
             Serial.println(y*102.4);
             Serial.print("x = ");
             Serial.println(x*102.4);
             analogWrite(XPin, x * 51.49);
             delay(100);
        
           }
      
             y += 0.05;
             Serial.print("y = ");
             Serial.println(y*102.4);
             analogWrite(YPin, y * 51.49);
            
      

      Input the voltage from 0 to 4.96 volt and transfer it to pixels, but the error signal occur in the region I didn't set for scanning. How is it happened?

      Qt code:

      void MainWindow::updateP(){
          if(!open) return;
      
          QTextStream stream(arduino);
          QString line;
          while(stream.readLineInto(&line)){
              QRegularExpression re("([x,y,p,a,b]) = ([0-9]{1,4})");
              QRegularExpressionMatchIterator i=re.globalMatch(line);
              while(i.hasNext()){
                  QRegularExpressionMatch match=i.next();
                  if(!match.hasMatch()){
                      qDebug() << "No match!";
                      continue;
                  }
                  QString xoryorporaorb=match.captured(1);
                  QString matched=match.captured(2);
      
                  bool ok=false;
                  if(xoryorporaorb=="x") x=matched.toFloat(&ok);
                  else if(xoryorporaorb=="y") y=matched.toFloat(&ok);
                  else if(xoryorporaorb=="p") p=matched.toFloat(&ok);
                  else if(xoryorporaorb=="a") a=matched.toFloat(&ok);
                  else if(xoryorporaorb=="b") b=matched.toFloat(&ok);
                  else continue;
                  if(!ok){
                      qDebug() << "Could not convert \"" << matched <<"\" to an integer!";
                      continue;
                  }
      
                  QBrush whiteBrush(Qt::white);
                  QPen whitePen(Qt::white, 1.);
                  scene->addEllipse(a, b, 5, 5, whitePen, whiteBrush);
      

      Please give me some suggestion kindly, thanks!

      p.s Funny thing is, this error didn't happen if I use mega2560, it's about the processing time?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Macive-Xiong What is the error? I only see garbage in the link you posted.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      Macive XiongM 1 Reply Last reply
      1
      • jsulmJ jsulm

        @Macive-Xiong What is the error? I only see garbage in the link you posted.

        Macive XiongM Offline
        Macive XiongM Offline
        Macive Xiong
        wrote on last edited by
        #3

        Hi @jsulm
        yes, that's what I meant, in the link I posted is the picture I took, the error signal is the points in the circle, I didn't input the position there but somehow it showed up. Any suggestion?

        jsulmJ 1 Reply Last reply
        0
        • Macive XiongM Macive Xiong

          Hi @jsulm
          yes, that's what I meant, in the link I posted is the picture I took, the error signal is the points in the circle, I didn't input the position there but somehow it showed up. Any suggestion?

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Macive-Xiong I still don't understand: what do you mean by "error signal"?

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          Macive XiongM 1 Reply Last reply
          0
          • jsulmJ jsulm

            @Macive-Xiong I still don't understand: what do you mean by "error signal"?

            Macive XiongM Offline
            Macive XiongM Offline
            Macive Xiong
            wrote on last edited by Macive Xiong
            #5

            @jsulm

            OK!! From the photo in that link, you can see a bunch of lines in the right of the pic. That's the right position I would like to set the points on. But in the up and left of the pic I circled , you can see some points and lines which are not what I want. I didn't set the points on those positions which is I think it's a error signal. I am not sure if this is a right reference for that but since I don't need those points, but it showed... Any suggestion?

            Btw, I am thinking about grayscale, is it possible that I could do some grayscale in my QGraphicsView, instead of setting points?

            Thank you so much:)

            jsulmJ 1 Reply Last reply
            0
            • Macive XiongM Macive Xiong

              @jsulm

              OK!! From the photo in that link, you can see a bunch of lines in the right of the pic. That's the right position I would like to set the points on. But in the up and left of the pic I circled , you can see some points and lines which are not what I want. I didn't set the points on those positions which is I think it's a error signal. I am not sure if this is a right reference for that but since I don't need those points, but it showed... Any suggestion?

              Btw, I am thinking about grayscale, is it possible that I could do some grayscale in my QGraphicsView, instead of setting points?

              Thank you so much:)

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Macive-Xiong Well, if there are points then you most probably put them there. You should check all the coordinates you're getting (a/b) - you can print them via qDebug() << a << b;

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              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