Qt下HBoxLayout里的按钮有重叠

没想到是一个bug,而且六年了都没有解决:

https://bugreports.qt.io/browse/QTBUG-14591

http://stackoverflow.com/questions/3978889/why-is-qhboxlayout-causing-widgets-to-overlap

http://stackoverflow.com/questions/22519217/items-in-qhboxlayout-layout-overlap

http://doc.qt.io/qt-4.8/qmacnativewidget.html

临时方案是,给layout里的每一个控件都加上:

pushButton->setAttribute(Qt::WA_LayoutUsesWidgetRect);

真是够麻烦的~

posted @ 2016-08-02 16:53  findumars  Views(2124)  Comments(0Edit  收藏  举报