linuxdeepin / dtkwidget

Deepin Toolkit, widget module for DDE look and feel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DMainWindow调用this->menuBar()崩溃

a137748099 opened this issue · comments

dtkwidget 5.5.3
DMainWindow类中调用this->menuBar()崩溃
使用QMainWindows是正常的
DMainWindow的其他接口如statusBar()、titlebar()也是正常的
有人遇到这个问题吗
还是我环境配置缺少东西了

commented

因为 DMainWindow 的 dtitlebar 是放到 menubar 的位置(setMenuWidget(titlebar));
QMainWindow 在调用menubar()时会去将menuwidget 转成menubar,如果转换失败就setMenuBar,而setMenuBar时会调用旧的menubar的接口,旧的menubar也是通过转换 (QMenuBar *oldMenuBar = qobject_cast<QMenuBar *>(topLayout->menuBar());) 此时 oldMenuBar 为空指针,但是没有做判断直接调用了。
20211230
image
image

commented

image

commented

dmainwindow设计时应该没有考虑要menubar的这个东西,如果需要加可以在centralWidget中加一个布局来模拟menubar

commented

https://codereview.qt-project.org/c/qt/qtbase/+/380906 qt修复了这个,后续应该会更新patch到uos的qt版本中