Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QDeclarativeView3D black screen while loading 3D model
QtWS25 Last Chance

QDeclarativeView3D black screen while loading 3D model

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 2.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.
  • B Offline
    B Offline
    Bobbz
    wrote on last edited by
    #1

    Hi all,

    I'm writing a QtQuickApplication, in which there should be a box showing a 3D model made in 3ds.
    I took a QML project online that does this job, using a .qml file with this simple piece of code:

    @import QtQuick 1.0
    import Qt3D 1.0
    import Qt3D.Shapes 1.0

    Viewport {
    Mesh {
    id: cube
    source: "cube.3ds"
    }

    Item3D {
        mesh: cube
    }
    

    }@

    I run this qml project, and everything works fine.

    I decide then to import this "sample.qml" file inside my Desktop application, as explained in http://doc.qt.nokia.com/4.7/qml-inte...objects-in-qml. To do so, I promote a QGraphicsView to a QDeclarativeView3D, and in the main cpp file I write:

    @
    ui->graphicsView->setSource(QUrl::fromLocalFile("sample.qml"));
    ui->graphicsView->show();
    @

    where ui->graphicsView is obviously the QDeclarativeView3D widget.

    Now, there's the problem: I run the application, but the QDeclarativeView3D remains always black, even "mousing" over it.
    I also tried giving graphicsView an inexisting file as source, but in that case the QDeclarativeView3D is white: then, is almost sure that the qml file is loaded. I wonder why it can't be shown.

    Any suggestion will be appreciated!

    Thanks in advance,
    Bobbz

    1 Reply Last reply
    0
    • Z Offline
      Z Offline
      ZapB
      wrote on last edited by
      #2

      Have you tried running with -graphicssystem opengl?

      Nokia Certified Qt Specialist
      Interested in hearing about Qt related work

      1 Reply Last reply
      0
      • B Offline
        B Offline
        Bobbz
        wrote on last edited by
        #3

        Thanks for suggestion. Unfortunately, it doesn't work...

        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