Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Game Development
  4. How do I mix QT3D with normal QTGui/QTWidget code?
Forum Updated to NodeBB v4.3 + New Features

How do I mix QT3D with normal QTGui/QTWidget code?

Scheduled Pinned Locked Moved Unsolved Game Development
qt3d
6 Posts 4 Posters 1.1k Views 1 Watching
  • 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.
  • E Offline
    E Offline
    Ethindp
    wrote on 24 Apr 2023, 22:57 last edited by
    #1

    So, I can't seem to find an answer to this anywhere.

    I'm trying to write a game (currently only an audio game but maybe in the future I'll expand it with graphics) which uses QTGui as the UI and Qt3D for input, logic, etc., where the UI doesn't consume input for itself. I'm trying to avoid QML, but the QT documentation is full of it. Examples that I've found use Qt3DExtras::QT3DWindow, which appears to be an undocumented class. So I don't know how to:

    • Create a normal QT UI
    • Create a 3D widget within that UI where input/logic/etc. occurs

    Or, alternatively:

    • Create a full 3D window
    • Receive input, do logic, etc., but then when I need a UI, I can just ask QT to display me a new window.

    Ideas?

    J 1 Reply Last reply 24 Apr 2023, 23:02
    0
    • E Ethindp
      24 Apr 2023, 22:57

      So, I can't seem to find an answer to this anywhere.

      I'm trying to write a game (currently only an audio game but maybe in the future I'll expand it with graphics) which uses QTGui as the UI and Qt3D for input, logic, etc., where the UI doesn't consume input for itself. I'm trying to avoid QML, but the QT documentation is full of it. Examples that I've found use Qt3DExtras::QT3DWindow, which appears to be an undocumented class. So I don't know how to:

      • Create a normal QT UI
      • Create a 3D widget within that UI where input/logic/etc. occurs

      Or, alternatively:

      • Create a full 3D window
      • Receive input, do logic, etc., but then when I need a UI, I can just ask QT to display me a new window.

      Ideas?

      J Offline
      J Offline
      JoeCFD
      wrote on 24 Apr 2023, 23:02 last edited by JoeCFD
      #2

      @Ethindp https://doc.qt.io/qt-6/qt3d-examples.html
      in the following example:
      https://code.qt.io/cgit/qt/qt3d.git/tree/examples/qt3d/basicshapes-cpp/main.cpp?h=6.5

          Qt3DExtras::Qt3DWindow *view = new Qt3DExtras::Qt3DWindow();
          view->defaultFrameGraph()->setClearColor(QColor(QRgb(0x4d4d4f)));
          QWidget *container = QWidget::createWindowContainer(view);
          QSize screenSize = view->screen()->size();
      

      you can see that a container can be created to wrap Qt3DExtras::Qt3DWindow and can be put into any layout for example inside a qt window.

      E 1 Reply Last reply 25 Apr 2023, 00:22
      0
      • J JoeCFD
        24 Apr 2023, 23:02

        @Ethindp https://doc.qt.io/qt-6/qt3d-examples.html
        in the following example:
        https://code.qt.io/cgit/qt/qt3d.git/tree/examples/qt3d/basicshapes-cpp/main.cpp?h=6.5

            Qt3DExtras::Qt3DWindow *view = new Qt3DExtras::Qt3DWindow();
            view->defaultFrameGraph()->setClearColor(QColor(QRgb(0x4d4d4f)));
            QWidget *container = QWidget::createWindowContainer(view);
            QSize screenSize = view->screen()->size();
        

        you can see that a container can be created to wrap Qt3DExtras::Qt3DWindow and can be put into any layout for example inside a qt window.

        E Offline
        E Offline
        Ethindp
        wrote on 25 Apr 2023, 00:22 last edited by
        #3

        @JoeCFD Thanks! Is there documentation on the Qt3DWindow class, or should I just look in the header?

        J S 2 Replies Last reply 25 Apr 2023, 19:39
        0
        • E Ethindp
          25 Apr 2023, 00:22

          @JoeCFD Thanks! Is there documentation on the Qt3DWindow class, or should I just look in the header?

          J Offline
          J Offline
          JoeCFD
          wrote on 25 Apr 2023, 19:39 last edited by
          #4

          @Ethindp I can not find the doc as well. Check its source code out.

          1 Reply Last reply
          0
          • E Ethindp
            25 Apr 2023, 00:22

            @JoeCFD Thanks! Is there documentation on the Qt3DWindow class, or should I just look in the header?

            S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 25 Apr 2023, 19:40 last edited by
            #5

            @Ethindp hi,

            It looks like there are some missing bits in the class documentation. However, you can check the source in any case

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • J Offline
              J Offline
              jason34
              wrote on 16 Aug 2024, 08:37 last edited by
              #6

              Hello,
              To combine Qt3D and QtGui effectively, create separate components for 3D and 2D elements. Use Qt3D's input system for 3D interactions and Qt's event handling for GUI elements. Prioritize input based on focus. Communicate between components using signals and slots. Consider performance implications and thorough testing.

              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