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. How do I implement a "maximized" layout strategy for QMdiArea?
QtWS25 Last Chance

How do I implement a "maximized" layout strategy for QMdiArea?

Scheduled Pinned Locked Moved Solved General and Desktop
qmdiarealayout strategylinux
6 Posts 2 Posters 3.3k Views
  • 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
    thuswm
    wrote on 6 Dec 2015, 16:59 last edited by
    #1

    Hello!
    I have recently started a small learning project where I am using an QMdiArea as the central widget. This widget is also given a subwindow in the form of a QGlWidget. I would like that this subwindow is initialized as maximised when I start the application. So far I have not succeded and since I have not managed find anyone else asking this question it must be easily solvable. :-)

    According to the QMdiArea documentation I can see that there are two built in layout strategies: Tiled and cascaded. None of these suite my need. I would like to use a third: Maximized.

    Obviously this is something that can be implemented since I have seen applications built on Qt acting this way. Can someone tell me how to go about solving my problem? I have tried to use the showMaximized member function on the subwindow but it has no effect.

    I am working on a Linux box running OpenSUSE 13.2 (KDE Desktop) and linking to Qt 4.8.6.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 6 Dec 2015, 22:56 last edited by
      #2

      Hi and welcome to devnet,

      Wouldn't showMaximized do what you want ?

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

      T 1 Reply Last reply 7 Dec 2015, 19:36
      0
      • S SGaist
        6 Dec 2015, 22:56

        Hi and welcome to devnet,

        Wouldn't showMaximized do what you want ?

        T Offline
        T Offline
        thuswm
        wrote on 7 Dec 2015, 19:36 last edited by
        #3

        @SGaist Thank you!
        The problem is that the showMaximized member function (i am calling it from the main function) does not have an effect when I am calling it. Maybe this is due to the fact that I am running on X11. The documentation mentions that "On X11, this function may not work properly with certain window managers. See the Window Geometry documentation for an explanation."
        However the additional information under Window Geometry did not provide any solution to me.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 7 Dec 2015, 20:03 last edited by SGaist 12 Jul 2015, 20:04
          #4

          One thing you can try is to set the geometry of the client to match the one of QMdiArea

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

          T 1 Reply Last reply 11 Dec 2015, 08:38
          0
          • S SGaist
            7 Dec 2015, 20:03

            One thing you can try is to set the geometry of the client to match the one of QMdiArea

            T Offline
            T Offline
            thuswm
            wrote on 11 Dec 2015, 08:38 last edited by
            #5

            @SGaist Thank you for your help! I have now solved the problem!

            The thing was that I tried to maximize the widget of the QMdiSubWindow instead of maximizing the QMdiSubWindow itself! So by using the following code it now works (MainWindow inherits QMdiArea and Viewer inherits QGLWidget):

             // Create main window
              MainWindow* w = new MainWindow;
            
              // create viewer widget and add it to the main window
              Viewer* v = new Viewer;
              w->addSubWindow(v);
            
              // get subwindow
              QMdiSubWindow* sw = w->currentSubWindow();
            
              // maximize sub window
              sw->showMaximized();
            
              // show main window
              w->show();
            
            
            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 11 Dec 2015, 22:16 last edited by
              #6

              Didn't thought of that one :)

              Glad you found out !

              Since you have it working now, please mark the thread as solved using the "Topic Tool" button so that other forum users may know a solution has been found :)

              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

              4/6

              7 Dec 2015, 20:03

              • Login

              • Login or register to search.
              4 out of 6
              • First post
                4/6
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved