Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Problem cross compiling (QT5) Qt3D to raspberry Pi

    QtonPi
    2
    3
    3934
    Loading More Posts
    • 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.
    • B
      Beoborg last edited by

      Hi,
      I have created working cross compile environment to my linux mint laptop. I was able to deploy
      simple helloworld app to my rpi. Now I have tried to get teapot example to work, but no luck.
      Teapot qt example is here:
      "http://doc-snapshot.qt-project.org/qt3d-1.0/qt3d-teapot.html"

      There is something wrong with my teapotview constructor, but I don't now what it is..
      Does anyone know what is the problem, I have run out of ideas here?

      Error print:
      @In file included from ../qt5-raspberrypi-example/main.cpp:2:0:
      ../qt5-raspberrypi-example/teapotview.h: In constructor 'TeapotView::TeapotView(QWidget*)':
      ../qt5-raspberrypi-example/teapotview.h:13:65: error: no matching function for call to 'QGLView::QGLView(QWidget*&)'
      ../qt5-raspberrypi-example/teapotview.h:13:65: note: candidates are:
      In file included from /mnt/rasp-pi-rootfs/usr/local/qt5pi/include/Qt3D/QGLView:1:0,
      from ../qt5-raspberrypi-example/teapotview.h:4,
      from ../qt5-raspberrypi-example/main.cpp:2:
      /mnt/rasp-pi-rootfs/usr/local/qt5pi/include/Qt3D/qglview.h:63:14: note: QGLView::QGLView(const QSurfaceFormat&, QWindow*)
      /mnt/rasp-pi-rootfs/usr/local/qt5pi/include/Qt3D/qglview.h:63:14: note: no known conversion for argument 1 from 'QWidget*' to 'const QSurfaceFormat&'
      /mnt/rasp-pi-rootfs/usr/local/qt5pi/include/Qt3D/qglview.h:62:14: note: QGLView::QGLView(QWindow*)
      /mnt/rasp-pi-rootfs/usr/local/qt5pi/include/Qt3D/qglview.h:62:14: note: no known conversion for argument 1 from 'QWidget*' to 'QWindow*'
      /mnt/rasp-pi-rootfs/usr/local/qt5pi/include/Qt3D/qglview.h:58:21: note: QGLView::QGLView(const QGLView&)
      /mnt/rasp-pi-rootfs/usr/local/qt5pi/include/Qt3D/qglview.h:58:21: note: no known conversion for argument 1 from 'QWidget*' to 'const QGLView&'
      make: *** [main.o] Error 1@

      Here is my code and pro file:
      main.cpp
      @
      #include <Qt/qapplication.h>
      #include "teapotview.h"

      int main(int argc, char *argv[])
      {
      QApplication app(argc, argv);
      TeapotView view;

      if (view.stereoType() != QGLView::RedCyanAnaglyph)
          view.camera()->setEyeSeparation(0.3f);
      if (QApplication::arguments().contains(QLatin1String("-maximize")))
          view.showMaximized();
      else if (QApplication::arguments().contains(QLatin1String("-fullscreen")))
          view.showFullScreen();
      else
          view.show();
      
      return app.exec();
      

      }@

      teapotview.h:
      @#ifndef TEAPOTVIEW_H
      #define TEAPOTVIEW_H

      #include <Qt3D/QGLView>
      #include <Qt3D/QGLTeapot>

      class QGLSceneNode;

      class TeapotView : public QGLView
      {
      Q_OBJECT
      public:
      TeapotView(QWidget *parent = 0) : QGLView(parent), teapot(0) {}
      ~TeapotView();

      protected:
      void initializeGL(QGLPainter *painter);
      void paintGL(QGLPainter *painter);
      private:
      QGLSceneNode *teapot;
      };

      #endif // TEAPOTVIEW_H@

      teapotview.cpp

      @#include "teapotview.h"
      #include <Qt3D/QGLBuilder>
      #include <Qt3D/QGLSceneNode>

      void TeapotView::initializeGL(QGLPainter *painter)
      {
      painter->setStandardEffect(QGL::LitMaterial);
      QGLBuilder builder;
      builder << QGLTeapot();
      teapot = builder.finalizedSceneNode();
      }

      TeapotView::~TeapotView()
      {
      delete teapot;
      }

      void TeapotView::paintGL(QGLPainter *painter)
      {
      teapot->draw(painter);
      }@

      helloworld.pro
      @
      TEMPLATE = app

      target.path = /home/pi/teapot
      TARGET = teapot
      INSTALLS += target

      DEPENDPATH += .
      INCLUDEPATH += .

      SOURCES += main.cpp
      teapotview.cpp

      HEADERS +=
      teapotview.h

      CONFIG += qt qwidgets warn-on qt3d_deploy_pkg

      OTHER_FILES +=
      teapot.rc
      teapot.desktop

      RC_FILE = teapot.rc

      INCLUDEPATH += /mnt/rasp-pi-rootfs/usr/local/qt5pi/include/
      qml_folder.source = qml
      DEPLOYMENTFOLDERS = qml_folder

      for(deploymentfolder, DEPLOYMENTFOLDERS) {
      item = item$${deploymentfolder}
      itemsources = $${item}.sources
      $$itemsources = $$eval($${deploymentfolder}.source)
      itempath = $${item}.path
      $$itempath= $$eval($${deploymentfolder}.target)
      export($$itemsources)
      export($$itempath)
      DEPLOYMENT += $$item
      }

      installPrefix = /home/pi/$${TARGET}

      for(deploymentfolder, DEPLOYMENTFOLDERS) {
      item = item$${deploymentfolder}
      itemfiles = $${item}.files
      $$itemfiles = $$eval($${deploymentfolder}.source)
      itempath = $${item}.path
      $$itempath = $${installPrefix}/$$eval($${deploymentfolder}.target)
      export($$itemfiles)
      export($$itempath)
      INSTALLS += $$item
      }@

      1 Reply Last reply Reply Quote 0
      • B
        Beoborg last edited by

        "Working teapot link":http://doc-snapshot.qt-project.org/qt3d-1.0/qt3d-teapot.html

        1 Reply Last reply Reply Quote 0
        • D
          deus last edited by

          QGLview is now a subclass of Qwindow not Qwidget.

          Just change the constructor argument to:
          @TeapotView(QWindow *parent = 0)@

          And you should be good to go.

          The documentation for QT3D is atrocious now'a'days.

          But you can checkout updated examples directly from the git repos.

          http://qt.gitorious.org/qt/qt3d/trees/master/examples/qt3d/teapot

          1 Reply Last reply Reply Quote 0
          • First post
            Last post