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. setPointConfiguration does nothing
Forum Updated to NodeBB v4.3 + New Features

setPointConfiguration does nothing

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 454 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.
  • N Offline
    N Offline
    nekkceb
    wrote on last edited by
    #1

    I am using Qt ver 6.2.8 (64-bit) in Windows 10 (latest). I have a QLineSeries that I am trying to implement a way for the user to select a point with the mouse, and have that point highlighted with a larger symbol, and possible label the point. Though the code is pretty large at this point here are relevant snippets:
    I have an over-loaded QChart classe that defines a QLineSeries:

      m_avgSeries= new QLineSeries(this);
      m_avgSeries->setName("Avg");
      QPen avgCol(Qt::blue);
      m_avgSeries->setUseOpenGL(true);
      avgCol.setWidth(3);
      // m_avgSeries->setMarkerSize(8.0);
      m_avgSeries->setPointsVisible(true);
      m_avgSeries->setPen(avgCol);
      m_avgSeries->append(m_x, m_y);
      QObject::connect(m_avgSeries, SIGNAL(clicked(QPointF)), this,
                       SLOT(handleAvgPtSelect(QPointF)));
    

    I also define a pointConfiguration member variable:

    // from header: QHash<QXYSeries::PointConfiguration, QVariant> ptconf;
      m_ptConf[QXYSeries::PointConfiguration::Color]= QColor(Qt::magenta);
      m_ptConf[QXYSeries::PointConfiguration::Size]= 8;
      m_ptConf[QXYSeries::PointConfiguration::LabelVisibility]= true;
    

    Then in the slot handleAvgPtSelect I first find the index of the mouse-selected point (the m_avgSeries is pretty large at this point...), then try to highlight it with this code:

          m_avgSeries->setPointConfiguration(index, m_ptConf);
          m_avgSeries->setPointSelected(index, true);
    

    But this does nothing to the appearance on the graph. I have set breakpoints at various places in this code, and it is all getting hit at appropriate times. Any suggestions for what might be wrong are appreciated.

    JonBJ 1 Reply Last reply
    0
    • N nekkceb

      I am using Qt ver 6.2.8 (64-bit) in Windows 10 (latest). I have a QLineSeries that I am trying to implement a way for the user to select a point with the mouse, and have that point highlighted with a larger symbol, and possible label the point. Though the code is pretty large at this point here are relevant snippets:
      I have an over-loaded QChart classe that defines a QLineSeries:

        m_avgSeries= new QLineSeries(this);
        m_avgSeries->setName("Avg");
        QPen avgCol(Qt::blue);
        m_avgSeries->setUseOpenGL(true);
        avgCol.setWidth(3);
        // m_avgSeries->setMarkerSize(8.0);
        m_avgSeries->setPointsVisible(true);
        m_avgSeries->setPen(avgCol);
        m_avgSeries->append(m_x, m_y);
        QObject::connect(m_avgSeries, SIGNAL(clicked(QPointF)), this,
                         SLOT(handleAvgPtSelect(QPointF)));
      

      I also define a pointConfiguration member variable:

      // from header: QHash<QXYSeries::PointConfiguration, QVariant> ptconf;
        m_ptConf[QXYSeries::PointConfiguration::Color]= QColor(Qt::magenta);
        m_ptConf[QXYSeries::PointConfiguration::Size]= 8;
        m_ptConf[QXYSeries::PointConfiguration::LabelVisibility]= true;
      

      Then in the slot handleAvgPtSelect I first find the index of the mouse-selected point (the m_avgSeries is pretty large at this point...), then try to highlight it with this code:

            m_avgSeries->setPointConfiguration(index, m_ptConf);
            m_avgSeries->setPointSelected(index, true);
      

      But this does nothing to the appearance on the graph. I have set breakpoints at various places in this code, and it is all getting hit at appropriate times. Any suggestions for what might be wrong are appreciated.

      JonBJ Online
      JonBJ Online
      JonB
      wrote on last edited by
      #2

      @nekkceb
      To me your code looks reasonable. I would spend the 5 minutes to set up a brand new project and just paste in the code from https://doc.qt.io/qt-6/qxyseries.html#setPointConfiguration. Does that work for you?

      N 2 Replies Last reply
      0
      • JonBJ JonB

        @nekkceb
        To me your code looks reasonable. I would spend the 5 minutes to set up a brand new project and just paste in the code from https://doc.qt.io/qt-6/qxyseries.html#setPointConfiguration. Does that work for you?

        N Offline
        N Offline
        nekkceb
        wrote on last edited by
        #3

        @JonB Thanks for quick response and suggestion. And, yes that simple example works fine!

        JonBJ 1 Reply Last reply
        0
        • N nekkceb

          @JonB Thanks for quick response and suggestion. And, yes that simple example works fine!

          JonBJ Online
          JonBJ Online
          JonB
          wrote on last edited by
          #4

          @nekkceb
          Then it's your job to find out how they differ! Check your value for index. Maybe when " (the m_avgSeries is pretty large at this point...)" it doesn't plot one point or it's hard tp see? Try calling the setPointConfiguration() on lots/every point in the series, is that visible?

          N 1 Reply Last reply
          1
          • JonBJ JonB

            @nekkceb
            To me your code looks reasonable. I would spend the 5 minutes to set up a brand new project and just paste in the code from https://doc.qt.io/qt-6/qxyseries.html#setPointConfiguration. Does that work for you?

            N Offline
            N Offline
            nekkceb
            wrote on last edited by
            #5

            @JonB Well, it may be trying to use OpenGL, which I had turned on because other documentation suggested it would give me faster refreshes using large series. I juist turned that off:

            m_series->setUseOpenGL(false)
            m_avgSeries->setUseOpenGL(false);
            

            Not only do the PointConfigurations work, but I had also turned on pointsVisible for the series, and the points were not showing, only the lines.

            1 Reply Last reply
            0
            • JonBJ JonB

              @nekkceb
              Then it's your job to find out how they differ! Check your value for index. Maybe when " (the m_avgSeries is pretty large at this point...)" it doesn't plot one point or it's hard tp see? Try calling the setPointConfiguration() on lots/every point in the series, is that visible?

              N Offline
              N Offline
              nekkceb
              wrote on last edited by
              #6

              @JonB I should ask, is this an oversight or bug? Should turning on OpenGL de-activate certain features of QLineseries?

              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