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. QT3D in a form

QT3D in a form

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 325 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.
  • G Offline
    G Offline
    grsabourin
    wrote on last edited by
    #1

    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
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved