QDockWidget problem
-
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!
-
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?
-
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..
-
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. -
Thank you amonR for your proposition, but unfortunately it does not work :-( I don't know how to solve this problem :-(
-
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?
-
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!
-
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.
-
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?
-
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.