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. Floating Windows bound by MainWindow?
Forum Updated to NodeBB v4.3 + New Features

Floating Windows bound by MainWindow?

Scheduled Pinned Locked Moved General and Desktop
6 Posts 4 Posters 7.3k 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.
  • K Offline
    K Offline
    kchilaka
    wrote on last edited by
    #1

    Folks,
    I am trying to create a UI which has a movable floating window over the QMainWindow. I want a window that is restricted in its motion to the frame of the QMainWindow. I tried using the QDialog class to hold my UI element (a QLineEdge widget) as well the QDockWidget class but I cant seem to "contain" these elements within the bounds of the QMainWindow. These behave like top level windows that can be dragged anywhere on the screen. I want them to behave as children of the MainWindow. How can I do this? Thanks in Advance..

    1 Reply Last reply
    0
    • T Offline
      T Offline
      task_struct
      wrote on last edited by
      #2

      If I understand you right, you want "MDI":http://doc.qt.nokia.com/latest/mainwindows-mdi.html

      "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program."

      • Linu...
      1 Reply Last reply
      0
      • K Offline
        K Offline
        kchilaka
        wrote on last edited by
        #3

        Well, you are right, I want something like MDI .. Let me look into it.. Don't know if I can have a QGLWidget as my background in an MDI area.. Let me explore that a bit.. Thanks !

        1 Reply Last reply
        0
        • G Offline
          G Offline
          giesbert
          wrote on last edited by
          #4

          The background of an MDI is an "QMdiArea,":http://doc.qt.nokia.com/4.7/qmdiarea.html which is an abstract scroll area. By default, it is no QGLWidget. Indisde the MDI area, you can place any widget as sub windown, which is then hosted inside a "QMdiSubWindow":http://doc.qt.nokia.com/4.7/qmdisubwindow.html

          Nokia Certified Qt Specialist.
          Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

          1 Reply Last reply
          0
          • K Offline
            K Offline
            kchilaka
            wrote on last edited by
            #5

            Using the QMdiArea as a container for my windows is a No-Go. What I tried to do is get a QGLWidget to cover the entire QMdiArea and have my text input widgets floating on top of it.
            The problem is there does not seem to be a way to set my own layout on the QMdiArea object.

            The way it looks right now..The minimized window/widget on the left is my QGLWidget and the visible widget is my TextEdit.. I was trying to make my QGLWidget cover the entire MDI area and have the TextEdit float on top.. Fail :(
            !http://img198.imageshack.us/img198/614/screenshotsrv.png(CurrentMdi Result)!

            The code for the app..
            !http://img233.imageshack.us/img233/781/screenshot1mb.png!

            The closest I got to my goal was by using a QGraphicsView with a QGLWidget as my viewport and adding my Widgets to a QGraphicsScene. This way everything is being rendered in opengl and I overrode the drawbackground method on QGraphicsScene. This way, the background was my 3D OpenGL Model and the foreground were the widgets.. I got this approach from the QT Quarterly archives..This should have ended up looking like

            !http://doc.qt.nokia.com/qq/qq26-openglwidgets2.png!

            But the behavior of the Widgets in the QGraphicsScene seems to have changed since the original article was writte. They end up looking like the following. The widgets are not movable either, even when the move flags are set..
            !http://img831.imageshack.us/img831/778/screenshot2te.jpg!

            Maybe I need to explain what I am trying to do. I am trying to create a UI vaguely similar to the concept of how Photoshop looks..The background will display the 3D OpenGl Object the user will manipulate.. The foreground will be the widgets that have the controls to manipulate the 3D Image. The widgets may be buttons, text edit boxes(for a command line interface) .. and so on..

            !http://www.thebandfrom.com/wp-content/uploads/photoshop-ui.png!

            1 Reply Last reply
            0
            • C Offline
              C Offline
              Camay
              wrote on last edited by
              #6

              hey~have you solved your problem? i have met with the same problem.

              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