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. Moving a QWindow to/from a QWidget Container to it's own window and back...
Forum Updated to NodeBB v4.3 + New Features

Moving a QWindow to/from a QWidget Container to it's own window and back...

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 1.2k 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.
  • T Offline
    T Offline
    tmason101
    wrote on last edited by
    #1

    Hello,

    I hope this sounds simple enough but I don't know how to do it:

    I have a working QWindow implementation where I am rendering OpenGL content.

    I know how to have the QWindow open in it's own window and I know how to create a QWidget rendering container to put the QWindow inside an MDI container, for example.

    Here is the tricky part; I want the user to have the ability to easily switch the QWindow from being "inside" the MDI/QMainWindow to being a separate window.

    So, for example, they press a "fullscreen" button on the toolbar and the QWindow pops out into a separate window while the main app is still running and then when the user hits escape then the QWindow comes right back into a QWidget rendering container.

    The key here is that I don't want to destroy the QWindow or the OpenGL context; I want to maintain state.

    Is this possible?

    Thank you for your time.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      melghawi
      wrote on last edited by
      #2

      Hi tmason,

      I'm not sure if there is a quick and simple out of the box solution to this but the way I would go about it is to create a State class that holds a Ui's state (something like a Model in an MVC based system).

      Then you can pass this state object between different ui's e.g pass it from your QWindow inside the QMainWindow to another QWidget that is outside.

      So you can destroy/create ui's without having to destroy your OpenGL context etc.

      1 Reply Last reply
      0
      • C Offline
        C Offline
        ckakman
        wrote on last edited by
        #3

        Hi,

        I don't have much experience with QWindow but I guess what you need to do is to use QWindows::setParent(0) to "detach" the QWindow instance from the main application and use QWidget::​createWindowContainer() to put it back into the main application.

        A signal form QWindow to the main application can trigger reattaching.

        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