Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Q3DSurface selected point signal
Qt 6.12 LTS is out! See what's new in the release blog

Q3DSurface selected point signal

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 1.1k 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.
  • L Offline
    L Offline
    let-robots-reig
    wrote on last edited by
    #1

    I am using QtDataVisualization (Q3DSurface in particular) to make a simple 3D surface graph.

    The Q3DSurface supports selection of a point on the graph by showing a highlighted ball on the data point where the user has clicked. The selection pointer shows the coordinates of the point. It looks like this: surface with selected point

    However, I'm not able to find a signal that is emitted when the selection happens. Having read through the documentation of Q3DSurface and QSurface3DSeries, I failed to find any corresponding signal. There is only a selectedPointChanged(const QPoint &position) in QSurface3DSeries, but it operates with a two-dimensional QPoint which is not suitable for the case.

    What I am trying to do is store a history of selected points, that is why I need such a signal to keep track of previous coordinates. I tried looking into implementing a custom Q3DInputHandler, but not sure that it can resolve the issue. I would be grateful for any advice on the solution.

    1 Reply Last reply
    1
    • H Offline
      H Offline
      Henrik Thoma
      wrote on last edited by
      #2

      Although this topic is quite old, you were on the right track. The selectedPointChanged(const QPoint &position) signal provides the position of the selected point in your QtDataVisualization::QSurfaceDataProxy, which can be used to access the desired information by using QtDataVisualization::QSurfaceDataProxy::itemAt(const QPoint &position). Below a minimalistic outline of the basic steps:

      using namespace QtDataVisualization;
      ...
      
      # surface init (should already exist)
      Q3DSurface *surfacePlot = new Q3DSurface();
      QSurfaceDataProxy *surfaceDataProxy = new QSurfaceDataProxy();
      QSurface3DSeries *surfaceDataSeries = new QSurface3DSeries(surfaceDataProxy);
      surfacePlot->addSeries(surfaceDataSeries);
      
      # connect the selectedPointChanged signal to e.g. your desired foo function
      # (adjust this to fit the required signal/slot type for your function)
      QObject::connect(surfaceDataSeries, &QSurface3DSeries::selectedPointChanged, foo);
      
      # the foo funciton should look like
      void foo(const QPoint &position)
      {
          if ((position.x() < 0) or (position.y() < 0))
              return; // nothing selected
          QVector3D pos = surfaceDataProxy->itemAt(position)->position(); // (x,y,z) data for selected point
          ... # e.g. store the pos in some list
      }
      
      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
      • Unsolved