PDA

View Full Version : Change Start position of Drawer in RightArea of QMainWindow



santosh.kumar
31st July 2014, 10:51
Hi

I am using Qt 4.6.4 on Mac.

I am using DockWidget as Drawer in RightAllowed Area. Following Code is...

QDockWidget *m_pDock = new QDockWidget(this,Qt::Drawer);
MyWdgt *m_pMyWdgt = new MyWdgt(this);

m_pDock->setFixedWidth(215);
m_pDock->setWidget(m_pMyWdgt);
this->addDockWidget(Qt::RightDockWidgetArea,m_pDock);

It is showing properly..
I am using setUnifiedTitleAndToolBarOnMac(true); for QMainWindow...

Due to setUnifiedTitleAndToolBarOnMac, Drawer's default Y position is not same level of Toolbar or Window...It starts from center of toolbar..

Kindly look the screen...

I want to change Y position of Drawer so that it will show below from its default Y's position.

I have attached Sample Screen for this...

Thanks
Santosh

d_stranz
2nd August 2014, 21:27
It is showing properly..

No it isn't. Just like the screen shot in your other post, this dock widget is not docked. It is floating to the right of and slightly under the main window.

Read the manual for QDockWidget::isFloating():


floating : bool
This property holds whether the dock widget is floating. A floating dock widget is presented to the user as an independent window "on top" of its parent QMainWindow, instead of being docked in the QMainWindow. By default, this property is true.

Access functions:
bool isFloating() const
void setFloating(bool floating)


Because you do not set the floating property to false, your dock widgets are created floating, not docked. If they were docked, they would be inside the frame of the main window. Yours are floating outside it.