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. Change line width in Q3DSurface

Change line width in Q3DSurface

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 1.5k 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.
  • Z Offline
    Z Offline
    zloi_templar
    wrote on 17 Aug 2018, 12:21 last edited by zloi_templar
    #1

    Hello, i want to make 3D Spline chart
    I decided to do this with the help of Q3DSurface

    Part of code:
    QWidget *wdg = new QWidget;
    float minX = std::numeric_limits<float>::max(),
    minY = std::numeric_limits<float>::max(),
    minZ = std::numeric_limits<float>::max(),
    maxX = std::numeric_limits<float>::min(),
    maxY = std::numeric_limits<float>::min(),
    maxZ = std::numeric_limits<float>::min();
    Q3DSurface *graph = new Q3DSurface();
    QWidget *container = QWidget::createWindowContainer(graph);
    QHBoxLayout *hLayout = new QHBoxLayout(wdg);
    hLayout->addWidget(container, 1);
    QSurfaceDataProxy *prox = new QSurfaceDataProxy();
    QSurface3DSeries *series = new QSurface3DSeries(prox);
    QSurfaceDataArray *dataArray = new QSurfaceDataArray;
    int index = 0;
    int size = sqlSize(query);
    dataArray->reserve(size);
    QSurfaceDataRow *newRow = new QSurfaceDataRow(size);
    while (query.next())
    {
    float x = query.value(2).toFloat();
    if (x<minX)
    minX=x;
    if (x>maxX)
    maxX=x;
    float y = query.value(1).toFloat();
    if (y<minY)
    minY=y;
    if (y>maxY)
    maxY=y;
    float z = query.value(0).toFloat();
    if (z<minZ)
    minZ=z;
    if (z>maxZ)
    maxZ=z;
    (*newRow)[index++].setPosition(QVector3D(x, y, z));
    *dataArray << newRow;
    }
    QRect rec = QApplication::desktop()->screenGeometry();
    double height = rec.height();
    double width = rec.width();
    graph->activeTheme()->setType(Q3DTheme::ThemeEbony);
    graph->activeTheme()->setFont(font);
    graph->setShadowQuality(QAbstract3DGraph::ShadowQualitySoftLow);
    graph->axisX()->setRange(minX-100, maxX+100);
    graph->axisY()->setRange(minY-100, maxY+100);
    graph->axisZ()->setRange(minZ-100, maxZ+100);
    wdg->setGeometry(width/4, height/4, width/2, height/2);
    prox->resetArray(dataArray);
    graph->addSeries(series);
    wdg->show();

    But result line is very small, i want to change color and thickness.
    graph->activeTheme()->setFont(font) change only label and legends
    Hope on your help)
    Maybe i need not Q3DSurface?
    0_1534508505126_1.PNG

    C 1 Reply Last reply 25 Aug 2018, 07:11
    0
    • Z zloi_templar
      17 Aug 2018, 12:21

      Hello, i want to make 3D Spline chart
      I decided to do this with the help of Q3DSurface

      Part of code:
      QWidget *wdg = new QWidget;
      float minX = std::numeric_limits<float>::max(),
      minY = std::numeric_limits<float>::max(),
      minZ = std::numeric_limits<float>::max(),
      maxX = std::numeric_limits<float>::min(),
      maxY = std::numeric_limits<float>::min(),
      maxZ = std::numeric_limits<float>::min();
      Q3DSurface *graph = new Q3DSurface();
      QWidget *container = QWidget::createWindowContainer(graph);
      QHBoxLayout *hLayout = new QHBoxLayout(wdg);
      hLayout->addWidget(container, 1);
      QSurfaceDataProxy *prox = new QSurfaceDataProxy();
      QSurface3DSeries *series = new QSurface3DSeries(prox);
      QSurfaceDataArray *dataArray = new QSurfaceDataArray;
      int index = 0;
      int size = sqlSize(query);
      dataArray->reserve(size);
      QSurfaceDataRow *newRow = new QSurfaceDataRow(size);
      while (query.next())
      {
      float x = query.value(2).toFloat();
      if (x<minX)
      minX=x;
      if (x>maxX)
      maxX=x;
      float y = query.value(1).toFloat();
      if (y<minY)
      minY=y;
      if (y>maxY)
      maxY=y;
      float z = query.value(0).toFloat();
      if (z<minZ)
      minZ=z;
      if (z>maxZ)
      maxZ=z;
      (*newRow)[index++].setPosition(QVector3D(x, y, z));
      *dataArray << newRow;
      }
      QRect rec = QApplication::desktop()->screenGeometry();
      double height = rec.height();
      double width = rec.width();
      graph->activeTheme()->setType(Q3DTheme::ThemeEbony);
      graph->activeTheme()->setFont(font);
      graph->setShadowQuality(QAbstract3DGraph::ShadowQualitySoftLow);
      graph->axisX()->setRange(minX-100, maxX+100);
      graph->axisY()->setRange(minY-100, maxY+100);
      graph->axisZ()->setRange(minZ-100, maxZ+100);
      wdg->setGeometry(width/4, height/4, width/2, height/2);
      prox->resetArray(dataArray);
      graph->addSeries(series);
      wdg->show();

      But result line is very small, i want to change color and thickness.
      graph->activeTheme()->setFont(font) change only label and legends
      Hope on your help)
      Maybe i need not Q3DSurface?
      0_1534508505126_1.PNG

      C Offline
      C Offline
      cawlfj
      wrote on 25 Aug 2018, 07:11 last edited by
      #2

      @zloi_templar
      Hi i think we have same requirement, i don't know how to display the 3d points and 3d spline so i use 3dscatter .

      for changing the point size and color , i use the code as below

      QLinearGradient ClinearGrad(QPointF(100, 100), QPointF(200, 200));
      ClinearGrad.setColorAt(0, Qt::green);
      ClinearGrad.setColorAt(1, Qt::green);
      CuSeries.setColorStyle(Q3DTheme::ColorStyleObjectGradient);
      CuSeries.setBaseGradient(ClinearGrad);
      CuSeries.setItemSize(0.02);
      graph->addSeries(&CuSeries);
      graph->seriesList().at(1)->setBaseColor(Qt::green);

      maybe you can find some way to get line size and color.

      Could you show me more code to display 3d points and 3d spline by Q3Dsurface?

      jeff

      0_1535181094004_TIM截图20180825150521.jpg

      C 1 Reply Last reply 25 Aug 2018, 07:32
      0
      • C cawlfj
        25 Aug 2018, 07:11

        @zloi_templar
        Hi i think we have same requirement, i don't know how to display the 3d points and 3d spline so i use 3dscatter .

        for changing the point size and color , i use the code as below

        QLinearGradient ClinearGrad(QPointF(100, 100), QPointF(200, 200));
        ClinearGrad.setColorAt(0, Qt::green);
        ClinearGrad.setColorAt(1, Qt::green);
        CuSeries.setColorStyle(Q3DTheme::ColorStyleObjectGradient);
        CuSeries.setBaseGradient(ClinearGrad);
        CuSeries.setItemSize(0.02);
        graph->addSeries(&CuSeries);
        graph->seriesList().at(1)->setBaseColor(Qt::green);

        maybe you can find some way to get line size and color.

        Could you show me more code to display 3d points and 3d spline by Q3Dsurface?

        jeff

        0_1535181094004_TIM截图20180825150521.jpg

        C Offline
        C Offline
        cawlfj
        wrote on 25 Aug 2018, 07:32 last edited by
        #3

        @cawlfj
        try to use QSurface3DSeries

        void
        setBaseColor(const QColor &color)
        void
        setBaseGradient(const QLinearGradient &gradient)
        ?

        BTW, how do you to display lines by spline?
        I can't find how to set the display type?
        Jeff

        Z 1 Reply Last reply 27 Aug 2018, 08:59
        0
        • C cawlfj
          25 Aug 2018, 07:32

          @cawlfj
          try to use QSurface3DSeries

          void
          setBaseColor(const QColor &color)
          void
          setBaseGradient(const QLinearGradient &gradient)
          ?

          BTW, how do you to display lines by spline?
          I can't find how to set the display type?
          Jeff

          Z Offline
          Z Offline
          zloi_templar
          wrote on 27 Aug 2018, 08:59 last edited by zloi_templar
          #4

          @cawlfj
          it's all my code)

          Q3DSurface automaticaly makes lines for your input data
          if you will set 3-axes, you will get line
          4-axes - surface

          and i using QSurface3DSeries
          Q3DSurface *graph = new Q3DSurface();
          QWidget *container = QWidget::createWindowContainer(graph);
          QHBoxLayout *hLayout = new QHBoxLayout(wdg);
          hLayout->addWidget(container, 1);
          QSurfaceDataProxy *prox = new QSurfaceDataProxy();
          QSurface3DSeries *series = new QSurface3DSeries(prox);
          QSurfaceDataArray *dataArray = new QSurfaceDataArray;

          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