QT3D Multiview - Single View in Widget












0















I have a question regarding the "Qt 3D: Multi Viewport QML Example" Link



Is there a possibility to add a single view (one of the four in the example) into a separate widget. I tried to change the example but I only could add all four views to one widget.



The following code creates a camera which should be displayed in a separate Widget. see Picture





I am not sure if it is possible and how i can solve it.



SimpleCamera {
id: camera4
lens: cameraLens3
position: Qt.vector3d(100.0, 0.0, -6.0)
viewCenter: Qt.vector3d(0.0, 0.0, -6.0)
}









share|improve this question

























  • Try adding the relevant detail from your link into your question and show more specifically what you're trying to achieve

    – Sven Harris
    Nov 24 '18 at 17:59











  • I only know how to achieve this using C++: In this case, you create your Qt3DWindow and place it inside a widget using QWidget::createWindowContainer. This returns a widget which you can then use in your UI. You can do this for multiple different 3D windows, although performance suffers at some point. I'm not sure if you can reuse the framegraph, though as Qt's documentation often states that objects should not be shared, but you could try and see what happens.

    – Florian Blume
    Nov 24 '18 at 18:42











  • I already created a windowContainer but i do not know how to display a single view (e.g. one of the four views). Currently all four views are displayed inside the widget. If i could solve this i want to extend it that all four views are displayes in four separate widgets.

    – Tbi
    Nov 24 '18 at 18:51


















0















I have a question regarding the "Qt 3D: Multi Viewport QML Example" Link



Is there a possibility to add a single view (one of the four in the example) into a separate widget. I tried to change the example but I only could add all four views to one widget.



The following code creates a camera which should be displayed in a separate Widget. see Picture





I am not sure if it is possible and how i can solve it.



SimpleCamera {
id: camera4
lens: cameraLens3
position: Qt.vector3d(100.0, 0.0, -6.0)
viewCenter: Qt.vector3d(0.0, 0.0, -6.0)
}









share|improve this question

























  • Try adding the relevant detail from your link into your question and show more specifically what you're trying to achieve

    – Sven Harris
    Nov 24 '18 at 17:59











  • I only know how to achieve this using C++: In this case, you create your Qt3DWindow and place it inside a widget using QWidget::createWindowContainer. This returns a widget which you can then use in your UI. You can do this for multiple different 3D windows, although performance suffers at some point. I'm not sure if you can reuse the framegraph, though as Qt's documentation often states that objects should not be shared, but you could try and see what happens.

    – Florian Blume
    Nov 24 '18 at 18:42











  • I already created a windowContainer but i do not know how to display a single view (e.g. one of the four views). Currently all four views are displayed inside the widget. If i could solve this i want to extend it that all four views are displayes in four separate widgets.

    – Tbi
    Nov 24 '18 at 18:51
















0












0








0








I have a question regarding the "Qt 3D: Multi Viewport QML Example" Link



Is there a possibility to add a single view (one of the four in the example) into a separate widget. I tried to change the example but I only could add all four views to one widget.



The following code creates a camera which should be displayed in a separate Widget. see Picture





I am not sure if it is possible and how i can solve it.



SimpleCamera {
id: camera4
lens: cameraLens3
position: Qt.vector3d(100.0, 0.0, -6.0)
viewCenter: Qt.vector3d(0.0, 0.0, -6.0)
}









share|improve this question
















I have a question regarding the "Qt 3D: Multi Viewport QML Example" Link



Is there a possibility to add a single view (one of the four in the example) into a separate widget. I tried to change the example but I only could add all four views to one widget.



The following code creates a camera which should be displayed in a separate Widget. see Picture





I am not sure if it is possible and how i can solve it.



SimpleCamera {
id: camera4
lens: cameraLens3
position: Qt.vector3d(100.0, 0.0, -6.0)
viewCenter: Qt.vector3d(0.0, 0.0, -6.0)
}






qt qt3d






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 27 '18 at 10:30







Tbi

















asked Nov 24 '18 at 17:52









TbiTbi

12




12













  • Try adding the relevant detail from your link into your question and show more specifically what you're trying to achieve

    – Sven Harris
    Nov 24 '18 at 17:59











  • I only know how to achieve this using C++: In this case, you create your Qt3DWindow and place it inside a widget using QWidget::createWindowContainer. This returns a widget which you can then use in your UI. You can do this for multiple different 3D windows, although performance suffers at some point. I'm not sure if you can reuse the framegraph, though as Qt's documentation often states that objects should not be shared, but you could try and see what happens.

    – Florian Blume
    Nov 24 '18 at 18:42











  • I already created a windowContainer but i do not know how to display a single view (e.g. one of the four views). Currently all four views are displayed inside the widget. If i could solve this i want to extend it that all four views are displayes in four separate widgets.

    – Tbi
    Nov 24 '18 at 18:51





















  • Try adding the relevant detail from your link into your question and show more specifically what you're trying to achieve

    – Sven Harris
    Nov 24 '18 at 17:59











  • I only know how to achieve this using C++: In this case, you create your Qt3DWindow and place it inside a widget using QWidget::createWindowContainer. This returns a widget which you can then use in your UI. You can do this for multiple different 3D windows, although performance suffers at some point. I'm not sure if you can reuse the framegraph, though as Qt's documentation often states that objects should not be shared, but you could try and see what happens.

    – Florian Blume
    Nov 24 '18 at 18:42











  • I already created a windowContainer but i do not know how to display a single view (e.g. one of the four views). Currently all four views are displayed inside the widget. If i could solve this i want to extend it that all four views are displayes in four separate widgets.

    – Tbi
    Nov 24 '18 at 18:51



















Try adding the relevant detail from your link into your question and show more specifically what you're trying to achieve

– Sven Harris
Nov 24 '18 at 17:59





Try adding the relevant detail from your link into your question and show more specifically what you're trying to achieve

– Sven Harris
Nov 24 '18 at 17:59













I only know how to achieve this using C++: In this case, you create your Qt3DWindow and place it inside a widget using QWidget::createWindowContainer. This returns a widget which you can then use in your UI. You can do this for multiple different 3D windows, although performance suffers at some point. I'm not sure if you can reuse the framegraph, though as Qt's documentation often states that objects should not be shared, but you could try and see what happens.

– Florian Blume
Nov 24 '18 at 18:42





I only know how to achieve this using C++: In this case, you create your Qt3DWindow and place it inside a widget using QWidget::createWindowContainer. This returns a widget which you can then use in your UI. You can do this for multiple different 3D windows, although performance suffers at some point. I'm not sure if you can reuse the framegraph, though as Qt's documentation often states that objects should not be shared, but you could try and see what happens.

– Florian Blume
Nov 24 '18 at 18:42













I already created a windowContainer but i do not know how to display a single view (e.g. one of the four views). Currently all four views are displayed inside the widget. If i could solve this i want to extend it that all four views are displayes in four separate widgets.

– Tbi
Nov 24 '18 at 18:51







I already created a windowContainer but i do not know how to display a single view (e.g. one of the four views). Currently all four views are displayed inside the widget. If i could solve this i want to extend it that all four views are displayes in four separate widgets.

– Tbi
Nov 24 '18 at 18:51














1 Answer
1






active

oldest

votes


















0














In the example, the four views are created using the classes Viewport and CameraSelector.



The Viewport class



The class Viewport defines the portion of the screen that the branch of the framegraph (that the Viewport node is part of) is rendered to. The portion is defined as (x, y, width, height). The coordinates of the whole screen are (0, 0, 1, 1).



If you have a look at the QuadViewportFrameGraph class that is part of the example, you'll see four viewports defined - one for each camera. The top left camera renders to the rectangle (0, 0, 0.5, 0.5) of the screen. The top right camera on the other hand renders to (0.5, 0, 0.5, 0.5), i.e. it uses half of the screen size as its x offset.



The CameraSelector class



This class defines which camera the branch of the framegraph uses to render content. If you look into the example you'll see a CameraSelector { id: someCamera } within each Viewport instance. This way, each Viewport gets its own camera.



Conclusion



If you only want one view, remove the four Viewports within the main Viewport and add one camera selector as the child of it. So your QuadViewportFrameGraph should look like this (without import statements):



RenderSettings {
id: quadViewportFrameGraph

property alias camera: cameraSelector.camera;
property alias window: surfaceSelector.surface

activeFrameGraph: RenderSurfaceSelector {
id: surfaceSelector

Viewport {
id: mainViewport
normalizedRect: Qt.rect(0, 0, 1, 1)

ClearBuffers {
buffers: ClearBuffers.ColorDepthBuffer
clearColor: Qt.rgba(0.6, 0.6, 0.6, 1.0)

CameraSelector { id: cameraSelector }
}
}
}
}


Of course you also have to adjust the code where you instantiate the QuadViewportFrameGraph and only set the one camera. If you now want all four views displayed in separate widgets you need to create four 3D windows and window containers and such a framegraph for each (with different cameras of course).



But be warned that the performance might be crappy if you create for distinct 3D windows. As far as I know, there are no other solutions to obtain 3D widgets.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53460898%2fqt3d-multiview-single-view-in-widget%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    In the example, the four views are created using the classes Viewport and CameraSelector.



    The Viewport class



    The class Viewport defines the portion of the screen that the branch of the framegraph (that the Viewport node is part of) is rendered to. The portion is defined as (x, y, width, height). The coordinates of the whole screen are (0, 0, 1, 1).



    If you have a look at the QuadViewportFrameGraph class that is part of the example, you'll see four viewports defined - one for each camera. The top left camera renders to the rectangle (0, 0, 0.5, 0.5) of the screen. The top right camera on the other hand renders to (0.5, 0, 0.5, 0.5), i.e. it uses half of the screen size as its x offset.



    The CameraSelector class



    This class defines which camera the branch of the framegraph uses to render content. If you look into the example you'll see a CameraSelector { id: someCamera } within each Viewport instance. This way, each Viewport gets its own camera.



    Conclusion



    If you only want one view, remove the four Viewports within the main Viewport and add one camera selector as the child of it. So your QuadViewportFrameGraph should look like this (without import statements):



    RenderSettings {
    id: quadViewportFrameGraph

    property alias camera: cameraSelector.camera;
    property alias window: surfaceSelector.surface

    activeFrameGraph: RenderSurfaceSelector {
    id: surfaceSelector

    Viewport {
    id: mainViewport
    normalizedRect: Qt.rect(0, 0, 1, 1)

    ClearBuffers {
    buffers: ClearBuffers.ColorDepthBuffer
    clearColor: Qt.rgba(0.6, 0.6, 0.6, 1.0)

    CameraSelector { id: cameraSelector }
    }
    }
    }
    }


    Of course you also have to adjust the code where you instantiate the QuadViewportFrameGraph and only set the one camera. If you now want all four views displayed in separate widgets you need to create four 3D windows and window containers and such a framegraph for each (with different cameras of course).



    But be warned that the performance might be crappy if you create for distinct 3D windows. As far as I know, there are no other solutions to obtain 3D widgets.






    share|improve this answer




























      0














      In the example, the four views are created using the classes Viewport and CameraSelector.



      The Viewport class



      The class Viewport defines the portion of the screen that the branch of the framegraph (that the Viewport node is part of) is rendered to. The portion is defined as (x, y, width, height). The coordinates of the whole screen are (0, 0, 1, 1).



      If you have a look at the QuadViewportFrameGraph class that is part of the example, you'll see four viewports defined - one for each camera. The top left camera renders to the rectangle (0, 0, 0.5, 0.5) of the screen. The top right camera on the other hand renders to (0.5, 0, 0.5, 0.5), i.e. it uses half of the screen size as its x offset.



      The CameraSelector class



      This class defines which camera the branch of the framegraph uses to render content. If you look into the example you'll see a CameraSelector { id: someCamera } within each Viewport instance. This way, each Viewport gets its own camera.



      Conclusion



      If you only want one view, remove the four Viewports within the main Viewport and add one camera selector as the child of it. So your QuadViewportFrameGraph should look like this (without import statements):



      RenderSettings {
      id: quadViewportFrameGraph

      property alias camera: cameraSelector.camera;
      property alias window: surfaceSelector.surface

      activeFrameGraph: RenderSurfaceSelector {
      id: surfaceSelector

      Viewport {
      id: mainViewport
      normalizedRect: Qt.rect(0, 0, 1, 1)

      ClearBuffers {
      buffers: ClearBuffers.ColorDepthBuffer
      clearColor: Qt.rgba(0.6, 0.6, 0.6, 1.0)

      CameraSelector { id: cameraSelector }
      }
      }
      }
      }


      Of course you also have to adjust the code where you instantiate the QuadViewportFrameGraph and only set the one camera. If you now want all four views displayed in separate widgets you need to create four 3D windows and window containers and such a framegraph for each (with different cameras of course).



      But be warned that the performance might be crappy if you create for distinct 3D windows. As far as I know, there are no other solutions to obtain 3D widgets.






      share|improve this answer


























        0












        0








        0







        In the example, the four views are created using the classes Viewport and CameraSelector.



        The Viewport class



        The class Viewport defines the portion of the screen that the branch of the framegraph (that the Viewport node is part of) is rendered to. The portion is defined as (x, y, width, height). The coordinates of the whole screen are (0, 0, 1, 1).



        If you have a look at the QuadViewportFrameGraph class that is part of the example, you'll see four viewports defined - one for each camera. The top left camera renders to the rectangle (0, 0, 0.5, 0.5) of the screen. The top right camera on the other hand renders to (0.5, 0, 0.5, 0.5), i.e. it uses half of the screen size as its x offset.



        The CameraSelector class



        This class defines which camera the branch of the framegraph uses to render content. If you look into the example you'll see a CameraSelector { id: someCamera } within each Viewport instance. This way, each Viewport gets its own camera.



        Conclusion



        If you only want one view, remove the four Viewports within the main Viewport and add one camera selector as the child of it. So your QuadViewportFrameGraph should look like this (without import statements):



        RenderSettings {
        id: quadViewportFrameGraph

        property alias camera: cameraSelector.camera;
        property alias window: surfaceSelector.surface

        activeFrameGraph: RenderSurfaceSelector {
        id: surfaceSelector

        Viewport {
        id: mainViewport
        normalizedRect: Qt.rect(0, 0, 1, 1)

        ClearBuffers {
        buffers: ClearBuffers.ColorDepthBuffer
        clearColor: Qt.rgba(0.6, 0.6, 0.6, 1.0)

        CameraSelector { id: cameraSelector }
        }
        }
        }
        }


        Of course you also have to adjust the code where you instantiate the QuadViewportFrameGraph and only set the one camera. If you now want all four views displayed in separate widgets you need to create four 3D windows and window containers and such a framegraph for each (with different cameras of course).



        But be warned that the performance might be crappy if you create for distinct 3D windows. As far as I know, there are no other solutions to obtain 3D widgets.






        share|improve this answer













        In the example, the four views are created using the classes Viewport and CameraSelector.



        The Viewport class



        The class Viewport defines the portion of the screen that the branch of the framegraph (that the Viewport node is part of) is rendered to. The portion is defined as (x, y, width, height). The coordinates of the whole screen are (0, 0, 1, 1).



        If you have a look at the QuadViewportFrameGraph class that is part of the example, you'll see four viewports defined - one for each camera. The top left camera renders to the rectangle (0, 0, 0.5, 0.5) of the screen. The top right camera on the other hand renders to (0.5, 0, 0.5, 0.5), i.e. it uses half of the screen size as its x offset.



        The CameraSelector class



        This class defines which camera the branch of the framegraph uses to render content. If you look into the example you'll see a CameraSelector { id: someCamera } within each Viewport instance. This way, each Viewport gets its own camera.



        Conclusion



        If you only want one view, remove the four Viewports within the main Viewport and add one camera selector as the child of it. So your QuadViewportFrameGraph should look like this (without import statements):



        RenderSettings {
        id: quadViewportFrameGraph

        property alias camera: cameraSelector.camera;
        property alias window: surfaceSelector.surface

        activeFrameGraph: RenderSurfaceSelector {
        id: surfaceSelector

        Viewport {
        id: mainViewport
        normalizedRect: Qt.rect(0, 0, 1, 1)

        ClearBuffers {
        buffers: ClearBuffers.ColorDepthBuffer
        clearColor: Qt.rgba(0.6, 0.6, 0.6, 1.0)

        CameraSelector { id: cameraSelector }
        }
        }
        }
        }


        Of course you also have to adjust the code where you instantiate the QuadViewportFrameGraph and only set the one camera. If you now want all four views displayed in separate widgets you need to create four 3D windows and window containers and such a framegraph for each (with different cameras of course).



        But be warned that the performance might be crappy if you create for distinct 3D windows. As far as I know, there are no other solutions to obtain 3D widgets.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 25 '18 at 20:47









        Florian BlumeFlorian Blume

        547317




        547317






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53460898%2fqt3d-multiview-single-view-in-widget%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Contact image not getting when fetch all contact list from iPhone by CNContact

            count number of partitions of a set with n elements into k subsets

            A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks