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. QDockWidget problem
Forum Updated to NodeBB v4.3 + New Features

QDockWidget problem

Scheduled Pinned Locked Moved General and Desktop
10 Posts 2 Posters 3.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.
  • V Offline
    V Offline
    valeSimu
    wrote on last edited by
    #1

    I would like to put a dock widget to the left of the dock widget area with a certain h, w maximum size and with the following code, the dock covers the entire heigh of the main window...

    @ QDockWidget *simuPanelDock = new QDockWidget( tr("Info"), this);
    simuPanelDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
    QWidget *simuPanelW = new QWidget();
    simuPanelW->setMaximumSize(200,100);

    simuPanelDock->setWidget(simuPanelW);
    simuPanelDock->show();
    
    addDockWidget(Qt::LeftDockWidgetArea, simuPanelDock);@
    

    The strange thing is if I add it in Qt::RightDockWidgetArea it appeares in the size I declared!!

    What I did wrong? Thank you in advance!

    1 Reply Last reply
    0
    • A Offline
      A Offline
      amonR
      wrote on last edited by
      #2

      I don't realy know where the problem is but I see you set a maximum size for simuPanelW, what happens if you set a maximum one for simupanelDock?

      1 Reply Last reply
      0
      • V Offline
        V Offline
        valeSimu
        wrote on last edited by
        #3

        I tried it also, but no results. "Here":http://stackoverflow.com/questions/23656791/qt-qdockwidget-do-not-set-the-right-size?noredirect=1#comment36338379_23656791 I put more details..

        1 Reply Last reply
        0
        • A Offline
          A Offline
          amonR
          wrote on last edited by
          #4

          Sorry I really don't see what is wrong in your code. Have you tried to separate the setAllowedAreas() function? I mean this way:
          @
          simuPanelDock->setAllowedAreas(Qt::LeftDockWidgetArea);
          simuPanelDock->setAllowedAreas(Qt::RightDockWidgetArea);
          @
          I experienced a strange behaviour by puting together once, but I don't think it is real one.

          1 Reply Last reply
          0
          • V Offline
            V Offline
            valeSimu
            wrote on last edited by
            #5

            Thank you amonR for your proposition, but unfortunately it does not work :-( I don't know how to solve this problem :-(

            1 Reply Last reply
            0
            • V Offline
              V Offline
              valeSimu
              wrote on last edited by
              #6

              I tried to set the maximum size on the dockwidget like this: @simuPanelDock->setMaximumSize(200,100);@ but no result. I tried also to set *simuPanelW *AND simuPanelDock too but again no results... In the same code I have two more QDockWidgets and the maximum size is set on their child widgets, they are placed on the right dock and respect the size I declared. I tried to put them on the left dock and it appears the same problem: the size of the dock take the entire height of the main window. Thus, I think that the left dock is the problem, don't you think so?

              1 Reply Last reply
              0
              • V Offline
                V Offline
                valeSimu
                wrote on last edited by
                #7

                This problem appears only in the left and top dock area, while in the bottom and right not. at the top of the QMainWindow I added a toolbar...Please help me!

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  amonR
                  wrote on last edited by
                  #8

                  The left dock can indeed be the problem but the size and the content of your main window can be too. Does the content or widget of your main window has a fixed size? I think you should post the code of your main window.

                  1 Reply Last reply
                  0
                  • V Offline
                    V Offline
                    valeSimu
                    wrote on last edited by
                    #9

                    The main window is set in this way:

                    @ this->setMinimumSize(1000,800);
                    setFocusPolicy(Qt::ClickFocus);

                    ogre = new QOgre::Widget(this);
                    this->setCentralWidget(ogre);@
                    

                    As you con see, the central widget is an QOgre::Widget... could it be the problem?
                    Generally, the top and the left side of the main window is always fixed when someone resize it, maybe there is some predefined settings that tell the dock area to cover the entire area always?
                    So I thought that ogre was the problem and I commented this line
                    @ this->setCentralWidget(ogre);@

                    What happend is that the widged of ogre is still there and the widgets are in the right size!!! but now the problem is that they are BLACK!! what's wrong?!

                    Maybe the Ogre and QMainWindows should be separated... How should I configure them in a way that they are independant but linked?

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      amonR
                      wrote on last edited by
                      #10

                      Sorry but I didn't even know we could use Ogre with Qt and I have never used it either, so I am not familiar at all with it. Probably it is the problem but I won't be able to help on this side. Have you tried to put another widget than Ogre in the centralWidget to see what happens? Instead of setMaximumSize for SimuPanelW have you tried to use setMaximumHeight() and setMaximumWidth()?
                      I hope someone with a better knowledge of Qt will help because I really don't see where the problem is.

                      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