Kamil Słotwiński
Kamil Słotwiński

Reputation: 69

Qt Widget inside qt3d window

How to put a label or button into qt3d window? Is it possible? Havent seen any example... I was trying to simply put qt3d in windowcontainer, assign layout to it and layout->addWiget() but it just doesnt work.

Upvotes: 1

Views: 1344

Answers (2)

Florian Blume
Florian Blume

Reputation: 3345

I know this is a farily old question but I wanted to give a more detailed answer if anyone else stumbles across this.

  1. I implemented a Qt3D widget which you can find here. Unfortunately it relies on a method to obtain the texture id from QAbstractTexture which is only available from Qt >= 5.13 so that's the minimum version you have to use.

  2. createWindowContainer draws the respective window above everything else. So you'll never be able to draw any buttons inside the container.

  3. You can of course have buttons and everything else around your containered 3D window. But that's specifically not what you wanted.

  4. You can use Dear ImGui - and it's Qt3D integration. ImGui is used to draw GUI elements using vertices in 3D environments.

  5. Of course you can always use QML - there you should be able to place buttons inside the 3D view.

Upvotes: 3

bruno
bruno

Reputation: 32586

you have both label and (radio)buttons on the first example for C++ into the QT3d documentation, refer to Qt 3D: Basic Shapes C++ Example

QExtrudedTextGeometry seems to be the class for 3D text

Upvotes: 0

Related Questions