看了几天了,内存溢出的问题修复完成了,开源的项目Advanced-Docking-System想不到这么多问题,bugfix真要命,关键GitHub上stars还挺多的,原作者估计不想维护了,毕竟bug太多了
这几天把菜单理了一下,之前的作者写得太乱了,太难读了,代码冗余太多了,这几天再改bug,算当作学习之用吧
///
DockAreaTitleBar.cpp 只有TitleBar操作CDockAreaWidget
//============================================================================
void CDockAreaTitleBar::onPinGroupToActionClicked()//Pin Group to
{
int Location = sender()->property(internal::LocationProperty).toInt();
d->DockAreaWidget->toggleAutoHide((SideBarLocation)Location);
}
void CDockAreaWidget::toggleAutoHide(SideBarLocation Location)
{
//if (!isAutoHideFeatureEnabled())已经启用了AutoHideFeatureEnabled
//{
// return;
//}
setAutoHide(!isAutoHide(), Location);
}
/
//autohideTab.cpp,操作CDockWidget
//============================================================================
void CAutoHideTab::onUnpinActionClicked()
{//这个是鼠标右键弹出菜单Unpin的槽函数,参数false表示把一个autohide页面变成dock页面,位置默认为SideBarNone
d->DockWidget->setAutoHide(false);
}
void CAutoHideTab::onPinToActionClicked()
{
//这个是鼠标右键弹出菜单Pin to的Slots函数,参见上面的contextMenuEvent函数
int Location = sender()->property(internal::LocationProperty).toInt();//Location由Pin to子菜单决定
//pin一个autohide页面,位置为Location
d->DockWidget->setAutoHide(true, (SideBarLocation)Location);
}
//DockWidgetTab.cpp,操作CDockWidget
//===========================================================================
void CDockWidgetTab::onPinToActionClicked()
{这个是鼠标右键弹出菜单Pin to的Slots函数,参见上面的contextMenuEvent函数
int Location = sender()->property(internal::LocationProperty).toInt();
d->DockWidget->toggleAutoHide((SideBarLocation)Location);
}
void CDockWidget::toggleAutoHide(SideBarLocation Location)//called by CDockWidgetTab::pinAutoHideDockWidget()
{
//if (!CDockManager::testAutoHideConfigFlag(CDockManager::AutoHideFeatureEnabled))//zxb
//{
// return;
//}
setAutoHide(!isAutoHide(), Location);
}