Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-122155

setPointConfiguration does not work if UseOpenGL is true

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.2.8
    • Charts
    • None
    • Qt 6.2.9 64-bit on Windows 10, QtCreator ver 12.0.1
    • Windows

    Description

      Using a QLineSeries (though this bug may apply to other types) the setPointConfiguration method does nothing when setUseOpenGL(true). I created a simple program to show this based on one of the examples. In addition to setPointConfiguration not working, the setPointsVisible(true) has nbo effect, points are not visible, only lines.
      Here is image with OpenGL OFF:

      And here OpenGL is true (note no markers or annotations):

      Here is source:

      
      #include <QApplication>
      #include <QChart>
      #include <QChartView>
      #include <QCheckBox>
      #include <QComboBox>
      #include <QGridLayout>
      #include <QHBoxLayout>
      #include <QLabel>
      #include <QMainWindow>
      #include <QSplineSeries>
      
      int
      main(int argc, char *argv[])
      {
        QApplication a(argc, argv);
        QMainWindow mainWindow;
        mainWindow.setWindowTitle("Chart");
      
        //![1]
        constexpr qreal marker_size= 20.;
      
        QLineSeries *series= new QLineSeries();
        series->setName("Customized series");
        series->setPointsVisible(true);
        series->setMarkerSize(5);
        series->setUseOpenGL(true);
      
        *series << QPointF(0, 6) << QPointF(2, 4) << QPointF(3, 6) << QPointF(7, 4)
                << QPointF(10, 5) << QPointF(11, 1) << QPointF(13, 3)
                << QPointF(17, 5.5) << QPointF(18, 3) << QPointF(20, 2)
                << QPointF(22, 3.14159) << QPointF(24, 1.414) << QPointF(26, 2.7183);
      
        QHash<QXYSeries::PointConfiguration, QVariant> conf;
        conf[QXYSeries::PointConfiguration::Color]= QColor(Qt::red);
        conf[QXYSeries::PointConfiguration::Size]= 8;
        conf[QXYSeries::PointConfiguration::LabelVisibility]= true;
      
        series->setPointConfiguration(2, conf);
        series->setPointConfiguration(4, conf);
        series->setPointConfiguration(6, conf);
        series->setPointConfiguration(8, conf);
      
        conf.remove(QXYSeries::PointConfiguration::Color);
        // conf[QXYSeries::PointConfiguration::LabelFormat] = "This Point";
        series->setPointConfiguration(10, conf);
      
        //![2]
        QChart *chart= new QChart();
        chart->addSeries(series);
        chart->createDefaultAxes();
        chart->legend()->setVisible(false);
      
        QChartView *chartView= new QChartView(chart);
        chartView->setRenderHint(QPainter::Antialiasing);
      
        QWidget *mainWidget= new QWidget(&mainWindow);
        QHBoxLayout *mainLayout= new QHBoxLayout(mainWidget);
        mainLayout->addWidget(chartView);
      
        mainWindow.setCentralWidget(mainWidget);
        mainWindow.resize(1080, 720);
        mainWindow.show();
        return a.exec();
        //![7]
      }
      

      Attachments

        1. OpenGLOFF.png
          OpenGLOFF.png
          43 kB
        2. OpenGLON.png
          OpenGLON.png
          21 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            e0348803 Miikka Heikkinen
            kcbeck Kenneth Beck
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes