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

The editable axis labels feature not working

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.5.1, 6.5.2, 6.6.0
    • Charts
    • None
    • Windows, MinGW 11.2.0 64-bit C++
    • Windows

    Description

      The editable axis labels feature not working.
      I only tested 6.5.1, 6.5.2 and 6.6.0; the last working version I tested is 5.15.2
      The mouseDoubleClickEvent is not passed to the EditableAxisLabel; Hover and ContextMenu events are passed, as well as Window events.
      The bug can be reproduced with the code below (try to double-click on axis labels):

      #include <QApplication>
      #include <QGraphicsScene>
      #include <QGraphicsView>
      #include <QtCharts/QChart>
      #include <QtCharts/QChartView>
      #include <QtCharts/QLineSeries>
      #include <QtCharts/QValueAxis>
      
      QT_USE_NAMESPACE
      
      class View : public QGraphicsView
      {
        public:
          View(QWidget *parent = nullptr) : QGraphicsView(parent)
          {
              m_scene = new QGraphicsScene(this);
              m_chart = new QChart();
      
              // Add a dummy line series to the chart
              QLineSeries *series = new QLineSeries();
              series->append(0, 0);
              series->append(1, 2);
              series->append(2, 4);
              m_chart->addSeries(series);
      
              QValueAxis *axisX = new QValueAxis;
              axisX->setTitleText("X Axis");
              axisX->setLabelsEditable(true); // Enable editable labels
              QValueAxis *axisY = new QValueAxis;
              axisY->setTitleText("Y Axis");
              axisY->setLabelsEditable(true); // Enable editable labels
      
              m_chart->addAxis(axisX, Qt::AlignBottom);
              m_chart->addAxis(axisY, Qt::AlignLeft);
              series->attachAxis(axisX);
              series->attachAxis(axisY);
      
              m_chart->setMinimumSize(400, 300);
              m_scene->addItem(m_chart);
      
              setScene(m_scene);
          }
      
        private:
          QGraphicsScene *m_scene;
          QChart *m_chart;
      };
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
          View view;
          view.show();
          return a.exec();
      }
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            e0348803 Miikka Heikkinen
            timprosu Paul Rosu
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes