Qt Forum

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

    Qt Academy Launch in California!

    Unsolved QT3D in a form

    General and Desktop
    1
    1
    160
    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.
    • G
      grsabourin last edited by

      Hi

      I'm developing desktop application that include a widget to display 3D models (3D viewer). I would like to use QT3D to render the model. In my form I have included a widget that is implemented in a class with heritage of a QWidget.

      This is the .h of widget object

      {
           Q_OBJECT
      
      public:
          Display3D(QWidget *parent = 0);
          ~Display3D();
      
      private : 
           QWidget *container;
      
      };
      //your code here
      ``
      This is the cpp of the QWidget ( mostly the constructor. This is only interesting implementation for now 
      
        // Root entity
          Qt3DCore::QEntity *rootEntity = new Qt3DCore::QEntity();
      
          auto view = new Qt3DExtras::Qt3DWindow();
      
          QSize sWidget = this->size();
      
          qInfo() << "widget size " << sWidget.width() << " " << sWidget.height();
      
      
          // create a container for Qt3DWindow
          container = createWindowContainer(view,this);
      
          // background color
          view->defaultFrameGraph()->setClearColor(QColor(QRgb(0x575757)));
      
          // background color
           view->defaultFrameGraph()->setClearColor(QColor(QRgb(0x575757)));
      
           // Camera
             Qt3DRender::QCamera *cameraEntity = view->camera();
      
      .............................
      
      ....................................```
      //your code here
      

      When I run the application the GUI appear and display in the widget the shape I would like to draw (not in the current code). The issue is the 3D display is super small in the top left corner of the area of my widget. It is like I have created a window in my widget. How I can have the 3D view occupy the entire widget surface?

      Thank you

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